/* ============================================================
   assets/css/style.css — Sender UI
   Paleta: Z-API inspired — light mode, WhatsApp green accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Variáveis ──────────────────────────────────────────────── */
:root {
    /* Backgrounds */
    --bg-body:       #f0f4f8;
    --bg-surface:    #ffffff;
    --bg-sidebar:    #0f172a;
    --bg-sidebar-hover: #1e2d45;
    --bg-card:       #ffffff;
    --bg-input:      #f8fafc;

    /* Bordas */
    --border:        #e2e8f0;
    --border-focus:  #25D366;

    /* Accent — verde WhatsApp */
    --accent:        #25D366;
    --accent-dark:   #128C7E;
    --accent-hover:  #1ebe59;
    --accent-light:  #dcfce7;

    /* Alerts */
    --danger:        #ef4444;
    --danger-light:  #fee2e2;
    --warn:          #f59e0b;
    --warn-light:    #fef3c7;
    --info:          #3b82f6;
    --info-light:    #dbeafe;

    /* Texto */
    --text-primary:   #0f172a;
    --text-secondary: #64748b;
    --text-muted:     #94a3b8;
    --text-on-accent: #ffffff;
    --text-sidebar:   #cbd5e1;
    --text-sidebar-muted: #64748b;

    /* Raios e sombras */
    --radius:         8px;
    --radius-lg:      12px;
    --radius-xl:      16px;
    --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow:         0 4px 16px rgba(0,0,0,.10);
    --shadow-lg:      0 8px 32px rgba(0,0,0,.12);

    /* Layout */
    --sidebar-w:      240px;
    --topbar-h:       56px;
}

/* ── Reset / Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-dark); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent); }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Layout principal ───────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s ease;
    box-shadow: 2px 0 16px rgba(0,0,0,.15);
}

.sidebar-brand {
    padding: 20px 16px 18px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand img.brand-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.sidebar-brand .brand-dot {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; font-weight: 800; color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37,211,102,.35);
}

.sidebar-brand .brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.01em;
}

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-section {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-sidebar-muted);
    padding: 14px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    color: var(--text-sidebar);
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s, color .15s;
    cursor: pointer;
    margin-bottom: 2px;
    text-decoration: none;
}

.nav-item:hover { background: var(--bg-sidebar-hover); color: #fff; }
.nav-item.active {
    background: rgba(37,211,102,.15);
    color: var(--accent);
    border-left: 3px solid var(--accent);
    padding-left: 9px;
}
.nav-item .nav-icon { width: 18px; text-align: center; font-size: .95rem; flex-shrink: 0; }

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,.07);
}

.user-badge {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: rgba(255,255,255,.06);
    margin-bottom: 6px;
}

.user-badge .avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; font-weight: 700; color: #fff;
    flex-shrink: 0;
}

.user-badge .user-name { font-size: .82rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-badge .user-role { font-size: .7rem; color: var(--text-sidebar-muted); }

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 24px; gap: 16px;
    position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-title { font-size: .95rem; font-weight: 600; color: var(--text-primary); flex: 1; }

/* ── Conteúdo principal ─────────────────────────────────────── */
.app-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.page-content { padding: 24px; flex: 1; }

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

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #fafbfc;
}

.card-title { font-size: .9rem; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: #fafbfc; }

/* ── Stats cards ─────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px; margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex; flex-direction: column; gap: 8px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}
.stat-icon.green  { background: var(--accent-light);   color: var(--accent-dark); }
.stat-icon.blue   { background: var(--info-light);     color: var(--info); }
.stat-icon.red    { background: var(--danger-light);   color: var(--danger); }
.stat-icon.yellow { background: var(--warn-light);     color: var(--warn); }

.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: .76rem; color: var(--text-muted); font-weight: 500; }

/* ── Botões ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 7px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: inherit; font-size: .875rem; font-weight: 600;
    cursor: pointer; transition: all .15s; text-decoration: none;
    white-space: nowrap; line-height: 1.4;
}
.btn:active { transform: scale(.97); }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(37,211,102,.25); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; box-shadow: 0 4px 16px rgba(37,211,102,.35); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-secondary { background: var(--bg-body); border-color: var(--border); color: var(--text-secondary); }
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }

.btn-outline { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn-outline:hover { background: var(--bg-body); color: var(--text-primary); border-color: #cbd5e1; }

.btn-sm  { padding: 4px 10px; font-size: .8rem; }
.btn-lg  { padding: 11px 24px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ── Formulários ─────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block; font-size: .82rem; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit; font-size: .875rem;
    padding: 9px 12px; outline: none;
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,211,102,.12);
    background: #fff;
}

.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint  { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: 4px; }

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Tabelas ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }

.table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left; white-space: nowrap;
}

.table td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
    vertical-align: middle;
}

.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .7rem; font-weight: 700;
    text-transform: lowercase;
}

.badge-success  { background: var(--accent-light);  color: #15803d; }
.badge-danger   { background: var(--danger-light);  color: #b91c1c; }
.badge-warning  { background: var(--warn-light);    color: #b45309; }
.badge-info     { background: var(--info-light);    color: #1d4ed8; }
.badge-secondary{ background: #f1f5f9; color: var(--text-secondary); border: 1px solid var(--border); }
.badge-dark     { background: #1e293b; color: #fff; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: .875rem;
    display: flex; align-items: flex-start; gap: 10px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-success { background: var(--accent-light); border-color: #86efac; color: #15803d; }
.alert-danger  { background: var(--danger-light);  border-color: #fca5a5; color: #b91c1c; }
.alert-warning { background: var(--warn-light);    border-color: #fcd34d; color: #92400e; }
.alert-info    { background: var(--info-light);    border-color: #93c5fd; color: #1e40af; }

/* ── Paginação ───────────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; padding: 8px 0; }

.page-link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; padding: 0 8px;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-secondary);
    font-size: .82rem; cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.page-link:hover { background: var(--bg-body); color: var(--text-primary); }
.page-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Filtros / Toolbar ───────────────────────────────────────── */
.page-toolbar {
    display: flex; gap: 12px; align-items: center;
    flex-wrap: wrap; margin-bottom: 20px;
}
.page-toolbar .search-box { flex: 1; min-width: 220px; position: relative; }
.page-toolbar .search-box input { width: 100%; padding-left: 34px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .85rem; }

/* ── AUTH — Login / Cadastro ────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    background: var(--bg-body);
}

/* Painel esquerdo — decorativo */
.auth-panel {
    flex: 1;
    background: linear-gradient(160deg, #0f172a 0%, #1a2e44 60%, #0e2a1f 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 48px;
    position: relative;
    overflow: hidden;
    min-height: 100vh;
}

.auth-panel::before {
    content: '';
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(37,211,102,.18) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 20%, rgba(18,140,126,.15) 0%, transparent 50%);
}

.auth-panel-inner {
    position: relative;
    z-index: 1;
    max-width: 380px;
    text-align: center;
}

.auth-panel-logo {
    margin-bottom: 32px;
}

.auth-panel-logo img {
    height: 52px;
    width: auto;
    filter: brightness(0) invert(1);
    object-fit: contain;
}

.auth-panel-logo .logo-fallback {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.6rem; font-weight: 900; color: #fff;
    margin-bottom: 12px;
    box-shadow: 0 8px 32px rgba(37,211,102,.35);
}

.auth-panel h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 12px;
}

.auth-panel p {
    font-size: .9rem;
    color: rgba(255,255,255,.6);
    line-height: 1.7;
}

/* Padrão decorativo de bolhas */
.auth-bubbles {
    position: absolute;
    inset: 0; overflow: hidden; pointer-events: none;
}

.auth-bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(37,211,102,.08);
    border: 1px solid rgba(37,211,102,.12);
}

.auth-bubble:nth-child(1) { width: 280px; height: 280px; top: -80px; right: -80px; }
.auth-bubble:nth-child(2) { width: 180px; height: 180px; bottom: 60px; left: -60px; }
.auth-bubble:nth-child(3) { width: 100px; height: 100px; bottom: 200px; right: 40px; }

/* ── Ícones de feature no painel ─────────────────────────────── */
.auth-features {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 36px;
    text-align: left;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-feature-icon {
    width: 36px; height: 36px;
    background: rgba(37,211,102,.15);
    border: 1px solid rgba(37,211,102,.2);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
}

.auth-feature-text {
    font-size: .82rem;
    color: rgba(255,255,255,.7);
    line-height: 1.4;
}

.auth-feature-text strong { color: rgba(255,255,255,.95); }

/* Painel direito — formulário */
.auth-form-side {
    width: 460px;
    flex-shrink: 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    box-shadow: -4px 0 32px rgba(0,0,0,.08);
}

.auth-form-wrap { width: 100%; max-width: 360px; }

.auth-form-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-form-logo img {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.auth-form-logo .logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -.02em;
}

.auth-form-logo .logo-text span { color: var(--accent); }

.auth-form-logo p {
    font-size: .82rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.auth-form-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -.01em;
}

.auth-form-subtitle {
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: 28px;
}

/* Formulário */
.auth-form-wrap .form-label { color: var(--text-secondary); font-size: .8rem; }
.auth-form-wrap .form-control {
    background: var(--bg-input);
    border-color: #e2e8f0;
    font-size: .9rem;
    padding: 10px 14px;
    border-radius: 8px;
}
.auth-form-wrap .form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,211,102,.12); }

.auth-submit {
    background: var(--accent);
    color: #fff;
    border: none;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, box-shadow .15s, transform .1s;
    margin-top: 8px;
    box-shadow: 0 4px 16px rgba(37,211,102,.3);
    letter-spacing: .01em;
}

.auth-submit:hover { background: var(--accent-hover); box-shadow: 0 6px 24px rgba(37,211,102,.4); }
.auth-submit:active { transform: scale(.98); }

.auth-footer-link {
    text-align: center;
    font-size: .83rem;
    color: var(--text-muted);
    margin-top: 20px;
}

.auth-footer-link a { color: var(--accent-dark); font-weight: 600; }
.auth-footer-link a:hover { color: var(--accent); }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--text-muted);
    font-size: .78rem;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

@media (max-width: 900px) { .auth-panel { display: none; } }
@media (max-width: 600px) {
    .auth-form-side { width: 100%; padding: 32px 24px; box-shadow: none; }
}

/* ── Progress bar ────────────────────────────────────────────── */
.progress { height: 6px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s ease; }
.progress-bar.blue { background: var(--info); }
.progress-bar.red  { background: var(--danger); }

/* ── Utilitários ─────────────────────────────────────────────── */
.d-flex       { display: flex; }
.gap-2        { gap: 8px; }
.gap-3        { gap: 12px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1       { flex: 1; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); font-size: .82rem; }
.fw-600       { font-weight: 600; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

/* ── Mobile ──────────────────────────────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99; }
.sidebar-overlay.show { display: block; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .page-content { padding: 16px; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    #menuBtn { display: inline-flex !important; }
}

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

/* ── Animações ───────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn .22s ease; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.pulse { animation: pulse 1.4s infinite; }

/* ── Compat: classes antigas escuras (remapeadas) ───────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-body); padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px 32px; box-shadow: var(--shadow); }
