/* Planio Back-office — tema consistente com o Planio (dourado sobre escuro) */

:root {
    --bg: #14141a;
    --bg-card: #1d1d26;
    --border: #2c2c38;
    --text: #eceaf0;
    --text-muted: #9a97a5;
    --gold: #c9a96e;
    --gold-dark: #a8894f;
    --ok: #2ecc71;
    --off: #e05d5d;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Outfit", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
}

/* ── Login ─────────────────────────────────────────────── */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
}

.login-brand { text-align: center; margin-bottom: 24px; }
.login-logo { color: var(--gold); font-size: 22px; }
.login-brand h1 { font-size: 20px; margin: 8px 0 4px; }
.login-brand h1 span { color: var(--gold); font-weight: 600; }
.login-brand p { color: var(--text-muted); font-size: 12px; line-height: 1.6; margin: 0; }

.login-card label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin: 14px 0 6px;
}

.login-card input,
.inline-form input,
.inline-form select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 10px 12px;
    font-size: 14px;
}

.login-card input:focus,
.inline-form input:focus,
.inline-form select:focus {
    outline: none;
    border-color: var(--gold);
}

.login-card button[type="submit"] {
    width: 100%;
    margin-top: 22px;
    background: var(--gold);
    border: none;
    border-radius: 8px;
    color: #16130c;
    font-weight: 700;
    font-size: 14px;
    padding: 12px;
    cursor: pointer;
}

.login-card button[type="submit"]:hover { background: var(--gold-dark); }

.alert-error {
    background: rgba(224, 93, 93, 0.12);
    border: 1px solid rgba(224, 93, 93, 0.4);
    color: #f0a5a5;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 6px;
}

/* ── Layout ────────────────────────────────────────────── */

.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar lateral */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #0f0f13;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: left 0.3s ease;
    z-index: 1000;
}

.sidebar-brand {
    padding: 22px 24px;
    font-size: 18px;
    font-weight: 800;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    display: flex;
    align-items: center;
}

.sidebar-brand .logo-symbol {
    color: var(--gold);
    margin-right: 8px;
    font-size: 20px;
}

.sidebar-brand .sub-brand {
    color: var(--gold);
    font-weight: 400;
    margin-left: 4px;
}

.sidebar-menu {
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 13.5px;
    transition: all 0.2s ease;
}

.menu-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
}

.menu-item.active {
    color: #16130c;
    background: var(--gold);
    font-weight: 600;
}

.menu-item.active i {
    color: #16130c;
}

.menu-item i {
    font-size: 16px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.menu-item:hover i {
    color: var(--text);
}

/* Contador de pedidos de suporte em aberto (tempo real) */
.menu-badge {
    display: none;
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--off);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.menu-badge.show { display: inline-flex; }
.menu-badge--priority { background: var(--gold); color: #16130c; }
.menu-item.active .menu-badge { background: #16130c; color: var(--gold); }

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.version-tag {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    text-align: center;
}

/* Área de Conteúdo Principal */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Previne que tabelas quebrem o flexbox */
}

/* Navbar superior */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(29, 29, 38, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 70px;
}

.navbar-left, .navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.navbar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.navbar-title .breadcrumb-root {
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.8px;
}

.navbar-title .breadcrumb-separator {
    color: var(--border);
    font-size: 12px;
}

.navbar-title .active-title {
    color: var(--text);
    font-weight: 700;
    font-size: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    border-right: 1px solid var(--border);
    padding-right: 16px;
}

.user-avatar {
    font-size: 22px;
    color: var(--gold);
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.user-role {
    font-size: 10.5px;
    color: var(--text-muted);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    padding: 6px 12px;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 32px 60px;
}


.section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 22px;
}

.section h2 { font-size: 16px; margin: 0 0 16px; }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.section-head h2 { margin-bottom: 16px; }

/* ── Stats ─────────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.stat-value { font-size: 24px; font-weight: 700; color: var(--gold); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Tabelas ───────────────────────────────────────────── */

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

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

.data-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.strong { font-weight: 600; }
.form-hint { font-size: 12.5px; margin: -6px 0 14px; }
.muted { color: var(--text-muted); }
.text-end { text-align: right; }
.hidden { display: none !important; }

/* ── Botões e badges ───────────────────────────────────── */

.btn {
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    border: 1px solid transparent;
}

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

.btn-gold { background: var(--gold); color: #16130c; }
.btn-gold:hover { background: var(--gold-dark); }

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.btn-danger {
    background: transparent;
    border-color: rgba(224, 93, 93, 0.4);
    color: #e05d5d;
}
.btn-danger:hover { background: #e05d5d; border-color: #e05d5d; color: #fff; }

.btn-danger-solid { background: #e05d5d; color: #fff; }
.btn-danger-solid:hover { background: #c94b4b; }

.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(201, 169, 110, 0.15);
    color: var(--gold);
}

.badge-gold { background: var(--gold); color: #16130c; }
.badge-muted { background: rgba(154, 151, 165, 0.15); color: var(--text-muted); }
.badge-ok { background: rgba(46, 204, 113, 0.15); color: var(--ok); }
.badge-off { background: rgba(224, 93, 93, 0.15); color: var(--off); }

/* ── Formulários inline ────────────────────────────────── */

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 16px;
}

.inline-form input, .inline-form select { width: auto; flex: 1; min-width: 150px; }
.checkbox-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); white-space: nowrap; }

/* ── Toast ─────────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--gold);
    color: var(--text);
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 13.5px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    max-width: 340px;
    z-index: 100;
}

.toast.show { opacity: 1; }
.toast-error { border-color: var(--off); }

/* ── Responsivo ────────────────────────────────────────── */

@media (max-width: 576px) {
    .topbar { padding: 12px 16px; }
    .container { padding: 20px 12px 48px; }
    .section { padding: 16px 14px; }
    .inline-form input, .inline-form select { min-width: 100%; }
    .data-table td, .data-table th { padding: 8px; font-size: 12.5px; }
}

/* ── Modal customizado ─────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.show { display: flex; animation: modalFade 0.15s ease; }

@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalPop 0.18s ease;
}

@keyframes modalPop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(201, 169, 110, 0.14);
    color: var(--gold);
    font-size: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.modal-icon--danger { background: rgba(224, 93, 93, 0.14); color: #e05d5d; }

.modal-title { font-size: 18px; font-weight: 700; margin: 0 0 10px; color: var(--text); }

.modal-message {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0 0 20px;
}

.modal-message strong { color: var(--text); font-weight: 700; }

.modal-detail {
    display: inline-block;
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.modal-input-wrap { display: none; margin-bottom: 20px; text-align: left; }

.modal-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 11px 14px;
    font-size: 14px;
}

.modal-input:focus { outline: none; border-color: var(--gold); }

.modal-input-error {
    display: block;
    color: #e05d5d;
    font-size: 12px;
    margin-top: 6px;
    min-height: 14px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-actions .btn { flex: 1; max-width: 160px; }

@media (max-width: 480px) {
    .modal-box { padding: 22px 18px; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .btn { max-width: none; }
}

/* ── Custom Switches (Feature Flags) ─────────────────────────── */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border);
    transition: .2s ease;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 4px;
    bottom: 4px;
    background-color: var(--text-muted);
    transition: .2s ease;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--gold);
}

input:checked + .slider:before {
    transform: translateX(22px);
    background-color: #16130c;
}

/* ── Consolas e Visualizadores de Código ──────────────────────── */
.console-container {
    background: #0c0c10;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    overflow: hidden;
    margin-top: 14px;
}

.console-header {
    background: #15151f;
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
}

.console-body {
    padding: 16px;
    max-height: 320px;
    overflow-y: auto;
    color: #a6e22e; /* Verde estilo retro */
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}

.console-body.log-stream {
    color: #eceaf0;
    font-size: 12px;
    max-height: 260px;
}

.log-line {
    margin-bottom: 4px;
}

.log-time { color: var(--text-muted); }
.log-info { color: #2ecc71; }
.log-warn { color: #f1c40f; }
.log-error { color: #e74c3c; }

/* ── Layout de Configurações ───────────────────────────────────── */
.config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
    gap: 16px;
}

.config-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.config-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.config-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 10px 12px;
    font-size: 13.5px;
    box-sizing: border-box;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--gold);
}

/* ── Ajustes de Responsividade (Drawer / Sidebar Mobile) ────────── */
@media (max-width: 992px) {
    .app-layout {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        height: 100vh;
        z-index: 1000;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .navbar {
        padding: 12px 20px;
    }
    
    .container {
        padding: 24px 16px 48px;
    }
}

/* ── Drag & Drop — Reordenação de Categorias ──────────────────── */
#businessTypesTable tr.draggable-row {
    transition: background-color 0.15s ease, border 0.15s ease;
    user-select: none;
}

#businessTypesTable tr.draggable-row.dragging {
    background-color: rgba(201, 169, 110, 0.05) !important;
    opacity: 0.5;
}

#businessTypesTable tr.draggable-row.drag-over {
    border-top: 2px solid var(--gold) !important;
    background-color: rgba(201, 169, 110, 0.1) !important;
}

#businessTypesTable tr.no-drag {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

#businessTypesTable tr.no-drag .bi-grip-vertical {
    display: none !important;
}

