:root[data-theme="dark"] {
    --bg-primary: rgba(1, 27, 51, 0.7);
    --bg-secondary: rgba(2, 71, 115, 0.5);
    --bg-tertiary: rgba(17, 166, 212, 0.15);
    --text-primary: #ffffff;
    --text-secondary: #9dbbd4;
    --accent-color: #00a8e8; /* Cyan */
    --accent-hover: #45c4eb;
    --border-color: rgba(0, 168, 232, 0.2);
    --modal-bg: rgba(1, 20, 38, 0.9);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
    --nav-bg: rgba(2, 18, 33, 0.85);
    --glass-blur: blur(16px);
}

:root[data-theme="light"] {
    --bg-primary: rgba(255, 255, 255, 0.85);
    --bg-secondary: rgba(230, 248, 255, 0.7);
    --bg-tertiary: rgba(17, 166, 212, 0.15);
    --text-primary: #012b48;
    --text-secondary: #587994;
    --accent-color: #035b8f;
    --accent-hover: #00a8e8;
    --border-color: rgba(17, 166, 212, 0.3);
    --modal-bg: rgba(255, 255, 255, 0.95);
    --shadow: 0 8px 32px 0 rgba(17, 166, 212, 0.25);
    --nav-bg: rgba(255, 255, 255, 0.9);
    --glass-blur: blur(20px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Instant Touch & Tap Latency Elimination */
button, a, input, select, textarea,
.nav-item, .desktop-tab, .app-card, .category-card, 
.util-btn, .action-btn, .card-install-btn, .close-modal, .icon-btn, .download-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Instant Tactile Micro-Feedback on Press/Tap (0ms) */
.nav-item:active i {
    transform: scale(0.82) !important;
}
.desktop-tab:active {
    opacity: 0.7;
    transform: scale(0.96);
}
.icon-btn:active,
.util-btn:active,
.action-btn:active,
.card-install-btn:active,
.download-btn:active,
.close-modal:active {
    transform: scale(0.95) !important;
    filter: brightness(1.15);
}
.category-card:active {
    transform: scale(0.96) !important;
}
.app-card:active {
    transform: scale(0.98);
}

body {
    background: linear-gradient(135deg, #011b33 0%, #024773 50%, #00a8e8 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Cairo', 'Inter', system-ui, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: 80px; /* Space for bottom nav */
}

:root[data-theme="light"] body {
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 50%, #4dd0e1 100%);
}

/* Floating Geometric Shapes */
.bg-shapes {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    animation: float 25s infinite linear;
}
:root[data-theme="light"] .shape {
    background: rgba(17, 166, 212, 0.1);
    border: 1px solid rgba(17, 166, 212, 0.2);
}

.shape-1 { width: 120px; height: 120px; left: 10%; top: -10%; animation-duration: 22s; }
.shape-2 { width: 180px; height: 180px; left: 75%; top: 40%; animation-duration: 35s; opacity: 0.6; }
.shape-3 { width: 70px; height: 70px; left: 35%; top: 85%; animation-duration: 18s; }
.shape-4 { width: 250px; height: 250px; left: -10%; top: 50%; animation-duration: 45s; opacity: 0.4; clip-path: polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%); }
.shape-5 { width: 90px; height: 90px; left: 85%; top: -5%; animation-duration: 28s; }
.shape-6 { width: 140px; height: 140px; left: 45%; top: 15%; animation-duration: 32s; opacity: 0.5; clip-path: polygon(50% 0%, 0% 100%, 100% 100%); }

@keyframes float {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-120vh) rotate(360deg); }
}

/* Header */
.top-header {
    background: var(--bg-primary);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.5rem 1rem 0.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0 0.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-brand { order: 1; }
.nav-actions { order: 2; }

.search-container {
    order: 3;
    width: 100%;
}


.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}


.logo-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.logo-glow {
    position: absolute;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 60%);
    opacity: 0.5;
    z-index: 0;
    border-radius: 50%;
    animation: pulseGlow 2.5s infinite alternate;
}

@keyframes pulseGlow {
    0% { transform: scale(0.8); opacity: 0.3; }
    100% { transform: scale(1.4); opacity: 0.9; }
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 10px rgba(0, 168, 232, 0.4);
    object-fit: cover;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.brand-text {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.nav-actions { display: flex; gap: 0.5rem; }
.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.icon-btn:hover { background: var(--accent-color); color: white; transform: translateY(-2px); }

.search-container {
    max-width: 1200px;
    margin: 0 auto;
}
.search-bar { position: relative; display: flex; align-items: center; }
.search-bar input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(5px);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
}
:root[dir="rtl"] .search-bar input { padding: 0.8rem 2.5rem 0.8rem 1rem; }
.search-bar input:focus { background: var(--bg-secondary); border-color: var(--accent-color); }
.search-icon { position: absolute; color: var(--text-secondary); left: 1rem; z-index: 10; }
:root[dir="rtl"] .search-icon { left: auto; right: 1rem; }

/* Desktop Tabs */
.desktop-tabs {
    display: none; /* hidden on mobile */
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.desktop-tabs::-webkit-scrollbar { display: none; }
.desktop-tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    padding: 0.5rem 1rem;
    position: relative;
    transition: color 0.3s;
    font-family: inherit;
    white-space: nowrap;
}
.desktop-tab:hover, .desktop-tab.active {
    color: var(--text-primary);
}
.desktop-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--accent-color);
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(0, 168, 232, 0.8);
}

@media (min-width: 768px) {
    .top-header .nav-container {
        max-width: 98%; /* Push to the corners on big screens */
    }
    .brand-logo {
        width: 72px;
        height: 72px;
        border-width: 3px;
        box-shadow: 0 0 20px rgba(0, 168, 232, 0.6);
    }
    .brand-text {
        font-size: 1.8rem;
    }
    .nav-container {
        flex-wrap: nowrap;
        gap: 1.5rem;
    }
    .nav-brand { order: 1; margin-left: auto; margin-right: -0.5rem; }
    :root[dir="ltr"] .nav-brand { margin-left: -0.5rem; margin-right: auto; }
    
    .desktop-tabs-wrapper {
        order: 2;
        display: flex;
        width: auto;
        margin-top: 0;
    }
    .desktop-tabs {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
    }
    .desktop-tab {
        font-size: 1rem;
        padding: 0.5rem;
    }
    
    .search-container {
        order: 3;
        width: auto;
        flex: 1;
        max-width: 400px;
        margin: 0;
    }
    
    .nav-actions { order: 4; }
}

/* Main Content Layout */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}
.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    border-right: 4px solid var(--accent-color);
    padding-right: 0.5rem;
}
:root[dir="ltr"] .section-title { border-right: none; border-left: 4px solid var(--accent-color); padding-right: 0; padding-left: 0.5rem; }

/* Banners Slider */
.banners-slider {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    margin-bottom: 1rem;
}
.banners-slider::-webkit-scrollbar { display: none; }
.banner {
    min-width: 90%;
    height: 180px;
    border-radius: 20px;
    background: var(--surface-color);
    scroll-snap-align: center;
    position: relative;
    overflow: hidden;
    display: block;
    padding: 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    text-decoration: none;
    cursor: pointer;
}
.banner-img {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
    z-index: 0;
}
.banner-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.2));
    z-index: 1;
}

@media (min-width: 768px) {
    .banners-slider {
        gap: 2rem;
    }
    .banner { 
        min-width: calc(50% - 1rem); 
        height: 250px; 
        border-radius: 28px;
    }
    .banner h2 { font-size: 2.2rem; }
    .banner p { font-size: 1.2rem; }
}
.banner i.bg-icon {
    position: absolute;
    right: -20px;
    top: -20px;
    font-size: 12rem;
    color: rgba(255,255,255,0.1);
    transform: rotate(-45deg);
    z-index: 0;
}
.banner h2 { font-size: 1.6rem; font-weight: 800; color: white; text-shadow: 0 2px 5px rgba(0,0,0,0.5); z-index: 2; position: relative;}
.banner p { color: rgba(255,255,255,0.9); font-weight: 600; z-index: 2; position: relative;}
.banner-content { z-index: 2; position: relative; }

.banner-slide {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    pointer-events: none;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
    box-sizing: border-box;
}
.banner-slide.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}
.banner-slide img {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
    z-index: -1;
}
.banner-slide .banner-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.2));
    z-index: -1;
}

/* Apps Grid */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1.25rem;
}

/* App Card (Redesigned for modern App Store look) */
.app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--bg-primary);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    padding: 1rem;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.app-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 168, 232, 0.3);
    border-color: var(--accent-color);
    background: var(--bg-secondary);
}

.card-icon {
    width: 85%;
    aspect-ratio: 1;
    border-radius: 25%;
    object-fit: cover;
    background-color: var(--bg-tertiary);
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.card-icon.fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    color: var(--accent-color);
}
.card-info {
    width: 100%;
    margin-bottom: 1rem;
}
.card-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
}
.card-category {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}
.card-install-btn {
    width: 100%;
    background: rgba(0, 168, 232, 0.15);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 0.5rem;
    border-radius: 12px;
    font-weight: 800;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.card-install-btn:hover {
    background: var(--accent-color);
    color: white;
}

/* Categories Grid (Tags) */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 1rem;
}
.category-card {
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    text-align: center;
}
.category-card i {
    font-size: 2.2rem;
    color: var(--accent-color);
    transition: transform 0.18s ease;
}
.category-card span {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-primary);
}
.category-card:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-3px);
}
.category-card:hover i {
    transform: scale(1.1);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    z-index: 900;
}
@media (min-width: 768px) {
    .bottom-nav {
        display: none; /* Hide bottom nav on desktop */
    }
    body {
        padding-bottom: 20px; /* reset body padding */
    }
}
.nav-item {
    background: none;
    border: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
    width: 25%;
}
.nav-item i {
    font-size: 1.4rem;
    transition: transform 0.15s cubic-bezier(0.2, 0, 0, 1);
}
.nav-label {
    font-size: 0.75rem;
    font-weight: 600;
}
.nav-item.active {
    color: var(--accent-color);
}
.nav-item.active i {
    transform: translateY(-3px);
}
.nav-item:hover {
    color: var(--text-primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal.active { display: flex; }
.modal-content {
    background: var(--modal-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    position: relative;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(0, 168, 232, 0.3);
    animation: modalPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalPop { 0% { transform: scale(0.95) translateY(12px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }

.close-modal {
    position: absolute;
    top: 1.25rem; right: 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px; height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
}
:root[dir="rtl"] .close-modal { right: auto; left: 1.25rem; }

.modal-header { display: flex; gap: 1.5rem; margin-bottom: 2rem; }
.modal-app-icon {
    width: 100px; height: 100px;
    border-radius: 25%;
    object-fit: cover;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
}
.modal-title-group { display: flex; flex-direction: column; justify-content: center; }
.modal-title-group h2 { font-size: 1.6rem; color: var(--text-primary); }
.app-category { color: var(--accent-color); font-weight: 800; }
.app-size { color: var(--text-secondary); font-size: 0.9rem; }

.modal-actions { margin-bottom: 2rem; border-bottom: 1px solid var(--border-color); padding-bottom: 2rem; }
.download-btn {
    display: flex; align-items: center; justify-content: center; gap: 0.75rem;
    background: linear-gradient(135deg, #00a8e8, #035b8f);
    color: white; padding: 1rem; border-radius: 20px;
    text-decoration: none; font-weight: 800; font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 168, 232, 0.3);
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.home-actions-container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1rem; /* Reduced gap to fit 3 buttons */
    margin-bottom: 1rem;
    width: 100%;
}
.action-btn {
    flex: 1;
    font-size: 0.95rem;
    padding: 0.8rem 0.5rem;
    text-align: center;
    font-family: 'Cairo', 'Inter', sans-serif !important;
}

.modal-body h3 { margin-bottom: 1rem; font-size: 1.2rem; color: var(--text-primary); }
.app-description { color: var(--text-secondary); line-height: 1.8; white-space: pre-wrap; font-size: 1rem; }

@media (max-width: 480px) {
    .apps-grid { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 1rem; }
    .card-title { font-size: 0.95rem; }
    .modal-header { flex-direction: column; align-items: center; text-align: center; }
    .nav-label { font-size: 0.65rem; }
    
    .action-btn {
        font-size: 0.7rem !important; /* Smaller font on mobile */
        padding: 0.5rem 0.2rem !important;
        gap: 0.2rem;
    }
    .action-btn i { font-size: 0.75rem !important; }
    
    /* Pull logo strictly to the corner in small screens */
    .top-header { padding: 0.5rem 0.2rem; }
    .nav-brand { margin-right:-6.5rem ; margin-left: 0; }
    :root[dir="ltr"] .nav-brand { margin-left: -0.5rem; margin-right: 0; }
}

/* Floating Background Animations */
.floating-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.floating-icon {
    position: absolute;
    bottom: -50px;
    color: var(--text-primary);
    animation: floatUp linear infinite;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg) scale(0.8);
        opacity: 0;
    }
    10% {
        opacity: var(--float-opacity, 0.15);
    }
    90% {
        opacity: var(--float-opacity, 0.15);
    }
    100% {
        transform: translateY(-110vh) translateX(100px) rotate(360deg) scale(1.2);
        opacity: 0;
    }
}


/* Filters & Search */
.filter-toggle {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 10;
}
:root[dir="rtl"] .filter-toggle { right: auto; left: 1rem; }
.filter-toggle:hover, .filter-toggle.active { color: var(--accent-color); }

.search-bar input { 
    padding: 0.8rem 2.8rem 0.8rem 4.8rem !important; 
}
:root[dir="ltr"] .search-bar input { 
    padding: 0.8rem 4.8rem 0.8rem 2.8rem !important; 
}

.search-clear-btn {
    position: absolute;
    left: 2.8rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}
:root[dir="ltr"] .search-clear-btn { left: auto; right: 2.8rem; }
.search-clear-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: var(--text-primary);
    transform: scale(1.1);
}
:root[data-theme="light"] .search-clear-btn {
    background: rgba(0, 0, 0, 0.08);
}
:root[data-theme="light"] .search-clear-btn:hover {
    background: rgba(0, 0, 0, 0.15);
}

.search-container { position: relative; }
.filter-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgb(2 71 115 / 94%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    animation: slideDown 0.2s ease-out;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.filter-group { flex: 1; min-width: 140px; }
.filter-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}
.filter-group select {
    width: 100%;
    padding: 0.6rem;
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}
.filter-group select:focus { border-color: var(--accent-color); }

/* PWA Install Floating Button */
.pwa-floating-btn {
    position: fixed;
    bottom: 80px; /* Above bottom nav */
    right: 20px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.8rem 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 168, 232, 0.4);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1000;
    transition: all 0.3s ease;
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
:root[dir="rtl"] .pwa-floating-btn { right: auto; left: 20px; }
.pwa-floating-btn:hover {
    transform: scale(1.05);
    background: #0186b8;
}
@media (min-width: 768px) {
    .pwa-floating-btn { bottom: 30px; }
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* View Utilities */
.page-header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header-wrapper .section-title {
    margin-bottom: 0;
}
.view-utilities {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 168, 232, 0.1);
    padding: 0.4rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}
.util-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    min-width: 48px;
    height: 40px;
    padding: 0 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-family: inherit;
    font-weight: 600;
}
.util-text {
    font-size: 0.9rem;
    white-space: nowrap;
}
@media (max-width: 480px) {
    .util-text { font-size: 0.8rem; }
    .util-btn { padding: 0 0.5rem; gap: 0.3rem; height: 36px; min-width: 40px; }
}
.util-btn:hover, .util-btn.active {
    background: var(--accent-color);
    color: white;
}
.slider-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
    color: var(--text-secondary);
}
.slider-container input[type=range] {
    width: 80px;
    accent-color: var(--accent-color);
}
@media (max-width: 480px) {
    .slider-container input[type=range] { width: 50px; }
}

/* Grid Views */
.apps-grid.view-list {
    display: flex;
    flex-direction: column;
}
.apps-grid.view-list .app-card {
    flex-direction: row;
    align-items: center;
    text-align: right;
    padding: 0.8rem;
    gap: 1rem;
}
:root[dir="ltr"] .apps-grid.view-list .app-card {
    text-align: left;
}
.apps-grid.view-list .card-icon {
    width: 60px;
    margin-bottom: 0;
}
.apps-grid.view-list .card-info {
    margin-bottom: 0;
    flex: 1;
}
.apps-grid.view-list .card-install-btn {
    width: auto;
    padding: 0.5rem 1rem;
}

.apps-grid.view-single {
    grid-template-columns: 1fr;
}
.apps-grid.view-single .app-card {
    padding: 2rem;
}
.apps-grid.view-single .card-icon {
    width: 120px;
}

/* Group Headers */
.group-header {
    grid-column: 1 / -1;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

/* Form Styles for Request Modal */
.form-group {
    margin-bottom: 1.2rem;
    text-align: right;
}
[dir="ltr"] .form-group {
    text-align: left;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}
.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}
[data-theme="light"] .form-group input[type="text"],
[data-theme="light"] .form-group input[type="url"],
[data-theme="light"] .form-group textarea {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(2, 71, 115, 0.3);
}
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    background: rgba(255,255,255,0.05);
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin: 0;
    transition: background 0.2s, transform 0.1s;
    user-select: none;
}
[data-theme="light"] .checkbox-group label {
    background: rgba(0,0,0,0.05);
}
.checkbox-group label:hover {
    background: rgba(255,255,255,0.1);
}
[data-theme="light"] .checkbox-group label:hover {
    background: rgba(0,0,0,0.1);
}
.checkbox-group label:active {
    transform: scale(0.98);
}
.checkbox-group input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ========================================================
   FAVORITES, CHIPS, BADGES, MODAL ENHANCEMENTS & TOASTS
   ======================================================== */

/* Header Favorites Button & Live Counter Badge */
.favorites-btn {
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.favorites-btn i {
    transition: color 0.2s, transform 0.2s;
}
.favorites-btn:hover i {
    color: #ff3366;
    transform: scale(1.15);
}
.favorites-btn.has-favs i {
    color: #ff3366;
}
.fav-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #ff2a6d, #ff6b8b);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    min-width: 19px;
    height: 19px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--modal-bg);
    box-shadow: 0 2px 8px rgba(255, 42, 109, 0.5);
    pointer-events: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s;
}
:root[dir="rtl"] .fav-badge {
    right: auto;
    left: -4px;
}
.fav-badge.pop {
    animation: badgePop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes badgePop {
    0% { transform: scale(0.6); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* Category Chips Bar */
.chips-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0.25rem auto 0;
    padding: 0 0.5rem;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-sizing: border-box;
}
.category-chips-bar {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.35rem 0.25rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
}
.category-chips-bar::-webkit-scrollbar {
    display: none;
}
.category-chips-bar.is-dragging {
    cursor: grabbing;
    user-select: none;
    scroll-behavior: auto;
}

/* Wide screen only scroll arrow buttons */
.chips-scroll-btn {
    display: none; /* Hidden on mobile and small screens */
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3;
    padding: 0;
}

@media (min-width: 768px) {
    .chips-scroll-btn {
        display: inline-flex;
    }
}

.chips-scroll-btn:hover {
    background: rgba(0, 168, 232, 0.25);
    color: var(--accent-color);
    border-color: var(--accent-color);
    transform: scale(1.12);
    box-shadow: 0 0 12px rgba(0, 168, 232, 0.4);
}

.chips-scroll-btn:active {
    transform: scale(0.92);
}

/* Maintain physical placement in both RTL and LTR */
.chips-btn-left {
    order: 1;
}
.category-chips-bar {
    order: 2;
}
.chips-btn-right {
    order: 3;
}

[dir="rtl"] .chips-btn-right,
html[lang="ar"] .chips-btn-right {
    order: 1;
}
[dir="rtl"] .chips-btn-left,
html[lang="ar"] .chips-btn-left {
    order: 3;
}
.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.35rem 0.85rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    user-select: none;
    flex-shrink: 0;
}
.cat-chip i {
    font-size: 0.85rem;
    color: var(--accent-color);
    transition: transform 0.2s;
}
.cat-chip:hover {
    background: rgba(0, 168, 232, 0.15);
    color: var(--text-primary);
    border-color: var(--accent-color);
    transform: translateY(-1px);
}
.cat-chip:hover i {
    transform: scale(1.15);
}
.cat-chip.active {
    background: linear-gradient(135deg, rgba(0, 168, 232, 0.35), rgba(3, 91, 143, 0.5));
    color: #ffffff;
    border-color: var(--accent-color);
    box-shadow: 0 0 14px rgba(0, 168, 232, 0.4);
}
.cat-chip.active i {
    color: #ffffff;
}
:root[data-theme="light"] .cat-chip {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
}
:root[data-theme="light"] .cat-chip:hover {
    background: rgba(0, 168, 232, 0.12);
    color: var(--text-primary);
}
:root[data-theme="light"] .cat-chip.active {
    background: linear-gradient(135deg, #024773, #00a8e8);
    color: #ffffff;
    border-color: transparent;
}

/* App Card Quick Save (❤️) */
.app-card {
    position: relative;
}
.card-fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s, color 0.2s;
}
:root[dir="rtl"] .card-fav-btn {
    right: auto;
    left: 8px;
}
.card-fav-btn:hover {
    transform: scale(1.15);
    color: #ff3366;
    background: rgba(255, 51, 102, 0.15);
}
.card-fav-btn.active {
    color: #ff3366;
    background: rgba(255, 51, 102, 0.2);
    border-color: rgba(255, 51, 102, 0.5);
    box-shadow: 0 0 10px rgba(255, 51, 102, 0.4);
}
.card-fav-btn.pop {
    animation: heartPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes heartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}
:root[data-theme="light"] .card-fav-btn {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.08);
    color: #78909c;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
:root[data-theme="light"] .card-fav-btn:hover,
:root[data-theme="light"] .card-fav-btn.active {
    color: #ff3366;
    background: #fff0f3;
}

/* App Details Modal Enhancements */
.modal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.4rem 0 0.5rem;
}
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.65rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid transparent;
}
.badge-size {
    background: rgba(157, 187, 212, 0.12);
    color: var(--text-secondary);
    border-color: rgba(157, 187, 212, 0.25);
}
.badge-direct {
    background: rgba(0, 230, 118, 0.12);
    color: #00e676;
    border-color: rgba(0, 230, 118, 0.3);
}
.badge-telegram {
    background: rgba(0, 168, 232, 0.15);
    color: #00a8e8;
    border-color: rgba(0, 168, 232, 0.35);
}
.badge-type {
    background: rgba(171, 71, 188, 0.15);
    color: #ce93d8;
    border-color: rgba(171, 71, 188, 0.35);
}
.badge-version {
    background: rgba(255, 179, 0, 0.12);
    color: #ffb300;
    border-color: rgba(255, 179, 0, 0.3);
}
:root[data-theme="light"] .badge-direct {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #a5d6a7;
}
:root[data-theme="light"] .badge-telegram {
    background: #e1f5fe;
    color: #0277bd;
    border-color: #81d4fa;
}
:root[data-theme="light"] .badge-type {
    background: #f3e5f5;
    color: #7b1fa2;
    border-color: #ce93d8;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}
.modal-download-group {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}
.modal-tools-group {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}
.modal-tool-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}
.modal-tool-btn:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.12);
}
.fav-tool-btn:hover, .fav-tool-btn.active {
    background: rgba(255, 51, 102, 0.15);
    color: #ff3366;
    border-color: rgba(255, 51, 102, 0.4);
}
.fav-tool-btn.active i {
    color: #ff3366;
}
.share-tool-btn:hover {
    background: rgba(0, 168, 232, 0.15);
    color: var(--accent-color);
    border-color: var(--accent-color);
}
:root[data-theme="light"] .modal-tool-btn {
    background: rgba(0, 0, 0, 0.04);
}
:root[data-theme="light"] .modal-tool-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* Favorites Modal */
.favorites-modal-content {
    max-width: 650px;
    padding: 1.75rem;
    box-sizing: border-box;
}
.fav-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
    position: relative;
}
.fav-header-start {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}
.fav-icon-circle {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 50%;
    background: rgba(255, 51, 102, 0.15);
    border: 1px solid rgba(255, 51, 102, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff3366;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(255, 51, 102, 0.25);
}
.fav-header-info {
    display: flex;
    flex-direction: column;
}
.fav-header-info h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}
.fav-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0.25rem 0 0 0;
    font-weight: 600;
}
.fav-header-actions {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    flex-shrink: 0;
}
.clear-favs-btn,
.clear-all-favs-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.95rem;
    border-radius: 12px;
    background: rgba(255, 51, 102, 0.12);
    border: 1px solid rgba(255, 51, 102, 0.35);
    color: #ff4b72;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    white-space: nowrap;
}
.clear-favs-btn:hover,
.clear-all-favs-btn:hover {
    background: #ff3366;
    color: #ffffff;
    border-color: #ff3366;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 51, 102, 0.35);
}
.clear-favs-btn:active,
.clear-all-favs-btn:active {
    transform: scale(0.96);
}
.clear-favs-btn.confirming,
.clear-all-favs-btn.confirming {
    background: #ff1744 !important;
    border-color: #ff1744 !important;
    color: #ffffff !important;
    box-shadow: 0 0 16px rgba(255, 23, 68, 0.6) !important;
    animation: pulseWarn 0.8s infinite alternate !important;
}
@keyframes pulseWarn {
    0% { transform: scale(1); box-shadow: 0 0 8px rgba(255, 23, 68, 0.4); }
    100% { transform: scale(1.05); box-shadow: 0 0 20px rgba(255, 23, 68, 0.8); }
}
#favorites-modal .close-modal,
#favorites-modal .fav-close-btn,
.fav-close-btn {
    position: static !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    margin: 0;
    flex-shrink: 0;
}
#favorites-modal .close-modal:hover,
#favorites-modal .fav-close-btn:hover,
.fav-close-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: var(--text-primary);
    border-color: var(--accent-color);
    transform: rotate(90deg) scale(1.08);
    box-shadow: 0 0 12px rgba(0, 168, 232, 0.35);
}
#favorites-modal .close-modal:active,
#favorites-modal .fav-close-btn:active,
.fav-close-btn:active {
    transform: scale(0.92);
}

.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 0.25rem;
}
.fav-item-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0.75rem 1rem;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}
.fav-item-card:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 168, 232, 0.2);
}
.fav-item-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    object-fit: cover;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}
.fav-item-info {
    flex: 1;
    min-width: 0;
}
.fav-item-title {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fav-item-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3px;
    flex-wrap: wrap;
}
.fav-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.fav-del-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 51, 102, 0.3);
    color: #ff6b8b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}
.fav-del-btn:hover {
    background: #ff3366;
    color: #ffffff;
    transform: scale(1.1);
}
.fav-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}
.fav-empty-icon {
    font-size: 3.8rem;
    color: rgba(255, 51, 102, 0.35);
    margin-bottom: 1rem;
    animation: pulseGlow 2.5s infinite alternate;
}
.fav-empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}
.fav-empty-state p {
    font-size: 0.95rem;
    max-width: 350px;
    margin: 0 auto;
    line-height: 1.6;
}
.fav-empty-btn {
    margin-top: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border-radius: 14px;
    background: linear-gradient(135deg, #00a8e8, #035b8f);
    color: #fff;
    border: none;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.fav-empty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 168, 232, 0.4);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    width: 90%;
    max-width: 380px;
}
.toast-message {
    background: rgba(1, 20, 38, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--accent-color);
    border-radius: 14px;
    padding: 0.85rem 1.25rem;
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.3s ease 2.7s forwards;
}
.toast-message i {
    font-size: 1.15rem;
    color: var(--accent-color);
}
.toast-message.toast-success {
    border-color: #00e676;
}
.toast-message.toast-success i {
    color: #00e676;
}
.toast-message.toast-fav {
    border-color: #ff3366;
}
.toast-message.toast-fav i {
    color: #ff3366;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    to { opacity: 0; transform: translateY(-15px) scale(0.9); }
}
:root[data-theme="light"] .toast-message {
    background: rgba(255, 255, 255, 0.95);
    color: #012b48;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* ==========================================
   APP SCREENSHOTS GALLERY & LIGHTBOX
   ========================================== */
.modal-gallery-container {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
:root[data-theme="light"] .modal-gallery-container {
    background: rgba(0, 0, 0, 0.02);
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.02);
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    padding: 0 0.25rem;
}
.gallery-header-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.gallery-header-title i {
    color: var(--accent-color);
}
.gallery-count-badge {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    background: rgba(0, 168, 232, 0.12);
    color: var(--accent-color);
    border: 1px solid rgba(0, 168, 232, 0.25);
}

.modal-gallery-track {
    display: flex;
    gap: 0.85rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 0.25rem 0.25rem 0.75rem 0.25rem;
    -webkit-overflow-scrolling: touch;
}
.modal-gallery-track::-webkit-scrollbar {
    height: 6px;
}
.modal-gallery-track::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 10px;
}
:root[data-theme="light"] .modal-gallery-track::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
}
.modal-gallery-track::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
.modal-gallery-track::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

.gallery-item {
    flex: 0 0 auto;
    scroll-snap-align: start;
    height: 220px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    cursor: zoom-in;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gallery-item:hover, .gallery-item:focus-visible {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 168, 232, 0.25);
    border-color: var(--accent-color);
    outline: none;
}
.gallery-img {
    height: 100%;
    width: auto;
    max-width: 340px;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    transition: opacity 0.2s ease;
}

/* Lightbox Modal */
.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 5, 12, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.gallery-lightbox.active {
    display: flex;
    opacity: 1;
}
.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 84vh;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}
.lightbox-img {
    max-width: 88vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: lightboxZoomIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes lightboxZoomIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 100001;
}
:root[dir="rtl"] .lightbox-close { left: 1.5rem; right: auto; }
:root[dir="ltr"] .lightbox-close { right: 1.5rem; left: auto; }

.lightbox-close:hover {
    background: rgba(239, 68, 68, 0.85);
    transform: scale(1.1);
}

.lightbox-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 100001;
}
.lightbox-nav-btn:hover {
    background: var(--accent-color);
    transform: translateY(-50%) scale(1.1);
}
:root[dir="rtl"] .lightbox-prev { right: 1.5rem; left: auto; }
:root[dir="rtl"] .lightbox-next { left: 1.5rem; right: auto; }
:root[dir="ltr"] .lightbox-prev { left: 1.5rem; right: auto; }
:root[dir="ltr"] .lightbox-next { right: 1.5rem; left: auto; }

.lightbox-counter {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.35rem 1.1rem;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    z-index: 100001;
}

@media (max-width: 600px) {
    .gallery-item {
        height: 180px;
    }
    .gallery-img {
        max-width: 260px;
    }
    .lightbox-nav-btn {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    :root[dir="rtl"] .lightbox-prev { right: 0.5rem; }
    :root[dir="rtl"] .lightbox-next { left: 0.5rem; }
    :root[dir="ltr"] .lightbox-prev { left: 0.5rem; }
    :root[dir="ltr"] .lightbox-next { right: 0.5rem; }
    .lightbox-close {
        top: 1rem;
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
    :root[dir="rtl"] .lightbox-close { left: 1rem; }
    :root[dir="ltr"] .lightbox-close { right: 1rem; }
}
