/* --- GLOBAL COLOR PALETTE (CSS Variables) --- */

:root {
    /* Backgrounds */
    --color-bg-page: #f5f5f5;          /* General page background */
    --color-bg-card: #ffffff;          /* Sections, Cards, Header BG */
    --color-bg-alt: #fafafa;           /* Input fields, API Box (Light alt BG) */

    /* Text */
    --color-text-primary: #222;        /* Main text, headings, dark buttons text */
    --color-text-secondary: #555;      /* Labels, secondary text */
    --color-text-alt: #333;            /* API Key text */
    --color-text-global-secondary: #64748b; /* Global navigation links/body text */

    /* Borders */
    --color-border-global: #e2e8f0;    /* Header border */
    --color-border-card: #e5e5e5;      /* Section border */
    --color-border-input: #ccc;        /* Input borders */

    /* Actions/Highlights */
    --color-btn-primary-bg: #000;      /* Profile Primary button */
    --color-btn-primary-text: #ffffff;
    --color-btn-secondary-bg: #f4f4f4; /* Profile Secondary button */
    --color-btn-secondary-hover: #e9e9e9;
    --shadow-card: 0px 1px 4px rgba(0,0,0,0.05);

    /* Focus/Interaction */
    --color-focus-border: #000;
}

/* --- Dark Theme Overrides --- */
.dark-theme {
    /* Backgrounds */
    --color-bg-page: #1a1a1a;
    --color-bg-card: #242424;
    --color-bg-alt: #2c2c2c;
    
    /* Text */
    --color-text-primary: #f0f0f0;
    --color-text-secondary: #aaaaaa;
    --color-text-alt: #e0e0e0;
    --color-text-global-secondary: #a0a0a0;

    /* Borders */
    --color-border-global: #333333;
    --color-border-card: #333333;
    --color-border-input: #444444;

    /* Actions/Highlights */
    --color-btn-primary-bg: #007acc; /* Dark mode blue */
    --color-btn-primary-text: #ffffff;
    --color-btn-secondary-bg: #3a3a3a;
    --color-btn-secondary-hover: #4a4a4a;
    --shadow-card: 0px 4px 12px rgba(0, 0, 0, 0.4);

    /* Focus/Interaction */
    --color-focus-border: #55aaff;
}
/* END GLOBAL COLOR PALETTE */

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    background: var(--color-bg-card); /* Use variable for background */
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border-global); /* Use variable for border */
    z-index: 1000;
}

.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 2px;
    font-weight: 700;
    font-size: 20px;
    color: var(--color-text-primary); /* Use variable for text */
}

.logo-icon {
    width: 40px;   /* original size */
    height: 40px;  /* original size */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;  /* remove gradient background */
}

.logo-icon img {
    width: 30px;   /* original SVG size */
    height: 30px;
}

.nav-menu {
    display: flex;
    gap: 32px;
}

.nav-link {
    text-decoration: none;
    color: var(--color-text-global-secondary);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover,
.nav-link.active {
    color: #3b82f6; /* Keep primary blue hover for contrast */
    font-weight: bold;
}

.nav-actions {
    display: flex;
    gap: 16px;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 3px;
    background: var(--color-text-primary); /* Use variable for color */
    margin: 3px 0;
    transition: 0.3s;
}

/* Buttons (Retaining fixed colors for branded primary/hero buttons) */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-global-secondary);
}

.btn-ghost:hover {
    background: var(--color-bg-page); /* Use page BG for hover */
    color: var(--color-text-primary);
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.btn-hero-primary {
    background: white;
    color: #3b82f6;
    padding: 16px 32px;
    font-size: 18px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.btn-hero-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.btn-hero-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 16px 32px;
    font-size: 18px;
}

.btn-hero-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Hero Section */
.hero {
    position: relative;
    min-height: 90vh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-background {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(6, 182, 212, 0.85)),
                url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    background-size: cover, 50px 50px;
    background-position: center, 0 0;
}

.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    margin-top: 5px;
    margin-bottom: 20px;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    color: white;
    margin-bottom: 24px;
    line-height: 1.1;
}

.highlight {
    background: linear-gradient(to right, white, rgba(255, 255, 255, 0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 16px;
    font-weight: 500;
}

.hero-description {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 48px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-bottom: 50px;
}

.hero-features {
    display: flex;
    gap: 1.5rem;
    /* max-width: 100%; */
    margin: 0 auto 0;
}

.feature-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 32px;
    width: 600px;
    text-align: center;
    transition: transform 0.3s;
    margin-bottom: 15px;
}

.feature-card:hover {
    transform: translateY(-4px);
}

.feature-icon {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: white;
}

.feature-card h3 {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.feature-card p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.scroll-indicator {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s infinite;
}

.scroll-mouse {
    width: 24px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    position: relative;
}

.scroll-wheel {
    width: 4px;
    height: 12px;
    background: white;
    border-radius: 2px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

@keyframes scroll {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(16px);
    }
}

/* Features Section */
.features {
    padding: 96px 0;
    background: var(--color-bg-page); /* Use variable */
}

.section-header {
    text-align: center;
    margin-bottom: 64px;
}

.section-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 50px;
    color: #3b82f6; 
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
}

.section-title {
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-text-primary); /* Use variable */
    margin-bottom: 24px;
    line-height: 1.2;
}

.section-description {
    font-size: 1.2rem;
    color: var(--color-text-global-secondary); /* Use variable */
    max-width: 700px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 32px;
    margin-bottom: 64px;
}

.feature-card-large {
    /* Retaining a mix for this complex element, but fixing core colors */
    background: var(--color-bg-card);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-card);
    transition: all 0.3s;
    border: 1px solid var(--color-border-card);
}

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

.feature-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.feature-icon-large {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-badge {
    background: var(--color-bg-page); /* Use variable */
    color: var(--color-text-global-secondary); /* Use variable */
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.feature-card-large h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-text-primary); /* Use variable */
    margin-bottom: 12px;
}

.feature-card-large p {
    color: var(--color-text-global-secondary); /* Use variable */
    line-height: 1.6;
}

/* Stats Section */
.stats-section {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    border-radius: 16px;
    padding: 48px;
    text-align: center;
    color: white;
}

.stats-section h3 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 32px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

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

/* Footer */
.footer {
    background: #1e293b;
    color: white;
    padding: 64px 0 0;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    margin-bottom: 48px;
}

.footer-brand {
    max-width: 400px;
}

.footer-brand .logo {
    margin-bottom: 24px;
    color: white;
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 24px;
    line-height: 1.6;
}

.social-links {
    display: flex;
    gap: 16px;
}

.social-link {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.social-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.footer-column h4 {
    font-weight: 600;
    margin-bottom: 16px;
}

.footer-column a {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    margin-bottom: 12px;
    transition: color 0.3s;
}

.footer-column a:hover {
    color: white;
}

.newsletter {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.newsletter input {
    flex: 1;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.newsletter input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 32px 0;
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-legal {
    display: flex;
    gap: 24px;
}

.footer-legal a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 14px;
}

.footer-legal a:hover {
    color: white;
}

/* ========================================= */
/* === Reusable Header for Policy Pages === */
/* ========================================= */

.policy-hero-header {
    background: linear-gradient(135deg, #3b82f6, #06b6d4); 
    color: white; 
    text-align: center;
    padding: 60px 24px;
    margin-bottom: 0; 
}

.policy-hero-header h1 {
    color: white !important;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    margin: 0;
}

.policy-hero-header p {
    color: white !important;
    opacity: 0.9;
    font-size: 1.1rem;
    margin-top: 10px;
    margin-bottom: 0;
}

/* Hub Preview Section */
.hub-preview {
    margin-top: 60px;
    margin-bottom: 20px;
    padding: 40px 20px;
    background: var(--card-bg, #ffffff); /* Fallback to white if variable not set */
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.hub-content h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--text-primary, #333);
}

.hub-content p {
    font-size: 1.1rem;
    color: var(--text-secondary, #666);
    max-width: 700px;
    margin: 0 auto 30px auto;
    line-height: 1.6;
}

.hub-btn {
    display: inline-block;
    padding: 14px 32px;
    /* Updated to your gradient */
    background: var(--p-gradient, linear-gradient(180deg, rgba(59, 130, 246, 0.95), rgba(6, 182, 212, 0.85)));
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: transform 0.2s, background-color 0.2s;
}

.hub-btn:hover {
    /* Maintained gradient on hover with slight opacity change for effect */
    background: var(--p-gradient, linear-gradient(180deg, rgba(59, 130, 246, 0.95), rgba(6, 182, 212, 0.85)));
    opacity: 0.9;
    transform: translateY(-2px);
    color: #fff;
}

.nav-switch {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.06); /* subtle gray instead of white glass */
    border-radius: 999px;
    padding: 4px;
    margin-left: 20px;
}

.switch-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #374151; /* dark gray text (visible on light bg) */
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.switch-btn:hover {
    color: #111827; /* darker on hover */
}

.switch-btn.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb); /* your blue theme */
    color: white;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Mobile nav adjustments */
    .nav-menu,
    .nav-actions {
        display: none;
    }
    .mobile-menu-toggle {
        display: flex;
    }

    .nav-actions-mobile{
        display: flex;
        justify-content: space-around;
    }
    
    /* Target the dropdown menu when the main mobile menu is open */
    .nav-menu.mobile-active .dropdown-menu {
        position: relative; /* Must be relative to stack */
        transform: none;
        box-shadow: none;
        border: none;
        margin-top: 0;
        border-radius: 0;
        padding: 0;
        background: var(--color-bg-page); /* Use variable */
        
        /* Key for smooth collapse/expand */
        max-height: 0; 
        opacity: 0;
        visibility: hidden;
        transition: max-height 0.4s ease-out, opacity 0.3s ease, padding 0.3s;
        border-top: 1px solid var(--color-border-global); /* Use variable */
    }

    /* State when the user clicks 'Services' on mobile */
    .nav-menu.mobile-active .dropdown.open .dropdown-menu {
        max-height: 300px; /* Sufficient height to show content */
        opacity: 1;
        visibility: visible;
        padding: 5px 0;
    }

    /* Style for the submenu links */
    .nav-menu.mobile-active .dropdown-item {
        padding: 10px 20px 10px 40px; /* Indent for nested feel */
    }
    /* END DROPDOWN MENU FIXES */

    /* Hero section font sizes and layout */
    .hero-title {
        font-size: 5vw;
    }
    .hero-subtitle {
        font-size: 2.5vw;
    }
    .hero-description {
        font-size: 2vw;
    }
    .hero-actions {
        flex-direction: column;
        align-items: center;
        gap: 2vw;
    }
    .btn-hero-primary,
    .btn-hero-secondary {
        font-size: 2.5vw;
        padding: 2.5vw 5vw;
        width: 70%; /* Full width buttons on smaller screens */
        gap: 20px;
    }
    .hero-features {
        flex-direction: column;
        align-items: center;
        gap: 3%;
    }

    /* General section adjustments */
    .section-title {
        font-size: 4vw;
    }
    .features-grid {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-content {
        grid-template-columns: 1fr;
        gap: 5%;
    }
    .footer-links {
        grid-template-columns: 1fr;
    }
    .footer-bottom-content {
        flex-direction: column;
        gap: 2%;
        text-align: center;
    }
    .newsletter {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    /* Further adjustments for a smaller tablet/large mobile viewport */
    .hero-title {
        font-size: 6vw;
    }
    .hero-subtitle {
        font-size: 3vw;
    }
    .hero-description {
        font-size: 2.5vw;
        gap: 3vw;
    }
    .btn-hero-primary,
    .btn-hero-secondary {
        font-size: 3vw;
        padding: 3vw 6vw;
        width: 100%; /* Full width buttons on smaller screens */
    }
    .feature-card {
        width: 90%; /* Use percentage to prevent overflow */
        max-width: 350px;
    }
}

@media (max-width: 480px) {
    /* Specific adjustments for small mobile screens */
    .container {
        padding: 0 4%;
    }
    .hero-title {
        font-size: 8vw;
    }
    .hero-subtitle {
        font-size: 4.5vw;
    }
    .hero-description {
        font-size: 4vw;
    }
    .hero-actions {
        flex-direction: column;
        gap: 3vw;
    }
    .btn-hero-primary,
    .btn-hero-secondary {
        font-size: 4.5vw;
        padding: 4.5vw 9vw;
        width: 100%; /* Full width buttons on small screens */
    }
    .feature-card {
        width: 100%; /* Take up full width on very small screens */
    }
    .section-title {
        font-size: 6vw;
    }
}

/* ── HUB HEADER RESPONSIVE FIXES ── */

@media (max-width: 1024px) {
    .nav-wrapper {
        height: 64px;
    }
    .logo {
        font-size: 16px;
    }
    .logo-icon {
        width: 34px;
        height: 34px;
    }
    .logo-icon img {
        width: 24px;
        height: 24px;
    }
    .nav-menu {
        gap: 20px;
    }
    .nav-link {
        font-size: 13px;
    }
    .switch-btn {
        font-size: 12px;
        padding: 5px 12px;
    }
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .nav-wrapper {
        height: 58px;
        gap: 8px;
    }
    .logo {
        font-size: 14px;
        gap: 6px;
    }
    .logo-icon {
        width: 30px;
        height: 30px;
    }
    .logo-icon img {
        width: 22px;
        height: 22px;
    }
    .nav-switch {
        margin-left: 8px;
        padding: 3px;
    }
    .switch-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
    .nav-actions {
        gap: 8px;
        flex-shrink: 0;
    }
    #profileContainer {
        flex-shrink: 0;
    }
    #profileIcon {
        width: 32px !important;
        height: 32px !important;
        font-size: 12px !important;
        padding: 0 !important;
    }
    #authButtons .btn {
        padding: 7px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .nav-wrapper {
        height: 56px;
        gap: 6px;
    }
    .logo {
        font-size: 13px;
    }
    .logo-icon {
        width: 28px;
        height: 28px;
    }
    .logo-icon img {
        width: 20px;
        height: 20px;
    }
    .switch-btn {
        padding: 4px 8px;
        font-size: 10px;
    }
    #profileIcon {
        width: 30px !important;
        height: 30px !important;
        font-size: 11px !important;
    }
    #authButtons .btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

@media (max-width: 360px) {
    .logo-text {
        display: none;
    }
    .switch-btn {
        padding: 4px 6px;
        font-size: 10px;
    }
    #authButtons .btn-ghost {
        display: none;
    }
}