/* ==========================================================================
   WA Connect Dashboard — Dark Palantir Theme
   Tokens: bg-black #000, bg-card #111, accent-teal #0EA5E9
   Fonts: Space Grotesk (headings), Inter (body), IBM Plex Mono (code/data)
   ========================================================================== */

:root {
    --bg-black: #000000;
    --bg-card: #111111;
    --bg-card-hover: #1a1a1a;
    --border: #222222;
    --border-light: #2a2a2a;
    --text-primary: #f0f0f0;
    --text-secondary: #888888;
    --text-muted: #555555;
    --accent: #0EA5E9;
    --accent-hover: #38bdf8;
    --accent-dim: rgba(14, 165, 233, 0.15);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #eab308;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Consolas', monospace;
    --radius: 8px;
    --radius-lg: 12px;
}

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

html { font-size: 15px; }

body {
    background: var(--bg-black);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
}

/* ---------- Navigation ---------- */
.nav-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
}

.nav-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.brand-icon { color: var(--accent); font-size: 0.6rem; }

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

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.87rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}

.nav-link:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.nav-link.active { color: var(--accent); background: var(--accent-dim); }
.nav-logout { color: var(--text-muted); margin-left: 0.5rem; }
.nav-logout:hover { color: var(--danger); }

.status-pill {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.25rem 0.65rem;
    border-radius: 50px;
    margin-left: 0.5rem;
    background: var(--text-muted);
    color: var(--bg-black);
}

/* ---------- Main content ---------- */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

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

.page-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-desc {
    color: var(--text-secondary);
    font-size: 0.87rem;
    margin-top: 0.25rem;
}

/* ---------- Grid ---------- */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }

@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body { padding: 1.25rem; }

/* ---------- Status ---------- */
.status-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-badge {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.3rem 0.75rem;
    border-radius: 50px;
}

.status-connected    { background: rgba(34, 197, 94, 0.15); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.3); }
.status-qr_pending   { background: rgba(234, 179, 8, 0.15); color: var(--warning); border: 1px solid rgba(234, 179, 8, 0.3); }
.status-disconnected { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }

.phone-number {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 0.87rem;
}

/* ---------- QR Box ---------- */
.qr-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    background: var(--bg-black);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius);
}

.qr-box img { max-width: 260px; border-radius: var(--radius); }

.qr-placeholder {
    text-align: center;
    color: var(--text-muted);
}

.qr-placeholder svg { margin-bottom: 0.75rem; opacity: 0.4; }
.qr-placeholder p { margin: 0.25rem 0; font-size: 0.9rem; }
.qr-placeholder small { font-size: 0.78rem; }

.qr-connected {
    text-align: center;
    color: var(--success);
    font-weight: 600;
}

/* ---------- Data table ---------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-card-hover); }

.event-tag {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    background: var(--accent-dim);
    color: var(--accent);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-size: 0.87rem;
    font-weight: 600;
    padding: 0.55rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.25);
}

.btn-danger-outline {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger-outline:hover { background: rgba(239, 68, 68, 0.1); }

.btn-sm { font-size: 0.8rem; padding: 0.35rem 0.9rem; }

.w-full { width: 100%; }

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

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--bg-black);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.87rem;
    transition: border-color 0.15s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder { color: var(--text-muted); }

textarea.form-input { resize: vertical; min-height: 100px; }

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* ---------- Alerts ---------- */
.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* ---------- Utility ---------- */
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1.25rem; }

/* ---------- Login ---------- */
.login-body {
    background: var(--bg-black);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.login-header { text-align: center; margin-bottom: 1.5rem; }

.login-brand {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.87rem;
    margin-top: 0.25rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.25rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ---------- Footer ---------- */
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
}

.footer-text {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ---------- Toast ---------- */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--accent);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
