/* Premium Modern CSS Design System */
:root {
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    /* Elegant Dark Violet Color Palette */
    --bg-main: #09070f;
    --bg-surface: rgba(20, 16, 33, 0.6);
    --bg-surface-hover: rgba(30, 24, 48, 0.85);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-color-hover: rgba(168, 85, 247, 0.4);
    
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Vibrant Accent Gradients */
    --gradient-primary: linear-gradient(135deg, #a855f7 0%, #3b82f6 100%);
    --gradient-accent: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

/* Ambient Glow Gradients */
.glow-bg-1 {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.15) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
}

.glow-bg-2 {
    position: absolute;
    top: 30%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 85, 247, 0.4);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(9, 7, 15, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.btn-admin {
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.btn-admin:hover {
    background: var(--gradient-primary);
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

/* Hero Section */
.hero {
    padding: 8rem 1.5rem 4rem 1.5rem;
    text-align: center;
    position: relative;
}

.hero-container {
    max-width: 800px;
    margin: 0 auto;
}

.badge-radar {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #c084fc;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #a855f7;
    border-radius: 50%;
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(168, 85, 247, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 6vw, 3.8rem);
    font-weight: 900;
    line-height: 1.15;
    margin-bottom: 1.2rem;
    letter-spacing: -1px;
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.15rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2.5rem auto;
    font-weight: 400;
}

/* Search Bar */
.search-wrapper {
    max-width: 600px;
    margin: 0 auto 2.5rem auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: rgba(168, 85, 247, 0.6);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.15);
    background: rgba(255, 255, 255, 0.06);
}

.search-icon {
    font-size: 1.2rem;
    margin-left: 0.8rem;
    color: var(--text-secondary);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    padding: 0.6rem 0.8rem;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.btn-search {
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.7rem 1.6rem;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-search:hover {
    filter: brightness(1.1);
    transform: scale(1.02);
}

/* Quick Stats */
.quick-stats {
    display: flex;
    justify-content: center;
}

.stat-badge {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.stat-val {
    font-family: var(--font-heading);
    font-weight: 800;
    color: #a855f7;
    font-size: 1.1rem;
}

.stat-lbl {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Main Container Layout */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 6rem 1.5rem;
}

/* Segmented Control / Filters */
.controls-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.segmented-control {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.3rem;
    border-radius: 12px;
    display: flex;
    gap: 0.2rem;
}

.segment-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.segment-btn:hover {
    color: var(--text-primary);
}

.segment-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Horizontal Categories Bar */
.categories-wrapper {
    margin-bottom: 2.5rem;
    position: relative;
}

.categories-scroll {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.categories-scroll::-webkit-scrollbar {
    display: none; /* Hide scrollbar for clean UI */
}

.cat-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(20, 16, 33, 0.45);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.cat-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
}

.cat-btn.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.25);
}

/* Section Header */
.section-header {
    margin-bottom: 1.5rem;
}

.section-heading {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 0;
    color: var(--text-secondary);
    font-weight: 500;
}

.modern-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(168, 85, 247, 0.1);
    border-top-color: #a855f7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* App Card styling */
.app-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(168,85,247,0.05) 0%, transparent 100%);
    opacity: 0;
    transition: var(--transition);
}

.app-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-color-hover);
    background: var(--bg-surface-hover);
    box-shadow: var(--shadow-premium);
}

.app-card:hover::before {
    opacity: 1;
}

.app-icon-wrapper {
    position: relative;
    flex-shrink: 0;
}

.app-icon {
    width: 76px;
    height: 76px;
    border-radius: 18px;
    object-fit: cover;
    display: block;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.app-info {
    flex: 1;
    min-width: 0; /* Ensures text truncates properly in flex */
}

.app-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.app-card-tag {
    font-size: 0.72rem;
    font-weight: 700;
    color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 50px;
    text-transform: uppercase;
}

.app-card-date {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.app-card-name {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-card-developer {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modal Overlay Styling */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-backdrop {
    position: absolute;
    width: 100%; height: 100%;
    background: rgba(9, 7, 15, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.modal-wrapper {
    position: relative;
    width: 90%;
    max-width: 600px;
    z-index: 2001;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.show .modal-wrapper {
    transform: scale(1) translateY(0);
}

.modal-content {
    background: rgba(20, 16, 33, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    max-height: 85vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: rotate(90deg);
}

/* Modal Inner Content Details */
.modal-detail-header {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: center;
}

.modal-detail-icon {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    object-fit: cover;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

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

.modal-detail-name {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.3rem;
}

.modal-detail-dev {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.modal-detail-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    background: var(--gradient-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    text-transform: uppercase;
}

.modal-detail-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-row-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 16px;
}

.detail-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.meta-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.meta-value {
    font-size: 0.95rem;
    font-weight: 600;
}

.detail-desc-box h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
}

.detail-desc-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.btn-store {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--gradient-accent);
    color: white;
    text-decoration: none;
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 1rem;
    border-radius: 14px;
    text-align: center;
    transition: var(--transition);
}

.btn-store:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

/* Footer Styling */
.footer {
    text-align: center;
    padding: 3rem 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Responsive Rules */
@media (max-width: 768px) {
    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    .app-card {
        padding: 1rem;
        border-radius: 16px;
    }
    .app-icon {
        width: 64px;
        height: 64px;
        border-radius: 14px;
    }
    .modal-content {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .apps-grid {
        grid-template-columns: 1fr; /* 1 card per row on extra small screens */
    }
    .hero {
        padding-top: 6rem;
    }
    .modal-wrapper {
        width: 95%;
    }
    .modal-detail-header {
        flex-direction: column;
        text-align: center;
    }
}
