/* ==========================================
   SNAPAPI PREMIUM DESIGN SYSTEM
   ========================================== */

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

/* ==========================================
   CSS RESET & BASE
   ========================================== */

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

/* ==========================================
   DESIGN TOKENS
   ========================================== */

:root {
    /* Brand Colors */
    --brand-primary: #6366f1;
    --brand-secondary: #8b5cf6;
    --brand-accent: #06b6d4;
    
    /* Neutral Palette */
    --gray-50: #fafafa;
    --gray-100: #f4f4f5;
    --gray-200: #e4e4e7;
    --gray-300: #d4d4d8;
    --gray-400: #a1a1aa;
    --gray-500: #71717a;
    --gray-600: #52525b;
    --gray-700: #3f3f46;
    --gray-800: #27272a;
    --gray-900: #18181b;
    
    /* Semantic Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    
    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

/* ==========================================
   TYPOGRAPHY
   ========================================== */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--gray-900);
    line-height: 1.6;
    background: white;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--space-4);
}

/* ==========================================
   LAYOUT
   ========================================== */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

/* ==========================================
   NAVIGATION
   ========================================== */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid var(--gray-200);
    padding: var(--space-4) 0;
    transition: all var(--transition-slow);
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-sm);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    text-decoration: none;
}

.nav-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 900;
}

.nav-links {
    display: flex;
    gap: var(--space-8);
    align-items: center;
}

.nav-links a {
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: color var(--transition-base);
    position: relative;
}

.nav-links a:hover {
    color: var(--gray-900);
}

.nav-links a:not(.btn)::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--brand-primary);
    transition: width var(--transition-slow);
}

.nav-links a:not(.btn):hover::after {
    width: 100%;
}

/* ==========================================
   BUTTONS
   ========================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all var(--transition-base);
    white-space: nowrap;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--gray-900);
    border: 1.5px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-outline {
    background: transparent;
    color: var(--gray-700);
    border: 1.5px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: 1.0625rem;
}

.btn-small {
    padding: var(--space-2) var(--space-4);
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================
   CARDS
   ========================================== */

.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-slow);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
}

/* ==========================================
   FORMS
   ========================================== */

.form-group {
    margin-bottom: var(--space-6);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.9375rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: all var(--transition-base);
    background: white;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-400);
}

/* ==========================================
   MESSAGES
   ========================================== */

.message {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    margin-bottom: var(--space-4);
}

.message-success {
    background: #d1fae5;
    border: 1px solid var(--success);
    color: #065f46;
}

.message-error {
    background: #fee2e2;
    border: 1px solid var(--error);
    color: #991b1b;
}

.message-warning {
    background: #fef3c7;
    border: 1px solid var(--warning);
    color: #92400e;
}

.message-info {
    background: #dbeafe;
    border: 1px solid var(--info);
    color: #1e40af;
}

/* ==========================================
   HERO SECTION
   ========================================== */

.hero {
    padding: calc(var(--space-20) + 80px) 0 var(--space-24);
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 100%;
    height: 150%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

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

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.hero-badge-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.hero h1 {
    margin-bottom: var(--space-6);
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-600) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--gray-600);
    margin-bottom: var(--space-10);
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
}

.trust-bar {
    display: flex;
    justify-content: center;
    gap: var(--space-12);
    margin-top: var(--space-16);
    flex-wrap: wrap;
}

.trust-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

.trust-number {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.trust-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* ==========================================
   DEMO SECTION
   ========================================== */

.demo-section {
    padding: var(--space-20) 0;
    background: white;
}

.demo-container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-2xl);
}

.demo-header {
    background: var(--gray-900);
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.demo-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.demo-dot:nth-child(1) { background: #ff5f56; }
.demo-dot:nth-child(2) { background: #ffbd2e; }
.demo-dot:nth-child(3) { background: #27c93f; }

.demo-tabs {
    display: flex;
    background: var(--gray-800);
    border-bottom: 1px solid var(--gray-700);
}

.demo-tab {
    padding: var(--space-3) var(--space-6);
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    font-family: inherit;
    transition: all var(--transition-base);
    position: relative;
}

.demo-tab:hover {
    color: var(--gray-300);
}

.demo-tab.active {
    color: white;
    background: var(--gray-900);
}

.demo-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--brand-primary);
}

.demo-code {
    background: var(--gray-900);
    padding: var(--space-8);
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    color: #e5e7eb;
    line-height: 1.8;
    overflow-x: auto;
}

.demo-code .keyword { color: #c678dd; }
.demo-code .string { color: #98c379; }
.demo-code .function { color: #61afef; }
.demo-code .comment { color: #5c6370; font-style: italic; }

/* ==========================================
   SECTIONS
   ========================================== */

.section-header {
    max-width: 700px;
    margin: 0 auto var(--space-16);
    text-align: center;
}

.section-label {
    display: inline-block;
    padding: var(--space-2) var(--space-4);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--brand-primary);
    margin-bottom: var(--space-4);
}

.section-title {
    margin-bottom: var(--space-4);
}

.section-description {
    font-size: 1.125rem;
    color: var(--gray-600);
    line-height: 1.7;
}

/* ==========================================
   FEATURES
   ========================================== */

.features {
    padding: var(--space-24) 0;
    background: var(--gray-50);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--space-8);
}

.feature-card {
    background: white;
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    transition: all var(--transition-slow);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--gray-300);
}

.feature-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-5);
}

.feature-icon svg {
    width: 24px;
    height: 24px;
    stroke: white;
    fill: none;
    stroke-width: 2;
}

.feature-card h3 {
    margin-bottom: var(--space-3);
    font-size: 1.25rem;
}

.feature-card p {
    color: var(--gray-600);
    line-height: 1.7;
    margin: 0;
}

/* ==========================================
   PRICING
   ========================================== */

.pricing {
    padding: var(--space-24) 0;
    background: white;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-8);
    max-width: 1200px;
    margin: 0 auto;
}

.pricing-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: var(--space-10);
    position: relative;
    transition: all var(--transition-slow);
}

.pricing-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-2xl);
}

.pricing-card.featured {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-xl);
    background: linear-gradient(180deg, white 0%, #fafafa 100%);
}

.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-2) var(--space-4);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pricing-plan {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.pricing-price {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: var(--space-2);
}

.pricing-price span {
    font-size: 1.25rem;
    color: var(--gray-500);
    font-weight: 400;
}

.pricing-description {
    color: var(--gray-600);
    margin-bottom: var(--space-8);
    font-size: 0.9375rem;
}

.pricing-features {
    list-style: none;
    margin-bottom: var(--space-8);
}

.pricing-features li {
    padding: var(--space-3) 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.9375rem;
    color: var(--gray-700);
}

.pricing-features li::before {
    content: '✓';
    width: 20px;
    height: 20px;
    background: var(--success);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
}

/* ==========================================
   DASHBOARD SPECIFIC
   ========================================== */

.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: calc(var(--space-10) + 80px) 0 var(--space-10) 0;
    margin-bottom: var(--space-10);
}

.dashboard-header h1 {
    color: white;
    margin-bottom: var(--space-2);
}

.dashboard-header p {
    opacity: 0.9;
    font-size: 1.125rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: white;
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: var(--space-3);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    transition: width 0.5s ease;
    border-radius: var(--radius-full);
}

.api-key-box {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-family: 'Monaco', monospace;
    font-size: 0.875rem;
    margin-bottom: var(--space-4);
}

.blur {
    filter: blur(4px);
    user-select: none;
}

/* ==========================================
   LOADING STATES
   ========================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================
   LOGIN & SIGNUP CONTAINERS
   ========================================== */

.login-container,
.signup-container {
    padding-top: calc(var(--space-20) + 80px);
}

/* ==========================================
   FOOTER
   ========================================== */

footer {
    background: var(--gray-900);
    color: white;
    padding: var(--space-20) 0 var(--space-8);
}

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

.footer-brand h3 {
    font-size: 1.5rem;
    margin-bottom: var(--space-4);
}

.footer-brand p {
    color: var(--gray-400);
    line-height: 1.7;
}

.footer-links h4 {
    margin-bottom: var(--space-4);
    font-size: 0.9375rem;
}

.footer-links a {
    display: block;
    color: var(--gray-400);
    text-decoration: none;
    margin-bottom: var(--space-3);
    font-size: 0.9375rem;
    transition: color var(--transition-base);
}

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

.footer-bottom {
    padding-top: var(--space-8);
    border-top: 1px solid var(--gray-800);
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* ==========================================
   ANIMATIONS
   ========================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 768px) {
    .nav-links {
        gap: var(--space-4);
    }

    .nav-links a:not(.btn) {
        display: none;
    }

    .hero {
        padding: calc(var(--space-16) + 80px) 0 var(--space-16);
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .hero-cta {
        flex-direction: column;
    }

    .trust-bar {
        gap: var(--space-8);
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-container,
    .signup-container {
        padding-top: calc(var(--space-16) + 80px);
    }
}

/* ==========================================
   UTILITIES
   ========================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }

.hidden { display: none !important; }