:root {
    --primary-saffron: #FF9933;
    --primary-green: #138808;
    --primary-blue: #000080;
    --bg-light: #F4F7F6;
    --text-dark: #333;
    --card-bg: white;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(255, 255, 255, 0.6);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    --bg-light: #1a202c;
    --text-dark: #f7fafc;
    --card-bg: #2d3748;
    --glass-bg: rgba(26, 32, 44, 0.9);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.btn-primary {
    background: linear-gradient(135deg, #FF9933 0%, #FF7700 100%);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 153, 51, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 153, 51, 0.35);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
    border: 1px solid #cbd5e0;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-danger {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-success {
    background: #48bb78;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-success:hover {
    background: #38a169;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.desktop-nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.desktop-nav a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: color 0.3s ease;
}

.desktop-nav a:hover {
    color: var(--primary-saffron);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-dark);
}

/* Sidebar Styling */
.sidebar {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: var(--card-bg);
    z-index: 2000;
    transition: right 0.3s ease;
    padding: 2rem;
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    right: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: color 0.2s;
}

.sidebar-links a:hover {
    color: var(--primary-saffron);
}

.user-info-mini {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
}

.sidebar-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-avatar-placeholder {
    width: 48px;
    height: 48px;
    background: var(--primary-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }

    .desktop-nav {
        display: none !important;
        /* Hide standard nav on mobile */
    }

    .mobile-menu-btn {
        display: block;
        /* Show hamburger on mobile */
    }
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 5rem 1.5rem;
    background: radial-gradient(circle at 50% 50%, rgba(255, 153, 51, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    /* Responsive font size */
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.2;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #FF9933 0%, #000080 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.search-bar {
    max-width: 600px;
    margin: 2.5rem auto;
    display: flex;
    gap: 0.5rem;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.search-bar input {
    flex: 1;
    border: none;
    padding: 0 1rem;
    box-shadow: none;
    font-size: 1.1rem;
    background: transparent;
    color: var(--text-dark);
}

/* App Cards */
.app-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: 100%;
}

.app-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    border-color: rgba(255, 153, 51, 0.3);
}

.home-app-card {
    align-items: flex-start;
    /* Align left for cleaner look logic */
    text-align: left;
    height: auto;
}

.home-app-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
}

.app-meta {
    font-size: 0.85rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
}

/* Star Rating Widget */
.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 0.25rem;
}

.star-rating input {
    display: none;
}

.star-rating label {
    cursor: pointer;
    font-size: 1.5rem;
    color: #ddd;
    transition: color 0.2s;
}

.star-rating label:hover,
.star-rating label:hover~label,
.star-rating input:checked~label {
    color: #FFB400;
}

/* Review Section */
.review-card {
    padding: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.review-card:hover {
    background: #fafafa;
}

/* Navigation Links */
.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    margin-left: 1.5rem;
    font-weight: 600;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary-saffron);
}

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

.logo img {
    height: 50px;
    width: auto;
}

.search-bar button {
    border-radius: 50px;
    padding-left: 2rem;
    padding-right: 2rem;
    background: transparent;
    color: var(--primary-blue);
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
}

/* Section & Grid Restorations */
.section-title {
    margin: 3rem 5% 1.5rem;
    font-size: 1.5rem;
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, #ddd, transparent);
    margin-left: 1rem;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
    padding: 0 5% 3rem;
}

.home-app-card h3 {
    font-size: 1.1rem;
    margin: 0;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
}

/* App Details Common */
.app-header {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.app-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    object-fit: cover;
    background: #f0f0f0;
}

.app-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.app-category {
    font-size: 0.85rem;
    color: #444;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.app-desc {
    font-size: 0.95rem;
    color: #555;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 0.5rem;
}

.app-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.rating {
    color: #FFB400;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* App Detail Page */
.app-detail-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 3rem;
}

.detail-header {
    display: flex;
    gap: 2.5rem;
    margin-bottom: 3rem;
    align-items: flex-start;
}

.detail-icon {
    width: 140px;
    height: 140px;
    border-radius: 28px;
    object-fit: cover;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.screenshots {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1.5rem 0.5rem;
    margin-bottom: 2rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.screenshots::-webkit-scrollbar {
    height: 6px;
}

.screenshots::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.screenshot {
    height: 400px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.screenshot:hover {
    transform: scale(1.02);
}

/* Forms & Auth */
.auth-container {
    max-width: 450px;
    margin: 4rem auto;
    padding: 2.5rem;
}

.split-auth-container {
    display: flex;
    max-width: 900px;
    margin: 4rem auto;
    border-radius: 20px;
    overflow: hidden;
    min-height: 500px;
}

.auth-poster {
    flex: 1;
    background: #000;
    position: relative;
    display: none;
    /* Hidden on mobile by default */
}

.auth-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
}

.auth-form-side {
    flex: 1;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--card-bg);
}

@media (min-width: 769px) {
    .auth-poster {
        display: block;
    }
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #444;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.9rem;
    border: 1px solid #ddd;
    border-radius: 10px;
    outline: none;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.8);
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--primary-saffron);
    background: white;
}

/* Categories */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.category-card {
    text-decoration: none;
    color: var(--text-dark);
    background: var(--card-bg);
    padding: 2rem 1rem;
    border-radius: 24px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
    border-color: rgba(255, 153, 51, 0.3);
}

.category-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    transition: transform 0.3s ease;
}

.category-card:hover .category-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Category Specific Colors */
.cat-productivity {
    background: #e0f2fe;
    color: #0284c7;
}

.cat-social {
    background: #fce7f3;
    color: #db2777;
}

.cat-finance {
    background: #dcfce7;
    color: #16a34a;
}

.cat-education {
    background: #fff7ed;
    color: #ea580c;
}

.cat-entertainment {
    background: #fae8ff;
    color: #9333ea;
}

.cat-health {
    background: #fee2e2;
    color: #dc2626;
}

/* Dashboard */
.dashboard-container {
    padding: 2rem 5%;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-blue);
    margin-top: 0.5rem;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.data-table th,
.data-table td {
    padding: 1.25rem;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.data-table th {
    background: #fafafa;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* Mobile Media Query Start */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }

    /* Removed old .nav-links logic as we now use .desktop-nav and .sidebar */

    .logo img {
        height: 40px;
    }

    .hero {
        padding: 3rem 1rem;
    }

    .app-detail-container {
        padding: 1rem;
        margin: 1rem auto;
    }

    .detail-header {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .app-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .screenshot {
        height: 250px;
    }

    .btn-primary {
        padding: 0.6rem 1.2rem;
        font-size: 0.95rem;
    }

    .homepage-categories {
        display: none;
    }
}