/* === CSS Variables === */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #0ea5e9;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --gray-900: #0f172a;
    --gray-800: #1e293b;
    --gray-700: #334155;
    --gray-600: #475569;
    --gray-500: #64748b;
    --gray-400: #94a3b8;
    --gray-300: #cbd5e1;
    --gray-200: #e2e8f0;
    --gray-100: #f1f5f9;
    --white: #ffffff;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    color: var(--gray-800);
    line-height: 1.6;
    background: var(--gray-100);
}

a {
    text-decoration: none;
    color: inherit;
}

/* === Navigation === */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
}

.logo-icon {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    color: var(--gray-600);
    font-weight: 500;
    transition: color 0.2s;
}

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

.nav-btn {
    background: var(--primary);
    color: var(--white) !important;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.nav-btn:hover {
    background: var(--primary-dark);
}

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: var(--gray-100);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

/* === Hero Section === */
.hero {
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
    color: var(--white);
    padding: 6rem 2rem;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-300) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--gray-400);
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 4rem;
}

.stat {
    display: flex;
    flex-direction: column;
}

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

.stat-label {
    color: var(--gray-400);
    font-size: 0.875rem;
}

/* === Features Section === */
.features {
    padding: 5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.features h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
    color: var(--gray-900);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.feature-card p {
    color: var(--gray-600);
}

/* === Code Example === */
.code-example {
    background: var(--gray-900);
    padding: 5rem 2rem;
    color: var(--white);
}

.code-example h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.code-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--gray-800);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.code-header {
    background: var(--gray-700);
    padding: 0.75rem 1rem;
    display: flex;
    gap: 1rem;
}

.code-tab {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--gray-400);
    font-size: 0.875rem;
}

.code-tab.active {
    background: var(--gray-800);
    color: var(--white);
}

.code-block {
    padding: 1.5rem;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--gray-300);
}

/* === CTA Section === */
.cta {
    text-align: center;
    padding: 5rem 2rem;
    background: var(--white);
}

.cta h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.cta p {
    color: var(--gray-600);
    margin-bottom: 2rem;
}

/* === Footer === */
.footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: 4rem 2rem 2rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    color: var(--white);
    margin-bottom: 1rem;
}

.footer-section a {
    display: block;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

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

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-800);
}

/* === Dashboard Specific === */
.dashboard {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--gray-900);
    padding: 2rem 0;
    color: var(--white);
}

.sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--gray-800);
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--gray-400);
    transition: all 0.2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--gray-800);
    color: var(--white);
}

.main-content {
    padding: 2rem;
    background: var(--gray-100);
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    color: var(--gray-900);
}

/* === Cards === */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

/* === Forms === */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

/* === API Key Display === */
.api-key-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--gray-100);
    padding: 1rem;
    border-radius: var(--radius);
    font-family: monospace;
}

.api-key-value {
    flex: 1;
    word-break: break-all;
}

.api-key-masked {
    color: var(--gray-500);
}

/* === Tables === */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-700);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* === Badges === */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

/* === Usage Stats === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.stat-card .stat-label {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-card .stat-change {
    font-size: 0.875rem;
    color: var(--success);
}

/* === Progress Bar === */
.progress-bar {
    background: var(--gray-200);
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
}

.progress-fill {
    background: var(--primary);
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s;
}

/* === Auth Pages === */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
}

.auth-card {
    background: var(--white);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--gray-600);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--gray-600);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 500;
}

/* === Pricing Cards === */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    position: relative;
}

.pricing-card.featured {
    border: 2px solid var(--primary);
}

.pricing-card.featured::before {
    content: 'Popular';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: var(--white);
    padding: 0.25rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pricing-tier {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.pricing-price {
    font-size: 3rem;
    font-weight: 700;
    color: var(--gray-900);
}

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

.pricing-features {
    margin: 2rem 0;
    list-style: none;
}

.pricing-features li {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
}

.pricing-features li::before {
    content: '✓';
    color: var(--success);
    font-weight: 700;
}

/* === Docs Page === */
.docs-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 70px);
}

.docs-sidebar {
    background: var(--white);
    padding: 2rem 1.5rem;
    border-right: 1px solid var(--gray-200);
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
}

.docs-nav-section {
    margin-bottom: 1.5rem;
}

.docs-nav-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.docs-nav a {
    display: block;
    padding: 0.5rem 0;
    color: var(--gray-600);
    font-size: 0.875rem;
}

.docs-nav a:hover,
.docs-nav a.active {
    color: var(--primary);
}

.docs-content {
    padding: 2rem 3rem;
    max-width: 900px;
}

.docs-content h1 {
    font-size: 2rem;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.docs-content h2 {
    font-size: 1.5rem;
    color: var(--gray-900);
    margin: 2rem 0 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

.docs-content h3 {
    font-size: 1.25rem;
    color: var(--gray-900);
    margin: 1.5rem 0 0.75rem;
}

.docs-content p {
    color: var(--gray-700);
    margin-bottom: 1rem;
}

.docs-content pre {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 1.5rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1rem 0;
    font-size: 0.875rem;
}

.docs-content code {
    font-family: 'Monaco', 'Menlo', monospace;
}

.docs-content :not(pre) > code {
    background: var(--gray-100);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--primary-dark);
}

/* === Alerts === */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-info {
    background: rgba(14, 165, 233, 0.1);
    border-left: 4px solid var(--secondary);
    color: var(--gray-700);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--warning);
    color: var(--gray-700);
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-left: 4px solid var(--success);
    color: var(--gray-700);
}

/* === Responsive === */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .dashboard {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: none;
    }
    
    .docs-layout {
        grid-template-columns: 1fr;
    }
    
    .docs-sidebar {
        display: none;
    }
}
