@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --primary-lighter: #334155;
    --accent: #22c55e;
    --accent-hover: #16a34a;
    --accent-light: rgba(34, 197, 94, 0.1);
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #1e293b;
    --border: #334155;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --white: #ffffff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --transition: all 0.2s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

/* ── Layout ────────────────────────────────────────── */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-sm {
    max-width: 500px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-md {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Navbar ────────────────────────────────────────── */

.navbar {
    background: var(--primary);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--white);
    letter-spacing: -0.5px;
}

.navbar-brand span {
    color: var(--accent);
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.navbar-links a {
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.navbar-links a:hover,
.navbar-links a.active {
    color: var(--white);
    background: var(--primary-light);
}

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
}

/* ── Buttons ───────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--accent);
    color: var(--primary);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-secondary {
    background: var(--primary-lighter);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--border);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
}

.btn-outline:hover {
    background: var(--accent);
    color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ── Forms ─────────────────────────────────────────── */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.form-control::placeholder {
    color: var(--primary-lighter);
}

textarea.form-control {
    min-height: 180px;
    resize: vertical;
    line-height: 1.5;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Cards ─────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}

.card-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.card-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* ── Flash Messages ────────────────────────────────── */

.flash {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease;
}

.flash-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.flash-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.flash-info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Hero Section ──────────────────────────────────── */

.hero {
    padding: 100px 0 80px;
    text-align: center;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -1.5px;
    margin-bottom: 20px;
}

.hero h1 span {
    background: linear-gradient(135deg, var(--accent), #4ade80);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Features Grid ─────────────────────────────────── */

.features {
    padding: 80px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 60px;
}

.section-title h2 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
}

.section-title p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    transition: var(--transition);
}

.feature-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ── Pricing Section ───────────────────────────────── */

.pricing {
    padding: 80px 0;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    transition: var(--transition);
    position: relative;
}

.pricing-card.featured {
    border-color: var(--accent);
    transform: scale(1.02);
}

.pricing-card.featured::before {
    content: 'Popular';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--primary);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.pricing-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.pricing-price {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 16px 0;
}

.pricing-price span {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

.pricing-features {
    list-style: none;
    margin: 24px 0;
    text-align: left;
}

.pricing-features li {
    padding: 8px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pricing-features li::before {
    content: '✓';
    color: var(--accent);
    font-weight: 700;
}

/* ── Dashboard ─────────────────────────────────────── */

.page-header {
    padding: 40px 0 20px;
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-header p {
    color: var(--text-muted);
    margin-top: 4px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-card .stat-value.accent {
    color: var(--accent);
}

/* ── Session List ──────────────────────────────────── */

.session-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.session-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.session-item:hover {
    border-color: var(--primary-lighter);
}

.session-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.session-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.session-actions {
    display: flex;
    gap: 8px;
}

/* ── Tailor Page ───────────────────────────────────── */

.tailor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.result-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    margin-top: 32px;
}

.result-box h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--accent);
}

.result-content {
    background: var(--primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 24px;
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.7;
    max-height: 600px;
    overflow-y: auto;
}

.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* ── Tables ────────────────────────────────────────── */

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.data-table th {
    background: var(--primary);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    color: var(--text);
}

.data-table tr:hover td {
    background: var(--primary-light);
}

/* ── Badges ────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-free {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
}

.badge-pro {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent);
}

.badge-pending {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* ── Loading Spinner ───────────────────────────────── */

.spinner-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
}

.spinner-overlay.active {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Auth Pages ────────────────────────────────────── */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
}

.auth-card .card {
    padding: 40px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
    font-size: 1.8rem;
    font-weight: 800;
}

.auth-logo span {
    color: var(--accent);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ── Footer ────────────────────────────────────────── */

.footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 80px;
}

/* ── Utilities ─────────────────────────────────────── */

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none; }

/* ── Admin ─────────────────────────────────────────── */

.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--primary-light);
    border-right: 1px solid var(--border);
    padding: 24px;
}

.admin-sidebar h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 32px;
    color: var(--white);
}

.admin-sidebar h2 span {
    color: var(--accent);
}

.admin-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-nav a {
    display: block;
    padding: 10px 16px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: var(--primary);
    color: var(--white);
}

.admin-content {
    padding: 32px;
    overflow-y: auto;
}

/* ── File Upload ───────────────────────────────────── */

.file-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 12px;
}

.file-upload:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 8px;
}

/* ── Responsive ────────────────────────────────────── */

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
    }

    .pricing-card.featured {
        transform: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .tailor-grid {
        grid-template-columns: 1fr;
    }

    .navbar-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 16px;
    }

    .navbar-links.open {
        display: flex;
    }

    .navbar-toggle {
        display: block;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .admin-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .result-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .card {
        padding: 24px;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
}
