:root {
    --primary: #444444;
    /* Dark text for primary headings */
    --secondary: #666666;
    /* Medium grey for secondary */
    --bg-light: #f5f5f7;
    /* Soft light gray background */
    --card-bg: #ffffff;
    /* Pure white for cards */
    --text-primary: #333333;
    /* Very dark grey text */
    --text-secondary: #666666;
    --border: #e8e8ed;
    /* Light grey border */
    --input-bg: #ffffff;
    /* White input background */
    --input-focus-bg: #f9f9f9;
    --input-focus-color: #333333;
    --accent: #d3d3d3;
    /* Light Gray for action buttons */
    --danger: #E34234;
    --success: #6B8E23;
    --nav-icon: #003366;
}

[data-theme="dark"] {
    --bg-light: #121212;
    --card-bg: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #aaaaaa;
    --border: #333333;
    --input-bg: #2d2d2d;
    --input-focus-bg: #404040;
    --input-focus-color: #ffffff;
    --accent: #555555;
    --nav-icon: #ffffff;
}

body {
    background-color: var(--bg-light);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.95);
    /* Light navbar */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.logo h3 {
    margin: 0;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 15px;
    align-items: baseline;
}

.nav-links a,
.dropbtn {
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links a:hover,
.dropdown:hover .dropbtn,
.active-parent {
    color: var(--primary);
    background: rgba(0, 0, 0, 0.05);
}

.nav-links a.active {
    color: var(--primary);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.05);
}

/* Dropdown specific */
.dropdown {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--card-bg);
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.1);
    z-index: 101;
    border-radius: 8px;
    border: 1px solid var(--border);
    top: 100%;
    left: 0;
    padding: 8px 0;
}

.dropdown-content a {
    color: var(--text-primary);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    border-radius: 0;
    white-space: nowrap;
}

.dropdown-content a i.fas,
.dropdown-content a svg {
    width: 22px;
    text-align: center;
    margin-right: 10px !important;
}

/* Modifiers for right-aligned dropdowns */
.dropdown-right .dropdown-content {
    right: 0;
    left: auto;
}

.dropdown:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.2s;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Menu base defaults (Hidden on Desktop) */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
    margin-right: 15px;
}

.mobile-nav-overlay {
    display: none;
}

.mobile-nav {
    display: none;
}

/* Media Query for Mobile */
@media (max-width: 992px) {
    .nav-links {
        display: none;
        /* Hide Desktop menu */
    }

    .mobile-menu-toggle {
        display: block;
    }

    .navbar {
        padding: 15px 20px;
    }

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

    /* Mobile Off-canvas Menu */
    .mobile-nav-overlay.open {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
        backdrop-filter: blur(2px);
    }

    .mobile-nav.open {
        transform: translateX(0);
    }

    .mobile-nav {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background: var(--card-bg);
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        overflow-y: auto;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        display: flex;
        flex-direction: column;
    }

    .mobile-nav-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        border-bottom: 1px solid var(--border);
    }

    .mobile-nav-header h3 {
        margin: 0;
    }

    .close-menu-btn {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-secondary);
        cursor: pointer;
        padding: 0;
        margin: 0;
        width: auto;
    }

    .mobile-menu-section {
        padding: 15px 20px;
        border-bottom: 1px solid var(--border);
    }

    .mobile-menu-section h4 {
        margin: 0 0 10px 0;
        color: var(--text-secondary);
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .mobile-menu-section a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 0;
        color: var(--text-primary);
        text-decoration: none;
        font-weight: 500;
        font-size: 1.05rem;
    }

    .mobile-menu-section a.active {
        color: var(--primary);
        font-weight: 700;
    }

    .logout-link {
        color: var(--danger) !important;
    }
}

/* Container */
.container {
    padding: 20px 30px;
    max-width: 100%;
    /* Expand globally for dual-pane fluidity */
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 30px;
    color: var(--primary);
    letter-spacing: -1px;
}

h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--primary);
}

/* Cards */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.responsive-split-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    /* Lighter shadow */
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

/* Bubbles */
.bubble {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.05);
    /* Dark opacity for light theme */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--primary);
}

.value {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 10px 0;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.unit {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Forms */
form {
    width: 100%;
}

.form-group {
    margin-bottom: 15px;
    width: 100%;
    /* Full width */
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    /* Allow wrapping on small screens */
}

.form-row .form-group {
    flex: 1;
    min-width: 140px;
    /* Prevent too small inputs */
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="url"],
select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    /* Critical for responsiveness */
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    padding: 0;
    margin-right: 8px;
    cursor: pointer;
    accent-color: #00599c;
    transform: scale(1.1);
}

input:focus,
select:focus {
    background: var(--input-focus-bg);
    border-color: var(--primary);
    color: var(--input-focus-color);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Buttons */
button {
    background: var(--accent);
    color: #333333;
    /* Dark text on light gray buttons */
    border: 1px solid #cccccc;
    /* Subtle border for gray buttons */
    padding: 12px 24px;
    border-radius: 8px;
    /* Slightly less rounded */
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    /* Full width on mobile default */
    margin-top: 10px;
}

button:hover {
    background: #e6e6e6;
    /* Lighter hover effect */
}

/* Smappee Action Button Standard */
.smappee-btn {
    background-color: #FFFFFF;
    border: 1px solid #ECE1DC;
    border-radius: 6px;
    color: #333334;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s;
}
.smappee-btn:hover { background-color: #F8F4F2; }

@media (min-width: 768px) {
    button {
        width: auto;
        /* Auto width on desktop */
    }
}

@media (max-width: 992px) {
    .responsive-split-grid {
        grid-template-columns: 1fr;
    }
}

/* Auth Page overrides */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-light);
}

.auth-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 18px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

.social-login {
    margin-top: 25px;
    border-top: 1px solid var(--border);
    padding-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.social-btn {
    background: #f5f5f5 !important;
    color: #333333 !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.social-btn:hover {
    background: #e6e6e6 !important;
}

/* =========================================
   Apple App Store Redesign Styles
========================================= */

.store-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 30px;
    align-items: start;
    margin-top: 10px;
}

.store-sidebar {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-right: 1px solid var(--border);
    padding-right: 20px;
    height: calc(100vh - 100px);
    overflow-y: auto;
}

.store-sidebar-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    padding-left: 10px;
}

.store-sidebar a {
    text-decoration: none;
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.store-sidebar a:hover {
    background: rgba(0, 0, 0, 0.05);
}

.store-sidebar a.active {
    background: rgba(0, 89, 156, 0.1);
    color: #00599c;
    font-weight: 600;
}

.store-sidebar a i {
    font-size: 1.1em;
    width: 20px;
    text-align: center;
}

.store-content {
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding-bottom: 50px;
}

.store-banner {
    width: 100%;
    height: 300px;
    border-radius: 16px;
    background: linear-gradient(135deg, #002952 0%, #004c99 100%);
    color: white;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    box-shadow: 0 10px 30px rgba(0, 41, 82, 0.3);
    position: relative;
    overflow: hidden;
}

.store-banner-content {
    position: relative;
    z-index: 2;
}

.store-banner h2 {
    color: white;
    font-size: 2.2rem;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.store-banner p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 60%;
}

.category-section {
    display: flex;
    flex-direction: column;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.category-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.category-header a {
    color: #00599c;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.category-header a:hover {
    text-decoration: underline;
}

.store-carousel-container {
    position: relative;
    width: 100%;
}

.store-carousel {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding-bottom: 15px;
    max-height: 125px; /* Limits view to exactly one row by default */
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
}

.store-carousel.expanded {
    max-height: 5000px; /* Safely spans completely open */
}

.apple-app-card {
    min-width: 300px;
    max-width: 300px;
    display: grid;
    grid-template-columns: 70px 1fr auto;
    gap: 15px;
    align-items: center;
    background: transparent;
    padding: 10px 0;
    scroll-snap-align: start;
    text-decoration: none;
    /* Make entire card clickable */
    color: inherit;
}

.apple-app-card:hover .apple-app-icon {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.apple-app-icon {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 2.2rem;
    overflow: hidden;
}

.apple-app-icon svg,
.apple-app-icon i {
    width: 60%;
    height: 60%;
}

.apple-app-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    /* Important for ellipsis */
}

.apple-app-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 2px 0;
}

.apple-app-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.apple-app-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.apple-get-btn {
    background: rgba(0, 89, 156, 0.1);
    color: #00599c;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 6px 16px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 0.2s;
    margin: 0;
    width: auto;
}

.apple-get-btn:hover {
    background: rgba(0, 89, 156, 0.2);
}

.apple-in-app {
    font-size: 0.6rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1;
}

/* Detail Page specific */
.detail-header {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    align-items: center;
}

.detail-icon {
    width: 140px;
    height: 140px;
    border-radius: 30px;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    font-size: 4rem;
    flex-shrink: 0;
}

.detail-title-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.detail-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin: 0;
    color: var(--text-primary);
}

.detail-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin: 0;
}

.detail-developer {
    font-size: 1rem;
    color: #00599c;
    font-weight: 500;
    text-decoration: none;
    margin-top: 5px;
}

.detail-stats-bar {
    display: flex;
    gap: 40px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex: 1;
    border-right: 1px solid var(--border);
}

.stat-item:last-child {
    border-right: none;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.apple-star {
    font-size: 0.8rem;
    color: #FF9500;
}

@media (max-width: 768px) {
    .store-layout {
        grid-template-columns: 1fr;
    }

    .store-sidebar {
        display: none;
        /* Replace with a horizontal scroll / dropdown on mobile later */
    }

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

.nav-links i.fas, .mobile-menu-section i.fas, .dropdown svg[stroke="currentColor"], .mobile-nav-header svg[stroke="currentColor"] {
    color: var(--nav-icon) !important;
}