/* ================================================
   WaFlow Painel — estilos globais
   ================================================ */

:root {
    --bg:         #0f1117;
    --bg2:        #1a1d27;
    --bg3:        #222636;
    --border:     #2e3348;
    --accent:     #25d366;
    --accent2:    #128c7e;
    --danger:     #e74c3c;
    --warning:    #f39c12;
    --info:       #3498db;
    --text:       #e8eaf0;
    --text2:      #8b92aa;
    --radius:     10px;
    --shadow:     0 4px 24px rgba(0,0,0,.4);
}

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

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 240px;
    height: 100vh;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    padding: 24px 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 24px 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo img { width: 36px; height: 36px; border-radius: 8px; }
.sidebar-logo span { font-size: 18px; font-weight: 700; color: var(--accent); }

.sidebar-nav { flex: 1; padding: 16px 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--text2);
    cursor: pointer;
    transition: all .2s;
    border-left: 3px solid transparent;
    font-size: 14px;
}

.nav-item:hover, .nav-item.active {
    color: var(--text);
    background: var(--bg3);
    border-left-color: var(--accent);
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text2);
}

/* ---- MAIN CONTENT ---- */
.main {
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 64px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar h1 { font-size: 18px; font-weight: 600; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.content { padding: 32px; flex: 1; }

/* ---- CARDS ESTATÍSTICA ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: border-color .2s;
}

.stat-card:hover { border-color: var(--accent); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.green  { background: rgba(37,211,102,.15); }
.stat-icon.blue   { background: rgba(52,152,219,.15); }
.stat-icon.orange { background: rgba(243,156,18,.15); }
.stat-icon.red    { background: rgba(231,76,60,.15); }

.stat-info h3 { font-size: 28px; font-weight: 700; }
.stat-info p  { color: var(--text2); font-size: 13px; margin-top: 2px; }

/* ---- TABELA ---- */
.table-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.table-card-header h2 { font-size: 15px; font-weight: 600; }

.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text2);
    background: var(--bg3);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.03); }

/* ---- BADGES ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge-green  { background: rgba(37,211,102,.15); color: #25d366; }
.badge-red    { background: rgba(231,76,60,.15);  color: #e74c3c; }
.badge-orange { background: rgba(243,156,18,.15); color: #f39c12; }
.badge-blue   { background: rgba(52,152,219,.15); color: #3498db; }
.badge-gray   { background: rgba(139,146,170,.15);color: #8b92aa; }

/* ---- BOTÕES ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .2s;
    text-decoration: none;
}

.btn-primary  { background: var(--accent); color: #000; }
.btn-primary:hover { background: #20ba5a; text-decoration: none; color: #000; }

.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); text-decoration: none; }

.btn-danger  { background: rgba(231,76,60,.15); color: var(--danger); border: 1px solid rgba(231,76,60,.3); }
.btn-danger:hover { background: rgba(231,76,60,.25); text-decoration: none; }

.btn-sm { padding: 4px 12px; font-size: 12px; }

/* ---- FORMULÁRIOS ---- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text2); font-weight: 500; }

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    transition: border-color .2s;
    outline: none;
}

.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text2); }

select.form-control { cursor: pointer; }

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

/* ---- MODAL ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.modal-overlay.show { opacity: 1; pointer-events: all; }

.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow);
    transform: translateY(-16px);
    transition: transform .2s;
}

.modal-overlay.show .modal { transform: translateY(0); }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 { font-size: 17px; }

.modal-close {
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    transition: .2s;
}
.modal-close:hover { background: var(--bg3); color: var(--text); }

/* ---- ALERTA/TOAST ---- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    min-width: 280px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn .3s ease;
    font-size: 13px;
}

.toast.success { border-left: 3px solid var(--accent); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }

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

/* ---- CHIP features ---- */
.feature-chip {
    display: inline-flex;
    align-items: center;
    background: rgba(37,211,102,.1);
    color: var(--accent);
    border: 1px solid rgba(37,211,102,.25);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    margin: 2px;
}

/* ---- SEARCH ---- */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 36px;
}

.search-box svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text2);
    width: 16px; height: 16px;
}

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

.login-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
    text-align: center;
}

.login-card .logo { font-size: 48px; margin-bottom: 8px; }
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-card .subtitle { color: var(--text2); margin-bottom: 32px; font-size: 13px; }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    text-align: left;
}

.alert-error   { background: rgba(231,76,60,.15); color: #e74c3c; border: 1px solid rgba(231,76,60,.3); }
.alert-success { background: rgba(37,211,102,.15); color: #25d366; border: 1px solid rgba(37,211,102,.3); }
.alert-info    { background: rgba(52,152,219,.15); color: #3498db; border: 1px solid rgba(52,152,219,.3); }

/* ---- PAGINAÇÃO ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.page-btn {
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text2);
    cursor: pointer;
    font-size: 13px;
    transition: .2s;
}

.page-btn:hover, .page-btn.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* ---- CHAVE LICENÇA ---- */
.license-key {
    font-family: 'Consolas', 'Courier New', monospace;
    letter-spacing: .1em;
    font-size: 13px;
}

/* ---- RESPONSIVO ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; }
    .form-row { grid-template-columns: 1fr; }
}
