/* Base Layout, Containers & Typography */
        /* Custom Dark Scrollbar */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }
        ::-webkit-scrollbar-track {
            background: #0d0b0a;
        }
        ::-webkit-scrollbar-thumb {
            background: rgba(139, 92, 246, 0.4);
            border-radius: 8px;
            border: 1px solid rgba(13, 11, 10, 0.8);
        }
        ::-webkit-scrollbar-thumb:hover {
            background: rgba(139, 92, 246, 0.75);
        }
        * {
            scrollbar-width: thin;
            scrollbar-color: rgba(139, 92, 246, 0.4) #0d0b0a;
        }

        /* Main Page Wrapper */
        .main-wrapper {
            width: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 32px 16px 48px;
            position: relative;
            z-index: 10;
        }
        body.is-native-app .main-wrapper {
            padding: 0;
        }

        /* Screen Container */
        .app-container {
            width: 100%;
            max-width: 450px;
            position: relative;
            z-index: 10;
            margin: 0 auto;
        }
        .app-container:has(.places-dropdown.show),
        .app-container.has-dropdown-open {
            z-index: 2000;
        }
        @media (min-width: 768px) {
            .app-container {
                max-width: 660px;
            }
        }
        body.is-native-app .app-container {
            max-width: 450px !important;
        }

        /* Top Bar with Language Switcher & APK Download (Mobile/Native) */
        .top-bar {
            display: none;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 14px;
            width: 100%;
            direction: ltr !important;
        }
        body.is-native-app .top-bar {
            display: flex;
        }


        /* Language Selector Dropdown (10 Languages) */
        .lang-selector-dropdown {
            position: relative;
            display: inline-block;
            direction: ltr !important;
            unicode-bidi: isolate;
        }

        .lang-select-btn {
            display: inline-flex;
            align-items: center;
            gap: 7px;
            height: 32px;
            padding: 0 12px;
            border-radius: 50px;
            background: rgba(28, 25, 23, 0.92);
            border: 1px solid var(--border);
            color: #e7e5e4;
            font-family: inherit;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
            transition: all 0.22s ease;
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        }

        .lang-select-btn:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: rgba(139, 92, 246, 0.45);
            color: #ffffff;
            box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
            transform: translateY(-1px);
        }

        .lang-select-btn:active {
            transform: scale(0.96);
        }

        .lang-globe-icon {
            width: 15px;
            height: 15px;
            fill: #a78bfa;
            flex-shrink: 0;
            transition: transform 0.25s ease;
        }

        .lang-select-btn:hover .lang-globe-icon {
            transform: rotate(25deg);
        }

        .lang-btn-text {
            font-weight: 700;
            letter-spacing: 0.1px;
            font-size: 11.5px;
        }

        .lang-chevron {
            width: 14px;
            height: 14px;
            fill: #a8a29e;
            flex-shrink: 0;
            transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .lang-selector-dropdown.open .lang-select-btn {
            border-color: var(--primary);
            background: rgba(124, 58, 237, 0.2);
            color: #ffffff;
            box-shadow: 0 0 16px rgba(124, 58, 237, 0.4);
        }

        .lang-selector-dropdown.open .lang-chevron {
            transform: rotate(180deg);
            fill: #c4b5fd;
        }

        /* Dropdown Menu */
        .lang-dropdown-menu {
            position: absolute;
            top: calc(100% + 8px);
            right: 0;
            min-width: 175px;
            max-height: 380px;
            overflow-y: auto;
            overscroll-behavior: contain;
            background: rgba(20, 16, 15, 0.96);
            backdrop-filter: blur(24px) saturate(180%);
            -webkit-backdrop-filter: blur(24px) saturate(180%);
            border: 1px solid rgba(139, 92, 246, 0.35);
            border-radius: 16px;
            padding: 6px;
            box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 20px rgba(124, 58, 237, 0.2);
            z-index: 1000;
            opacity: 0;
            transform: translateY(-8px) scale(0.96);
            pointer-events: none;
            transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
            display: flex;
            flex-direction: column;
            gap: 2px;
            direction: ltr !important;
            scrollbar-width: thin;
            scrollbar-color: rgba(139, 92, 246, 0.35) transparent;
        }

        .lang-dropdown-menu::-webkit-scrollbar {
            width: 4px;
        }
        .lang-dropdown-menu::-webkit-scrollbar-thumb {
            background: rgba(139, 92, 246, 0.4);
            border-radius: 4px;
        }

        .lang-selector-dropdown.open .lang-dropdown-menu {
            opacity: 1;
            transform: translateY(0) scale(1);
            pointer-events: auto;
        }

        .lang-dropdown-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            padding: 8px 12px;
            border: none;
            background: transparent;
            border-radius: 10px;
            color: #d6d3d1;
            font-family: inherit;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.18s ease;
            text-align: left;
            direction: ltr !important;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }

        .lang-dropdown-item:hover {
            background: rgba(139, 92, 246, 0.15);
            color: #ffffff;
            transform: translateX(2px);
        }

        .lang-dropdown-item.active {
            background: rgba(124, 58, 237, 0.25);
            color: #c4b5fd;
            font-weight: 700;
        }

        .lang-dropdown-item .lang-item-name {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .lang-dropdown-item .lang-item-code {
            font-size: 10px;
            font-weight: 800;
            padding: 2px 5px;
            border-radius: 4px;
            background: rgba(255, 255, 255, 0.08);
            color: #a8a29e;
        }

        .lang-dropdown-item.active .lang-item-code {
            background: rgba(124, 58, 237, 0.4);
            color: #ffffff;
        }

        .lang-dropdown-item .lang-item-check {
            width: 14px;
            height: 14px;
            fill: #a78bfa;
            opacity: 0;
            transition: opacity 0.15s ease;
        }

        .lang-dropdown-item.active .lang-item-check {
            opacity: 1;
        }

        @media (max-width: 480px) {
            .lang-select-btn {
                padding: 0 9px;
                gap: 5px;
                height: 30px;
            }
            .lang-dropdown-menu {
                min-width: 160px;
                max-height: 320px;
            }
        }


        /* Header */
        header {
            text-align: center;
            margin-top: 4px;
            margin-bottom: 22px;
        }
        .app-icon {
            width: 56px;
            height: 56px;
            margin: 0 auto 12px;
            border-radius: 18px;
            background: var(--primary-gradient);
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 8px 24px -4px rgba(124, 58, 237, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.4);
            border: 1px solid rgba(255, 255, 255, 0.15);
        }
        .app-icon svg {
            width: 32px;
            height: 32px;
        }
        header h1 {
            font-size: 22px;
            font-weight: 900;
            letter-spacing: -0.3px;
            color: #ffffff;
            margin-bottom: 4px;
        }
        header p {
            font-size: 13px;
            color: var(--text-sub);
            font-weight: 600;
        }

        /* Glass Cards */
        .glass-card {
            position: relative;
            z-index: 20;
            background: var(--card);
            backdrop-filter: blur(24px) saturate(180%);
            -webkit-backdrop-filter: blur(24px) saturate(180%);
            border: 1px solid var(--border);
            border-radius: var(--radius-app);
            padding: 20px 16px;
            box-shadow: var(--shadow-glass);
            margin-bottom: 16px;
        }
        body.is-native-app .glass-card {
            background: linear-gradient(180deg, rgba(31, 28, 26, 0.96) 0%, rgba(22, 19, 18, 0.97) 100%);
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
        }

        .main-input-card {
            z-index: 50;
        }
        .main-input-card:has(.places-dropdown.show),
        .main-input-card.has-dropdown-open {
            z-index: 2000;
        }


        /* App Version & Update Pill in Top Bar */
        .btn-version-pill {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 5px 12px;
            background: rgba(28, 25, 23, 0.9);
            border: 1px solid var(--border);
            border-radius: 50px;
            color: var(--text-muted);
            font-family: 'Inter', 'Cairo', sans-serif;
            font-size: 11.5px;
            font-weight: 600;
            cursor: pointer;
            transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
            user-select: none;
        }
        @media (hover: hover) and (pointer: fine) {
            .btn-version-pill:hover {
                background: rgba(139, 92, 246, 0.12);
                border-color: rgba(139, 92, 246, 0.4);
                color: #c4b5fd;
                transform: translateY(-1px);
            }
        }
        .btn-version-pill:active {
            transform: scale3d(0.95, 0.95, 1);
        }
        .btn-version-pill.has-update {
            background: linear-gradient(135deg, rgba(34, 197, 94, 0.22) 0%, rgba(16, 185, 129, 0.35) 100%);
            border: 1.5px solid #22c55e;
            color: #ffffff;
            font-weight: 800;
            box-shadow: 0 0 16px rgba(34, 197, 94, 0.45), 0 2px 8px rgba(0, 0, 0, 0.4);
            animation: badge-attention-glow 2.4s ease-in-out infinite;
        }
        .btn-version-pill.has-update::after {
            content: 'New';
            font-size: 9.5px;
            font-weight: 800;
            background: #22c55e;
            color: #0c0a09;
            padding: 1px 6px;
            border-radius: 20px;
            margin-left: 4px;
            letter-spacing: 0.2px;
            display: inline-block;
        }
        [dir="rtl"] .btn-version-pill.has-update::after,
        html[lang="ar"] .btn-version-pill.has-update::after {
            content: 'تحديث';
            margin-left: 0;
            margin-right: 4px;
        }
        .version-dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: #78716c;
            display: inline-block;
            transition: background 0.3s;
        }
        .btn-version-pill.has-update .version-dot {
            background: #4ade80;
            box-shadow: 0 0 10px #4ade80;
            animation: ping-radar 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
        }
        @keyframes ping-radar {
            0% {
                transform: scale(0.9);
                box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.8);
            }
            70% {
                transform: scale(1.25);
                box-shadow: 0 0 0 7px rgba(74, 222, 128, 0);
            }
            100% {
                transform: scale(0.9);
                box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
            }
        }
        @keyframes badge-attention-glow {
            0%, 100% {
                box-shadow: 0 0 12px rgba(34, 197, 94, 0.35), inset 0 0 6px rgba(34, 197, 94, 0.2);
                border-color: rgba(34, 197, 94, 0.6);
            }
            50% {
                box-shadow: 0 0 22px rgba(34, 197, 94, 0.75), inset 0 0 10px rgba(34, 197, 94, 0.4);
                border-color: #4ade80;
            }
        }

        /* Brand Badge (Navbar) clickable */
        .brand-badge {
            cursor: pointer;
            transition: all 0.2s ease;
        }
        .brand-badge:hover {
            transform: scale(1.05);
            background: rgba(139, 92, 246, 0.25);
            border-color: rgba(139, 92, 246, 0.5);
            color: #c4b5fd;
        }
        .brand-badge.has-update {
            background: linear-gradient(135deg, rgba(34, 197, 94, 0.22) 0%, rgba(16, 185, 129, 0.35) 100%);
            border: 1.5px solid #22c55e;
            color: #ffffff;
            font-weight: 800;
            box-shadow: 0 0 16px rgba(34, 197, 94, 0.45);
            animation: badge-attention-glow 2.4s ease-in-out infinite;
        }
        .brand-badge.has-update::after {
            content: 'New';
            font-size: 9px;
            font-weight: 800;
            background: #22c55e;
            color: #0c0a09;
            padding: 1px 5px;
            border-radius: 20px;
            margin-left: 4px;
        }
        [dir="rtl"] .brand-badge.has-update::after,
        html[lang="ar"] .brand-badge.has-update::after {
            content: 'تحديث';
            margin-left: 0;
            margin-right: 4px;
        }


        /* Responsive adjustments for compact screens */
        @media (max-width: 380px) {
            body {
                padding: 12px 10px 92px;
            }
            body.is-native-app {
                padding: 12px 12px 20px;
            }
            .glass-card {
                padding: 16px 12px;
            }
            .mode-tab {
                padding: 6px 10px;
                font-size: 11.5px;
                gap: 5px;
            }
            .mode-tab svg {
                width: 14px;
                height: 14px;
            }
            .input-row {
                gap: 5px;
            }
            .btn-trash {
                width: 38px;
                min-width: 38px;
            }
            .btn-paste {
                padding: 0 8px;
                font-size: 11px;
            }
            .url-input {
                padding: 0 8px;
            }
            .url-input::placeholder {
                font-size: 10.5px;
            }
            .search-input::placeholder {
                font-size: 11px;
            }
        }
