/* =======================================================================
   Converzap — design system
   ======================================================================= */

:root {
    /* cores */
    --bg:           #FAFBFC;
    --surface:      #FFFFFF;
    --surface-2:    #F4F5F7;
    --border:       #E5E7EB;
    --border-strong:#D1D5DB;
    --text:         #111827;
    --text-muted:   #6B7280;
    --text-subtle:  #9CA3AF;
    --primary:      #6366F1;
    --primary-hover:#4F46E5;
    --primary-soft: #EEF2FF;
    --accent:       #8B5CF6;
    --success:      #10B981;
    --success-soft: #ECFDF5;
    --warning:      #F59E0B;
    --warning-soft: #FFFBEB;
    --danger:       #EF4444;
    --danger-soft:  #FEF2F2;
    --info:         #3B82F6;
    --info-soft:    #EFF6FF;

    /* espaçamento */
    --sb-w:         60px;     /* sidebar width */
    --tb-h:         60px;     /* topbar height */

    /* radii */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;

    /* shadows */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);
}

/* =====================================================================
   Reset / base
   ===================================================================== */

* { box-sizing: border-box; }

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-feature-settings: 'cv11', 'ss01';
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

/* Bootstrap overrides */
.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: var(--primary-hover);
    --bs-btn-active-border-color: var(--primary-hover);
    --bs-btn-disabled-bg: var(--primary);
    --bs-btn-disabled-border-color: var(--primary);
    font-weight: 500;
}

.btn { border-radius: var(--r-sm); }
.form-control, .form-select {
    border-color: var(--border-strong);
    border-radius: var(--r-sm);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
}

/* =====================================================================
   AUTH (login)
   ===================================================================== */

.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, .08), transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(139, 92, 246, .06), transparent 50%),
        var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-shell {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-app-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}

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

.auth-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: .25rem;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: .9375rem;
    margin: 0;
}

.auth-form .form-floating > label {
    color: var(--text-subtle);
    font-size: .875rem;
}

.auth-divider {
    margin: 1.5rem 0;
    text-align: center;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    inset: 50% 0 0 0;
    border-top: 1px solid var(--border);
}

.auth-divider span {
    background: var(--surface);
    padding: 0 .75rem;
    color: var(--text-subtle);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    position: relative;
}

.auth-footer {
    margin-top: 1.5rem;
    color: var(--text-subtle);
    font-size: .8125rem;
    text-align: center;
}

/* =====================================================================
   APP LAYOUT
   ===================================================================== */

.app-body {
    background: var(--bg);
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sb-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--tb-h);
    border-bottom: 1px solid var(--border);
    width: 100%;
}

.sidebar-logo:hover { text-decoration: none; }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding: .75rem 0;
    flex: 1;
    width: 100%;
}

.sidebar-bottom {
    padding: .75rem 0 1rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    border-top: 1px solid var(--border);
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    color: var(--text-subtle);
    font-size: 1.125rem;
    transition: background .15s, color .15s;
    text-decoration: none;
    position: relative;
}

.sidebar-link:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

/* Main */
.app-main {
    margin-left: var(--sb-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    height: var(--tb-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.app-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
}

.avatar-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-size: .8125rem;
    font-weight: 600;
}

/* =====================================================================
   STAT CARDS
   ===================================================================== */

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon-indigo  { background: var(--primary-soft); color: var(--primary); }
.stat-icon-violet  { background: #F5F3FF; color: var(--accent); }
.stat-icon-emerald { background: var(--success-soft); color: var(--success); }
.stat-icon-amber   { background: var(--warning-soft); color: var(--warning); }

.stat-body { min-width: 0; flex: 1; }
.stat-label {
    color: var(--text-muted);
    font-size: .8125rem;
    margin: 0 0 .25rem;
    font-weight: 500;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.02em;
    line-height: 1;
}

/* =====================================================================
   CHECKLIST (próximos passos no dashboard)
   ===================================================================== */

.checklist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.checklist-item {
    display: flex;
    gap: .75rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--border);
}

.checklist-item:last-child { border-bottom: none; }

.checklist-item i {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.checklist-item.done i { color: var(--success); }
.checklist-item.pending i { color: var(--text-subtle); }

.checklist-item strong {
    display: block;
    font-weight: 600;
    font-size: .9375rem;
    margin-bottom: .125rem;
}

.checklist-item.done strong { color: var(--text); }
.checklist-item.pending strong { color: var(--text-muted); }

/* =====================================================================
   STATUS ROWS
   ===================================================================== */

.status-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .625rem 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot-up   { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-dot-down { background: var(--danger);  box-shadow: 0 0 0 3px var(--danger-soft); }

/* =====================================================================
   FLASH
   ===================================================================== */

.flash-stack {
    margin-bottom: 1rem;
}

.flash-stack .alert {
    border-radius: var(--r-sm);
    border: 1px solid;
    box-shadow: var(--shadow-sm);
}

.alert-success { background: var(--success-soft); border-color: rgba(16, 185, 129, .25); color: #065f46; }
.alert-danger  { background: var(--danger-soft);  border-color: rgba(239, 68, 68, .25);  color: #991b1b; }
.alert-warning { background: var(--warning-soft); border-color: rgba(245, 158, 11, .25); color: #92400e; }
.alert-info    { background: var(--info-soft);    border-color: rgba(59, 130, 246, .25); color: #1e40af; }

/* =====================================================================
   ERROR PAGES
   ===================================================================== */

.error-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 50% 0%, rgba(99, 102, 241, .05), transparent 40%),
        var(--bg);
    padding: 2rem 1rem;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text);
}

.error-shell {
    text-align: center;
    max-width: 480px;
}

.error-code {
    font-size: 5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 1rem;
    letter-spacing: -0.04em;
}

.error-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: .5rem;
}

.error-text {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.error-debug {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 1rem;
    text-align: left;
    font-size: .8125rem;
    color: var(--danger);
    overflow-x: auto;
    margin-top: 1.5rem;
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */

@media (max-width: 768px) {
    .app-content { padding: 1rem; }
    .auth-card { padding: 2rem 1.5rem; }
}
/* =======================================================================
   Sprint 1 — Adições para página de Números
   Adicionar ao final de public/assets/css/app.css
   ======================================================================= */

/* ─── Avatar do número (ícone WhatsApp circular) ────────────────────── */
.number-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1rem;
    flex-shrink: 0;
}
.number-avatar-success   { background: var(--success-soft); color: var(--success); }
.number-avatar-warning   { background: var(--warning-soft); color: var(--warning); }
.number-avatar-info      { background: var(--info-soft); color: var(--info); }
.number-avatar-danger    { background: var(--danger-soft); color: var(--danger); }
.number-avatar-secondary { background: var(--surface-2); color: var(--text-muted); }

/* ─── Badges "soft" (background suave + texto na cor sólida) ───────── */
.bg-success-soft   { background: var(--success-soft) !important; }
.bg-warning-soft   { background: var(--warning-soft) !important; }
.bg-info-soft      { background: var(--info-soft) !important; }
.bg-danger-soft    { background: var(--danger-soft) !important; }
.bg-secondary-soft { background: var(--surface-2) !important; }

.text-success   { color: var(--success) !important; }
.text-warning   { color: var(--warning) !important; }
.text-info      { color: var(--info) !important; }
.text-danger    { color: var(--danger) !important; }
.text-secondary { color: var(--text-muted) !important; }

.state-badge {
    font-weight: 500;
    font-size: .75rem;
    padding: .35rem .65rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

/* ─── Tabela de números ─────────────────────────────────────────────── */
.table thead th {
    text-transform: uppercase;
    font-size: .7rem;
    font-weight: 600;
    color: var(--text-subtle);
    letter-spacing: .04em;
    border-bottom-color: var(--border);
    background: var(--surface-2);
    padding: .75rem 1rem;
}
.table tbody td {
    padding: .85rem 1rem;
    border-bottom-color: var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td {
    border-bottom: none;
}
.table-hover tbody tr:hover {
    background: var(--surface-2);
}

.row-actions .btn {
    padding: .3rem .65rem;
    font-size: .8125rem;
}

/* ─── Modal QR Code ─────────────────────────────────────────────────── */
.qr-state {
    padding: 1.5rem 0;
}

.qr-frame {
    display: inline-block;
    padding: 1rem;
    background: white;
    border-radius: var(--r-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.qr-frame img {
    display: block;
    width: 280px;
    height: 280px;
}

.success-circle, .error-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin-top: 1rem;
}
.success-circle {
    background: var(--success);
    box-shadow: 0 0 0 8px var(--success-soft);
}
.error-circle {
    background: var(--danger);
    box-shadow: 0 0 0 8px var(--danger-soft);
}

#qrInstruction {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* ─── Modal genérico ────────────────────────────────────────────────── */
.modal-content {
    border: none;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
}
.modal-header {
    border-bottom-color: var(--border);
    padding: 1rem 1.25rem;
}
.modal-footer {
    border-top-color: var(--border);
    padding: .85rem 1.25rem;
}
.modal-title {
    font-weight: 600;
    font-size: 1rem;
}
