/*
 * Next For Decision (N4D) - Main Stylesheet
 * Modern SaaS Design inspired by Linear, Notion, and Stripe
 */

/* ===========================
   Google Fonts - Inter
   =========================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ===========================
   CSS Variables (Design System)
   =========================== */
:root {
    /* Colors - Primary */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #dbeafe;

    /* Colors - Neutral */
    --color-bg: #ffffff;
    --color-bg-secondary: #f9fafb;
    --color-bg-tertiary: #f3f4f6;
    --color-text: #111827;
    --color-text-secondary: #6b7280;
    --color-text-tertiary: #9ca3af;
    --color-border: #e5e7eb;

    /* Colors - Semantic */
    --color-success: #10b981;
    --color-success-bg: #dcfce7;
    --color-warning: #f59e0b;
    --color-warning-bg: #fef3c7;
    --color-error: #ef4444;
    --color-error-bg: #fee2e2;

    /* Colors - Gradient backgrounds */
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    --gradient-purple: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-dark: linear-gradient(135deg, #1f2937 0%, #111827 100%);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Courier New', monospace;

    /* Font Sizes - rem based (1rem = user's browser default, typically 16px) */
    --text-xs: 0.75rem;      /* 12px */
    --text-sm: 0.875rem;     /* 14px */
    --text-base: 1rem;       /* 16px */
    --text-lg: 1.125rem;     /* 18px */
    --text-xl: 1.25rem;      /* 20px */
    --text-2xl: 1.5rem;      /* 24px */
    --text-3xl: 1.875rem;    /* 30px */
    --text-4xl: 2.25rem;     /* 36px */
    --text-5xl: 3rem;        /* 48px */
    --text-6xl: 3.75rem;     /* 60px */

    /* Font Weights */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;

    /* Line Heights */
    --leading-none: 1;
    --leading-tight: 1.2;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 1.75;

    /* Spacing */
    --space-xs: 0.25rem;     /* 4px */
    --space-sm: 0.5rem;      /* 8px */
    --space-md: 1rem;        /* 16px */
    --space-lg: 1.5rem;      /* 24px */
    --space-xl: 2rem;        /* 32px */
    --space-2xl: 3rem;       /* 48px */
    --space-3xl: 4rem;       /* 64px */
    --space-4xl: 6rem;       /* 96px */

    /* Border Radius */
    --radius-sm: 0.25rem;    /* 4px */
    --radius-md: 0.5rem;     /* 8px */
    --radius-lg: 0.75rem;    /* 12px */
    --radius-xl: 1rem;       /* 16px */
    --radius-2xl: 1.5rem;    /* 24px */
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 200ms ease-in-out;
    --transition-slow: 300ms ease-in-out;

    /* Layout */
    --max-width-sm: 40rem;   /* 640px */
    --max-width-md: 48rem;   /* 768px */
    --max-width-lg: 64rem;   /* 1024px */
    --max-width-xl: 80rem;   /* 1280px */
    --max-width-2xl: 96rem;  /* 1536px */
}

/* ===========================
   CSS Reset & Base Styles
   =========================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    /* Use browser default (typically 16px) - respects user preferences */
    font-size: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    /* Prevent font size inflation on mobile */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-relaxed);
    color: var(--color-text);
    background-color: var(--color-bg);
}

/* ===========================
   Typography
   =========================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    color: var(--color-text);
    margin-bottom: var(--space-md);
    letter-spacing: -0.025em;
}

h1 { font-size: var(--text-5xl); font-weight: var(--font-extrabold); }
h2 { font-size: var(--text-4xl); font-weight: var(--font-extrabold); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
    margin-bottom: var(--space-md);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-hover);
}

/* Text utilities */
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }
.font-extrabold { font-weight: var(--font-extrabold); }

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }
.text-white { color: #ffffff; }

/* ===========================
   Layout Components
   =========================== */
.container {
    width: 100%;
    max-width: var(--max-width-xl);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-sm {
    max-width: var(--max-width-sm);
}

.container-md {
    max-width: var(--max-width-md);
}

.container-lg {
    max-width: var(--max-width-lg);
}

.section {
    padding: var(--space-4xl) 0;
}

.section-sm {
    padding: var(--space-2xl) 0;
}

.section-lg {
    padding: 6rem 0;
}

/* ===========================
   Grid System
   =========================== */
.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Responsive Grid */
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ===========================
   Buttons
   =========================== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: var(--text-base);
    font-weight: 600;
    text-align: center;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary:hover {
    background-color: var(--color-primary);
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-text);
    border: 2px solid var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-text);
    background-color: var(--color-bg-tertiary);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: var(--text-lg);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
}

/* ===========================
   Cards
   =========================== */
.card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    margin-bottom: var(--space-md);
    color: var(--color-text);
}

.card-description {
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* ===========================
   Navigation
   =========================== */
.nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #ffffff;
    border-bottom: 1px solid var(--color-border);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    max-width: var(--max-width-2xl);
    margin: 0 auto;
}

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

.nav-logo img {
    height: 36px;
    width: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    list-style: none;
}

.nav-link {
    color: var(--color-text-secondary);
    font-weight: 500;
    transition: color var(--transition-fast);
}

.nav-link:hover {
    color: var(--color-text);
}

/* Mobile Navigation */
.nav-mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
}

@media (max-width: 768px) {
    .nav-mobile-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border-bottom: 1px solid var(--color-border);
        flex-direction: column;
        padding: var(--space-lg);
        gap: var(--space-md);
    }

    .nav-links.active {
        display: flex;
    }
}

/* ===========================
   Navigation Dropdown
   =========================== */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    font-weight: 500;
    color: var(--color-text-secondary);
    padding: 0;
    line-height: inherit;
    transition: color var(--transition-fast);
}

.nav-dropdown-toggle:hover {
    color: var(--color-text);
}

.nav-dropdown-arrow {
    font-size: 0.6em;
    opacity: 0.7;
    transition: transform var(--transition-base);
}

.nav-dropdown.active .nav-dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    padding: var(--space-sm) 0;
    margin-top: var(--space-sm);
    list-style: none;
    z-index: 100;
}

.nav-dropdown.active .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu li a {
    display: block;
    padding: var(--space-sm) var(--space-lg);
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: background var(--transition-base), color var(--transition-base);
}

.nav-dropdown-menu li a:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}

@media (max-width: 768px) {
    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        background: var(--color-bg-secondary);
        border-radius: var(--radius-sm);
        margin-top: var(--space-xs);
        padding: var(--space-xs) 0;
    }

    .nav-dropdown-menu li a {
        padding: var(--space-xs) var(--space-md);
        font-size: var(--text-sm);
    }
}

/* ===========================
   Footer
   =========================== */
.footer {
    background-color: #1f2937;
    border-top: none;
    padding: var(--space-3xl) 0 0 0;
    overflow-x: hidden;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2xl);
    margin-bottom: var(--space-2xl);
}

.footer-column h4 {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: #ffffff;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--space-sm);
}

.footer-links a {
    color: #9ca3af;
    font-size: var(--text-sm);
}

.footer-links a:hover {
    color: #ffffff;
}

.footer-bottom {
    background-color: #111827;
    margin: 0 calc(-50vw + 50%);
    padding: var(--space-lg) calc(50vw - 50%);
    text-align: center;
    color: #6b7280;
    font-size: var(--text-sm);
}

.footer-legal-links {
    display: flex;
    gap: var(--space-lg);
    list-style: none;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-xl);
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
}

/* ===========================
   Utility Classes
   =========================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mt-3xl { margin-top: var(--space-3xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }
.mb-3xl { margin-bottom: var(--space-3xl); }

.p-xs { padding: var(--space-xs); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }
.p-2xl { padding: var(--space-2xl); }

/* Max-width utilities */
.max-w-sm { max-width: var(--max-width-sm); margin-left: auto; margin-right: auto; }
.max-w-md { max-width: var(--max-width-md); margin-left: auto; margin-right: auto; }
.max-w-lg { max-width: var(--max-width-lg); margin-left: auto; margin-right: auto; }
.max-w-xl { max-width: var(--max-width-xl); margin-left: auto; margin-right: auto; }

/* ===========================
   Responsive Typography
   =========================== */
@media (max-width: 768px) {
    h1 { font-size: var(--text-4xl); }
    h2 { font-size: var(--text-3xl); }
    h3 { font-size: var(--text-2xl); }

    .section {
        padding: var(--space-3xl) 0;
    }
}

/* ===========================
   Animations
   =========================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* ===========================
   Forms
   =========================== */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--color-text);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: var(--text-base);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-error {
    color: var(--color-error);
    font-size: var(--text-sm);
    margin-top: var(--space-xs);
}

.form-input-error {
    border-color: var(--color-error);
}

.form-input-error:focus {
    border-color: var(--color-error);
}

.form-error-message {
    color: var(--color-error);
    font-size: var(--text-sm);
    margin-top: var(--space-xs);
}

.signup-error-banner {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: var(--text-sm);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
