/* sefaz — Styles */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #27272a;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Navigation */
nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 2rem; background: var(--bg-secondary);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.nav-brand h1 { font-size: 1.2rem; font-weight: 600; }
.nav-links { display: flex; gap: 1rem; align-items: center; }
.nav-links a { color: var(--text-secondary); text-decoration: none; }
.nav-links a:hover { color: var(--text-primary); }

/* Sections */
.section { display: none; padding: 2rem; max-width: 1200px; margin: 0 auto; }
.section.active { display: block; }

/* Hero */
.hero {
    text-align: center; padding: 5rem 2rem 4rem;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a3e 40%, #2d1b69 100%);
    border-radius: var(--radius); margin-bottom: 3rem;
    border: 1px solid rgba(99,102,241,0.15);
}
.hero-badge {
    display: inline-block; padding: 0.4rem 1.2rem; border-radius: 20px;
    background: rgba(99,102,241,0.15); color: var(--accent-hover);
    font-size: 0.85rem; font-weight: 500; margin-bottom: 1.5rem;
    border: 1px solid rgba(99,102,241,0.25);
}
.hero h2 { font-size: 2.8rem; margin-bottom: 1.2rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
.hero-subtitle { color: var(--text-secondary); font-size: 1.15rem; margin-bottom: 2.5rem; max-width: 640px; margin-left: auto; margin-right: auto; line-height: 1.7; }
.hero-cta { display: flex; gap: 1rem; justify-content: center; align-items: center; margin-bottom: 3rem; flex-wrap: wrap; }
.btn-lg { padding: 1rem 2.2rem; font-size: 1.1rem; }
.btn-ghost { color: var(--text-secondary); text-decoration: none; font-size: 1rem; font-weight: 500; transition: color 0.2s; }
.btn-ghost:hover { color: var(--text-primary); }
.hero-stats { display: flex; justify-content: center; gap: 3rem; flex-wrap: wrap; }
.hero-stat { text-align: center; }
.hero-stat strong { display: block; font-size: 1.6rem; color: var(--accent-hover); font-weight: 700; }
.hero-stat span { font-size: 0.8rem; color: var(--text-secondary); }

/* Section blocks */
.section-block { margin-bottom: 3.5rem; text-align: center; }
.section-title { font-size: 2rem; margin-bottom: 1rem; font-weight: 700; letter-spacing: -0.01em; }
.section-desc { color: var(--text-secondary); font-size: 1.05rem; max-width: 700px; margin: 0 auto 2.5rem; line-height: 1.7; }

/* Features grid */
.features-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-bottom: 3.5rem;
}
.feature-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 2rem 1.5rem;
    border: 1px solid var(--border); transition: border-color 0.2s, transform 0.2s;
    text-align: left;
}
.feature-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.feature-icon { font-size: 2rem; margin-bottom: 1rem; }
.feature-card h4 { font-size: 1.1rem; margin-bottom: 0.5rem; font-weight: 600; }
.feature-card p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }

/* Steps */
.steps-grid { display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap; }
.step-card { text-align: center; max-width: 260px; }
.step-number {
    width: 48px; height: 48px; border-radius: 50%; background: var(--accent);
    color: #fff; font-size: 1.3rem; font-weight: 700; display: flex; align-items: center;
    justify-content: center; margin: 0 auto 1rem;
}
.step-card h4 { margin-bottom: 0.5rem; font-weight: 600; }
.step-card p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; }

/* Example bubbles */
.examples-showcase { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; max-width: 800px; margin: 0 auto; }
.example-bubble {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px;
    padding: 0.6rem 1.2rem; font-size: 0.9rem; color: var(--text-secondary);
    transition: border-color 0.2s, color 0.2s; cursor: default;
}
.example-bubble:hover { border-color: var(--accent); color: var(--text-primary); }

/* Featured tag */
.featured-tag {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: #fff; padding: 0.25rem 1rem; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}

/* Landing footer CTA */
.landing-footer {
    text-align: center; padding: 4rem 2rem; margin-top: 2rem;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    border-radius: var(--radius); border: 1px solid var(--border);
}
.landing-footer h3 { font-size: 1.8rem; margin-bottom: 0.75rem; font-weight: 700; }
.landing-footer p { color: var(--text-secondary); margin-bottom: 1.5rem; max-width: 500px; margin-left: auto; margin-right: auto; }
.landing-footer .btn-primary { margin-bottom: 2rem; }
.footer-brand { color: var(--text-secondary); font-size: 0.85rem; margin-top: 1rem; }
.footer-brand a { color: var(--accent); text-decoration: none; }
.footer-brand a:hover { text-decoration: underline; }

/* Buttons */
.btn-primary {
    background: var(--accent); color: white; border: none;
    padding: 0.75rem 1.5rem; border-radius: var(--radius);
    font-size: 1rem; cursor: pointer; font-weight: 500;
    transition: background 0.2s; position: relative;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }
.btn-primary.loading { color: transparent; pointer-events: none; }
.btn-primary.loading::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    width: 20px; height: 20px; margin: -10px 0 0 -10px;
    border: 3px solid rgba(255,255,255,0.3); border-top-color: #fff;
    border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.9rem; }
.btn-back {
    background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border);
    padding: 0.5rem 1rem; border-radius: var(--radius); cursor: pointer;
}

/* Auth cards */
.auth-card {
    max-width: 400px; margin: 2rem auto; background: var(--bg-card);
    padding: 2rem; border-radius: var(--radius); box-shadow: var(--shadow);
}
.auth-card h2 { margin-bottom: 1.5rem; text-align: center; }
.auth-card input {
    width: 100%; padding: 0.75rem; margin-bottom: 1rem;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text-primary); font-size: 1rem;
}
.auth-card button[type="submit"] { width: 100%; }
.divider { text-align: center; margin: 1.5rem 0; color: var(--text-secondary); }
.divider span { background: var(--bg-card); padding: 0 1rem; }
.auth-link { text-align: center; margin-top: 1rem; color: var(--text-secondary); }
.auth-link a { color: var(--accent); }

/* Cards */
.card {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 1rem; }

/* Badge */
.badge {
    display: inline-block; padding: 0.25rem 0.75rem; border-radius: 20px;
    font-size: 0.8rem; font-weight: 500; background: var(--accent); color: white;
}

/* Pricing */
.pricing { text-align: center; margin-bottom: 3.5rem; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.price-card {
    background: var(--bg-card); border-radius: var(--radius); padding: 2rem;
    border: 1px solid var(--border); transition: transform 0.2s; position: relative;
}
.price-card:hover { transform: translateY(-4px); }
.price-card.featured { border-color: var(--accent); position: relative; }
.price-card h4 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.price { font-size: 2rem; font-weight: 700; margin: 1rem 0; }
.price span { font-size: 1rem; font-weight: 400; color: var(--text-secondary); }
.price-card ul { list-style: none; margin: 1.5rem 0; text-align: left; }
.price-card li { padding: 0.4rem 0; color: var(--text-secondary); }
.price-card li::before { content: "check "; color: var(--success); }
.price-card button {
    width: 100%; padding: 0.75rem; background: var(--accent); color: white;
    border: none; border-radius: 8px; cursor: pointer; font-weight: 500;
}

/* Impersonation banner */
.impersonation-banner {
    background: var(--warning); color: #000; padding: 0.75rem 1.5rem;
    text-align: center; font-weight: 500; border-radius: var(--radius); margin-bottom: 1rem;
}
.impersonation-banner button {
    margin-left: 1rem; padding: 0.25rem 0.75rem; background: #000; color: var(--warning);
    border: none; border-radius: 6px; cursor: pointer;
}

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.stat-card {
    background: var(--bg-secondary); border-radius: var(--radius); padding: 1.5rem;
    text-align: center; border: 1px solid var(--border);
}
.stat-card h4 { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 0.5rem; }
.stat-card span { font-size: 1.8rem; font-weight: 700; }

/* Chat */
.chat-container { max-width: 800px; margin: 0 auto; height: calc(100vh - 200px); display: flex; flex-direction: column; }
.chat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; background: var(--bg-secondary); border-radius: var(--radius); }
.chat-input { display: flex; gap: 0.5rem; margin-top: 1rem; }
.chat-input input {
    flex: 1; padding: 0.75rem; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text-primary); font-size: 1rem;
}
.chat-input button {
    padding: 0.75rem 1.5rem; background: var(--accent); color: white;
    border: none; border-radius: 8px; cursor: pointer;
}

/* Admin */
.admin-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.tab {
    padding: 0.5rem 1rem; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text-secondary); cursor: pointer;
}
.tab.active { background: var(--accent); color: white; border-color: var(--accent); }
.admin-panel { background: var(--bg-card); border-radius: var(--radius); padding: 1.5rem; }
.admin-search { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.admin-search input, .admin-search select {
    padding: 0.5rem; background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-primary);
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-secondary); font-weight: 500; }

/* Toast */
#toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; }
.toast {
    background: var(--bg-card); color: var(--text-primary); padding: 1rem 1.5rem;
    border-radius: var(--radius); margin-bottom: 0.5rem; box-shadow: var(--shadow);
    border-left: 4px solid var(--accent); animation: slideIn 0.3s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Chat messages */
.chat-msg { padding: 0.75rem 1rem; margin-bottom: 0.5rem; border-radius: 8px; line-height: 1.6; animation: fadeIn 0.3s ease; }
.chat-msg.user { background: var(--bg-card); border: 1px solid var(--border); }
.chat-msg.assistant { background: rgba(99, 102, 241, 0.08); border: 1px solid rgba(99, 102, 241, 0.15); }
.chat-msg strong { color: var(--accent); margin-right: 0.3rem; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Typing indicator */
.typing-indicator { color: var(--text-secondary); font-style: italic; }
.typing-dots span {
    animation: typingBounce 1.4s infinite ease-in-out;
    display: inline-block; font-weight: 700; font-size: 1.2em; color: var(--accent);
}
.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Disabled chat input while loading */
.chat-input input:disabled { opacity: 0.6; cursor: wait; }
.chat-input button:disabled { opacity: 0.5; cursor: wait; }

/* Responsive */
@media (max-width: 768px) {
    .hero h2 { font-size: 1.6rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-cta { flex-direction: column; align-items: stretch; }
    .hero-stats { flex-direction: column; gap: 1rem; }
    .features-grid { grid-template-columns: 1fr; }
    .steps-grid { grid-template-columns: 1fr; }
    .examples-showcase { flex-direction: column; align-items: stretch; }
    .pricing-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    nav { padding: 0.75rem 1rem; }
    .section { padding: 1rem; }
    .section-block { padding: 2rem 1rem; }
    .chat-layout { flex-direction: column; }
    .sessions-sidebar { width: 100%; max-height: 120px; overflow-y: auto; }
    .examples-grid { grid-template-columns: 1fr; }
}

/* Chat layout with sessions sidebar */
.chat-layout { display: flex; flex: 1; overflow: hidden; gap: 0; }
.sessions-sidebar { width: 220px; background: var(--bg-secondary); border-right: 1px solid var(--border); overflow-y: auto; padding: 0.5rem; }
.session-item { padding: 0.5rem 0.75rem; border-radius: 8px; cursor: pointer; margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.session-item:hover, .session-item.active { background: var(--bg-card); }
.session-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.session-count { color: var(--text-secondary); font-size: 0.75rem; margin-left: 0.5rem; flex-shrink: 0; }
.chat-main { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.chat-header-actions { display: flex; gap: 0.5rem; }
.btn-new-session { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 0.4rem 0.8rem; cursor: pointer; font-size: 0.85rem; }
.btn-new-session:hover { background: var(--accent-hover); }

/* Quick actions & examples */
.quick-actions { margin-bottom: 1.5rem; }
.examples-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.example-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; cursor: pointer; transition: border-color 0.2s; }
.example-card:hover { border-color: var(--accent); }
.example-card strong { color: var(--accent); display: block; margin-bottom: 0.25rem; }
.example-card p { color: var(--text-secondary); font-size: 0.85rem; }
