/* TacoBot Customer Platform — Styles
   Dark theme matching the admin console aesthetic */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-card: #1c2128;
    --border: #30363d;
    --border-focus: #58a6ff;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-green: #3fb950;
    --accent-red: #f85149;
    --accent-blue: #58a6ff;
    --accent-orange: #d29922;
    --accent-purple: #bc8cff;
    --accent-teal: #39d353;
    --shadow: 0 2px 8px rgba(0,0,0,.3);
    --radius: 8px;
    --radius-lg: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Utility ──────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ── Login / Register ─────────────────────────────────────── */
.auth-overlay {
    position: fixed; inset: 0;
    background: var(--bg-primary);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 400px;
    text-align: center;
}
.auth-logo { font-size: 30px; margin-bottom: 4px; }
.auth-title { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.auth-subtitle { color: var(--text-secondary); font-size: 13px; margin-bottom: 24px; }
.auth-error { color: var(--accent-red); font-size: 12px; min-height: 18px; margin: 6px 0; }
.auth-toggle { font-size: 13px; color: var(--text-secondary); margin-top: 16px; }
.auth-toggle a { cursor: pointer; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; text-align: left; }
.form-group label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px;
}
.form-group input, .form-group select {
    width: 100%; padding: 9px 12px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-primary);
    font-size: 14px; outline: none; transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus { border-color: var(--border-focus); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 18px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-tertiary);
    color: var(--text-primary); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--bg-secondary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-green  { background: #238636; border-color: #2ea043; }
.btn-green:hover { background: #2ea043; }
.btn-blue   { background: #1f6feb; border-color: #388bfd; }
.btn-blue:hover { background: #388bfd; }
.btn-orange { background: #9e6a03; border-color: #d29922; }
.btn-orange:hover { background: #bb8009; }
.btn-red    { background: #7d1a1a; border-color: #da3633; }
.btn-red:hover { background: #a32626; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; }

/* ── Header ───────────────────────────────────────────────── */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex; align-items: center; justify-content: space-between;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-logo { font-size: 18px; font-weight: 700; }
.header-logo span { color: var(--accent-orange); }
.header-nav { display: flex; gap: 4px; }
.header-nav button {
    background: none; border: none; color: var(--text-secondary);
    padding: 6px 14px; border-radius: var(--radius); font-size: 13px;
    cursor: pointer; font-weight: 500; transition: all .15s;
}
.header-nav button:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.header-nav button.active { color: var(--text-primary); background: var(--bg-tertiary); }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-user { font-size: 13px; color: var(--text-secondary); }

/* ── Main Layout ──────────────────────────────────────────── */
.main { max-width: 960px; margin: 0 auto; padding: 24px; }
.page { display: none; }
.page.active { display: block; }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.card-title { font-size: 15px; font-weight: 600; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px;
}
.badge-green  { background: rgba(63,185,80,.15); color: var(--accent-green); }
.badge-orange { background: rgba(210,153,34,.15); color: var(--accent-orange); }
.badge-red    { background: rgba(248,81,73,.15);  color: var(--accent-red);   }
.badge-blue   { background: rgba(88,166,255,.15); color: var(--accent-blue);  }
.badge-purple { background: rgba(188,140,255,.15); color: var(--accent-purple); }
.badge-muted  { background: var(--bg-tertiary); color: var(--text-secondary); }

/* ── Pricing Grid ─────────────────────────────────────────── */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px; margin-top: 16px;
}
.plan-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px;
    display: flex; flex-direction: column; transition: border-color .2s;
    position: relative;
}
.plan-card:hover { border-color: var(--accent-blue); }
.plan-card.current { border-color: var(--accent-green); }
.plan-card.current::after {
    content: "CURRENT"; position: absolute; top: 12px; right: 12px;
    font-size: 10px; font-weight: 700; color: var(--accent-green);
    background: rgba(63,185,80,.15); padding: 2px 8px; border-radius: 4px;
}
.plan-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.plan-features { list-style: none; margin: 12px 0; flex: 1; }
.plan-features li {
    font-size: 13px; color: var(--text-secondary); padding: 3px 0;
}
.plan-features li::before { content: "✓ "; color: var(--accent-green); font-weight: 700; }
.plan-features li.disabled { text-decoration: line-through; opacity: .5; }
.plan-features li.disabled::before { content: "✗ "; color: var(--accent-red); }

/* ── Usage bar ────────────────────────────────────────────── */
.usage-bar-container {
    background: var(--bg-tertiary); border-radius: 6px;
    height: 10px; overflow: hidden; margin: 8px 0;
}
.usage-bar {
    height: 100%; border-radius: 6px;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    transition: width .4s ease;
}
.usage-bar.warn { background: linear-gradient(90deg, var(--accent-orange), var(--accent-red)); }

/* ── Bot List ─────────────────────────────────────────────── */
.bot-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    transition: background .15s;
}
.bot-row:last-child { border-bottom: none; }
.bot-row:hover { background: rgba(88,166,255,.04); }
.bot-info { display: flex; flex-direction: column; gap: 2px; }
.bot-name { font-size: 14px; font-weight: 600; }
.bot-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 8px; }
.bot-actions { display: flex; gap: 6px; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 2000;
}
.modal {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 28px; width: 440px; max-width: 95vw;
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
    text-align: center; padding: 48px 20px; color: var(--text-secondary);
}
.empty-state .icon { font-size: 36px; margin-bottom: 12px; }

/* ── Toast ────────────────────────────────────────────────── */
.toast-container {
    position: fixed; bottom: 24px; right: 24px; z-index: 9000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 18px;
    font-size: 13px; box-shadow: var(--shadow);
    animation: toastIn .25s ease;
    display: flex; align-items: center; gap: 8px;
}
.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-blue); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
    .auth-card { width: 95vw; padding: 28px 20px; }
    .main { padding: 16px; }
    .pricing-grid { grid-template-columns: 1fr; }
    .help-grid { grid-template-columns: 1fr; }
    .header { padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
    .header-nav button { padding: 4px 10px; font-size: 12px; }
}

/* ── Email Verification Banner ────────────────────────────── */
.verify-banner {
    background: rgba(210, 153, 34, .12);
    border-bottom: 1px solid var(--accent-orange);
    padding: 10px 24px;
}
.verify-banner-content {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--accent-orange);
}

/* ── Help Page ────────────────────────────────────────────── */
.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 8px;
}
.help-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 24px;
}
.help-card-icon {
    font-size: 40px;
    margin-bottom: 12px;
}
.help-coming-soon {
    margin-top: 20px;
}
.help-links {
    list-style: none;
    width: 100%;
    text-align: left;
    margin-top: 12px;
}
.help-links li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.help-links li:last-child {
    border-bottom: none;
}

/* ── Provisioning Spinner / Status ────────────────────────── */
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes checkPop {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.provision-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px;
    text-align: center;
}

.provision-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--accent-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.provision-check {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-green);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    animation: checkPop .4s ease-out;
}
.provision-check::after {
    content: "✓";
    color: #fff;
    font-size: 24px;
    font-weight: 700;
}

.provision-progress-bar {
    width: 200px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin: 12px 0;
}
.provision-progress-bar .bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-orange), var(--accent-blue));
    border-radius: 3px;
    animation: provisionProgress 90s ease-out forwards;
}
@keyframes provisionProgress {
    0% { width: 0%; }
    30% { width: 40%; }
    60% { width: 65%; }
    80% { width: 80%; }
    100% { width: 95%; }
}
