/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=auto');
/* Changed display=swap to display=auto to potentially reduce load flutter, though swap is usually better for perceived performance. 
   The main loading issue is likely image placeholders. */

:root {
    --primary-gradient: linear-gradient(135deg, #00C6FF 0%, #0072FF 100%);
    --secondary-gradient: linear-gradient(135deg, #FF00E6 0%, #FF4D4D 100%);
    --bg-dark: #0a0b1e;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: #a0a0b0;
    --accent-color: #0072FF;
    --success-color: #00ff6a;
    --error-color: #ff4d4d;
    --nav-height: 80px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(0, 198, 255, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(255, 0, 230, 0.15) 0%, transparent 20%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    /* Removed overflow-y: hidden on body if we want desktop scroll to feel natural or 
       keep it if we strictly simulate mobile. 
       User said: "top and bottom nav bars are not correctly locked... when i try to scrool down and up then it is fixed"
       To fix this, we need 'app-container' to be the scroll context but Top Bar to be Sticky 
       and Bottom Nav to be Absolute or Fixed inside it. 
    */
    overflow: hidden;
    /* Prevent body scroll */
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

button,
input {
    border: none;
    outline: none;
}

/* Mobile Container */
.app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background: rgba(20, 20, 35, 0.95);
    /* Increased opacity slightly */
    position: relative;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    overflow-y: scroll;
    /* Force vertical scrollbar behavior context */
    overflow-x: hidden;
    scrollbar-width: none;
    display: flex;
    flex-direction: column;
}

.app-container::-webkit-scrollbar {
    display: none;
}

main {
    flex: 1;
    position: relative;
    z-index: 10;
}

/* Sticky Header */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(10, 11, 30, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 15px 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    /* Ensure it works in flex container */
    flex-shrink: 0;
}

.top-bar.scrolled {
    background: rgba(10, 11, 30, 0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.logo-area {
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(to right, #00C6FF, #0072FF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.logo-badge {
    background: var(--secondary-gradient);
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    margin-left: 8px;
    box-shadow: 0 2px 8px rgba(255, 0, 230, 0.4);
}

.pro-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    font-weight: 700;
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 4px;
}

.back-btn {
    font-size: 24px;
    margin-right: 10px;
    color: var(--text-main);
    cursor: pointer;
}

.member-badge {
    background: rgba(0, 198, 255, 0.15);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    color: #00C6FF;
    font-weight: 700;
    border: 1px solid rgba(0, 198, 255, 0.3);
}

/* Titles & Sections */
.section-title {
    font-size: 14px;
    font-weight: 600;
    padding: 20px 20px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* App Lists */
.app-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Reduced bottom padding to prevent giant empty space */
    padding: 10px 20px 100px;
}

.app-card {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px;
    border-radius: 20px;
    transition: transform 0.2s, background 0.2s;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    /* Prevention against flex crush */
}

.app-card:active {
    transform: scale(0.98);
}

.app-icon {
    width: 55px;
    height: 55px;
    border-radius: 14px;
    margin-right: 15px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background: #222;
}

.app-info {
    flex: 1;
    min-width: 0;
}

.app-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-category {
    font-size: 10px;
    color: var(--accent-color);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 2px;
}

.app-dev {
    font-size: 12px;
    color: var(--text-muted);
}

.action-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

/* Detail Pages and Modal */
.detail-header {
    text-align: center;
    padding: 30px 20px;
    background: radial-gradient(circle at center, rgba(0, 198, 255, 0.08) 0%, transparent 70%);
}

.detail-icon {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: float 6s ease-in-out infinite;
    object-fit: cover;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.detail-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.detail-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.detail-desc {
    font-size: 14px;
    line-height: 1.6;
    color: #d1d5db;
    background: rgba(25, 25, 40, 0.6);
    backdrop-filter: blur(10px);
    padding: 24px;
    border-radius: 24px;
    margin: 0 20px 20px;
    border: 1px solid var(--glass-border);
}

/* Buttons */
.primary-btn {
    display: block;
    width: calc(100% - 40px);
    margin: 12px 20px;
    padding: 16px;
    background: var(--primary-gradient);
    color: white;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 114, 255, 0.3);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: transform 0.1s;
}

.primary-btn:active {
    transform: scale(0.98);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: none;
    color: white;
}

/* VIP Modal Styles */
.vip-modal {
    display: none;
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.vip-modal-content {
    background: #0a0b1e;
    border: 1px solid var(--glass-border);
    margin: 20px;
    padding: 30px 20px;
    border-radius: 24px;
    width: 90%;
    max-width: 400px;
    position: relative;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 198, 255, 0.2);
    animation: popUp 0.3s ease-out;
}

@keyframes popUp {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.vip-icon-wrapper {
    width: 70px;
    height: 70px;
    background: var(--secondary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    margin: 0 auto 20px;
    box-shadow: 0 5px 20px rgba(255, 0, 230, 0.5);
}

.vip-modal-content h2 {
    margin-bottom: 10px;
    font-size: 22px;
}

.vip-modal-content p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}


/* Search */
.search-container {
    padding: 20px;
    position: relative;
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.4);
    color: white;
    font-size: 15px;
}

.search-input:focus {
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.6);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 20px;
    pointer-events: none;
}

/* Settings / Upgrade */
.donation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.donation-btn {
    background: linear-gradient(135deg, #FF00E6, #FF4D4D);
    padding: 15px;
    border-radius: 14px;
    color: white;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 0, 230, 0.3);
    transition: transform 0.2s;
    text-align: center;
}

.donation-btn:active {
    transform: scale(0.95);
}

.code-input {
    width: 100%;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 10px;
}

.code-input:focus {
    border-color: var(--accent-color);
}

.support-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 16px;
    margin-top: 10px;
    border: 1px solid transparent;
}

.support-item:active {
    background: rgba(255, 255, 255, 0.08);
}

.support-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 20px;
}

/* Navigation Fixed - Use Absolute to stick to bottom of container or fixed to viewport 
   Since we use transform/backdrop on container, fixed might be relative to container in some browsers.
   For consistency on desktop, we want it stuck to the bottom of the phone frame.
*/
.nav-bar {
    position: fixed;
    /* Fixed to viewport to stay visible */
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 440px;
    background: rgba(15, 15, 30, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 30px;
    border-radius: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

/* Ensure Nav Items are clickable */
.nav-item {
    color: var(--text-muted);
    font-size: 24px;
    position: relative;
    transition: all 0.3s;
    cursor: pointer;
}

.nav-item.active {
    color: #fff;
    transform: translateY(-2px);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    background: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-color);
}

/* Filters */
.filter-chips {
    display: flex;
    gap: 10px;
    padding: 10px 20px;
    overflow-x: auto;
    scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.chip {
    padding: 6px 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-muted);
    transition: all 0.2s;
}

.chip.active,
.chip:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.filter-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(0, 0, 0, 0.2);
}

.filter-menu.active {
    max-height: 80px;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.hidden {
    display: none;
}