/* =============================================
   SKPlay Gestor - Estilos
   ============================================= */

:root {
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 56px;

    --brand-orange: #ff8a1f;
    --brand-amber: #f2c166;
    --brand-charcoal: #0f1118;
    --brand-ink: #131722;

    --sidebar-bg: #1a1d2e;
    --sidebar-hover: rgba(255,255,255,.07);
    --sidebar-active: rgba(255,138,31,.2);
    --accent: var(--brand-orange);
    --accent2: #6f42c1;

    --body-bg: #f0f2f5;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --border-color: #e3e6f0;
    --text-primary: #23252f;
    --text-muted: #6b7280;
}

[data-theme="dark"] {
    --sidebar-bg: #0f1118;
    --sidebar-hover: rgba(255,255,255,.06);
    --sidebar-active: rgba(255,138,31,.22);
    --body-bg: #0b0d14;
    --surface: #151924;
    --surface-2: #1b2030;
    --border-color: #262c3c;
    --text-primary: #e9edf5;
    --text-muted: #9aa4bf;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform .3s;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
    background: linear-gradient(135deg, #4e73df33, #6f42c133);
}

.sidebar-logo {
    width: 100%;
    max-width: 180px;
    height: auto;
}

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

.sidebar-section {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,.35);
    padding: 14px 20px 4px;
    text-transform: uppercase;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: 13.5px;
    transition: background .15s, color .15s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: var(--accent);
}

.sidebar-link .bi { font-size: 15px; flex-shrink: 0; }

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

/* ---- Main content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    overflow-x: hidden;
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-brand {
    padding-left: 8px;
    padding-right: 8px;
}

body.sidebar-collapsed .sidebar-logo {
    max-width: 52px;
}

body.sidebar-collapsed .sidebar-section {
    padding-left: 0;
    padding-right: 0;
    text-indent: -9999px;
    white-space: nowrap;
    overflow: hidden;
}

body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    gap: 0;
    padding-left: 0;
    padding-right: 0;
    font-size: 0;
}

body.sidebar-collapsed .sidebar-link .bi {
    font-size: 18px;
}

body.sidebar-collapsed .sidebar-link .badge {
    display: none;
}

.topbar {
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.topbar-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.content-area {
    flex: 1;
    padding: 24px;
}

/* ---- Stat cards ---- */
.stat-card {
    border-radius: 12px;
    padding: 20px 20px 16px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.stat-card .stat-icon {
    font-size: 28px;
    opacity: .85;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 12px;
    opacity: .85;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.stat-primary { background: linear-gradient(135deg, #4e73df, #224abe); }
.stat-success { background: linear-gradient(135deg, #1cc88a, #13855c); }
.stat-warning { background: linear-gradient(135deg, #f6c23e, #dda20a); }
.stat-danger  { background: linear-gradient(135deg, #e74a3b, #be2617); }
.stat-info    { background: linear-gradient(135deg, #36b9cc, #258391); }

/* ---- Cards ---- */
.card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    background: var(--surface);
    color: var(--text-primary);
}

.card-header {
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 20px;
    font-weight: 600;
    font-size: 14px;
    border-radius: 10px 10px 0 0 !important;
}

/* ---- Tables ---- */
.table { font-size: 13.5px; color: var(--text-primary); }
.table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    background: var(--surface-2);
}

/* ---- Badge fornecedor ---- */
.badge-fornecedor {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    background: #eef2ff;
    color: #4e73df;
    border: 1px solid #c5d0f8;
}

/* ---- Botões extras ---- */
.btn-xs {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 4px;
}

/* ---- Theme toggle ---- */
.theme-toggle {
    width: 58px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: linear-gradient(135deg, #fefefe, #eceff4);
    position: relative;
    cursor: pointer;
    padding: 3px;
    display: inline-flex;
    align-items: center;
    transition: background .25s, border-color .25s;
}

.theme-toggle .toggle-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #1f1f23;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
    transition: transform .25s ease, background .25s;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

.theme-toggle.is-dark {
    background: linear-gradient(135deg, #1b1f2c, #0f1118);
    border-color: #2c3144;
}
.theme-toggle.is-dark .toggle-thumb {
    transform: translateX(26px);
    background: var(--brand-orange);
    color: #0b0d14;
}
.theme-toggle.is-dark .icon-sun { display: block; }
.theme-toggle.is-dark .icon-moon { display: none; }

/* ---- Dark theme specifics ---- */
[data-theme="dark"] .topbar {
    box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
[data-theme="dark"] .card {
    box-shadow: 0 2px 10px rgba(0,0,0,.45);
}
[data-theme="dark"] .table thead th {
    background: var(--surface-2);
}

/* ---- Breadcrumb ---- */
.breadcrumb { font-size: 13px; }
.breadcrumb-item a { color: var(--accent); text-decoration: none; }
.breadcrumb-item a:hover { text-decoration: underline; }

/* ---- Responsive: esconde sidebar em mobile ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .content-area { padding: 16px; }

    .stat-card .stat-value { font-size: 22px; }
}

/* ---- Scrollbar ---- */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

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

/* ---- Form focus ---- */
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 .2rem rgba(78,115,223,.2);
}

/* ---- Alert customizado ---- */
.alert { border-radius: 8px; font-size: 13.5px; }

/* ---- Progress bar ---- */
.progress { border-radius: 10px; background: #eee; }
.progress-bar { border-radius: 10px; }

/* ---- Input group ---- */
.input-group-text { background: #f8f9fc; border-color: #d1d3e2; }

/* ---- Font monospace para MAC ---- */
.font-monospace { font-family: 'Courier New', monospace; font-size: 12px; }

/* ---- Dropdown busca ---- */
.dropdown-menu { border: 1px solid #e0e0e0; border-radius: 8px; }
.dropdown-item { font-size: 13px; }

/* ---- Botão copiar ---- */
.copy-btn {
    padding: 0;
    border: none;
    background: none;
    color: #999;
    cursor: pointer;
    opacity: 1;
    transition: opacity .2s, color .2s;
    font-size: 11px;
    vertical-align: middle;
    margin-left: 4px;
}
.copy-btn:hover { opacity: 1; color: #555; }
.copy-btn.copied { opacity: 1; color: #1cc88a; }

/* ---- Status Badges - Cores Vivas ---- */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: transform .2s, box-shadow .2s;
}

.badge-status:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.badge-status i {
    font-size: 13px;
}

/* Status Ativo - Verde Vibrante */
.badge-status-ativo {
    background: linear-gradient(135deg, #00d084, #00a366);
    color: #fff;
    border: 1px solid #00b877;
    box-shadow: 0 0 12px rgba(0, 208, 132, .3);
}

/* Status Suspenso - Laranja Vibrante */
.badge-status-suspenso {
    background: linear-gradient(135deg, #ff6b35, #ff4500);
    color: #fff;
    border: 1px solid #ff5722;
    box-shadow: 0 0 12px rgba(255, 107, 53, .3);
}

/* Status Expirado - Vermelho Vibrante */
.badge-status-expirado {
    background: linear-gradient(135deg, #ff3838, #cc0000);
    color: #fff;
    border: 1px solid #ff1f1f;
    box-shadow: 0 0 12px rgba(255, 56, 56, .3);
}

/* Status Inativo - Cinza Escuro */
.badge-status-inativo {
    background: linear-gradient(135deg, #5a6c7d, #3a4a5a);
    color: #fff;
    border: 1px solid #4a5a6d;
    box-shadow: 0 0 12px rgba(90, 108, 125, .3);
}

/* Status Adiantado - Ciano/Azul Vibrante */
.badge-status-adiantado {
    background: linear-gradient(135deg, #00d9ff, #0099cc);
    color: #fff;
    border: 1px solid #00b8e6;
    box-shadow: 0 0 12px rgba(0, 217, 255, .3);
}

/* Status Pendente - Amarelo/Ouro Vibrante */
.badge-status-pendente {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #000;
    border: 1px solid #ffb300;
    box-shadow: 0 0 12px rgba(255, 193, 7, .3);
}

/* ---- Overlay de status nas linhas da tabela ---- */
.table-status-ativo { background-color: rgba(0, 208, 132, .08) !important; }
.table-status-suspenso { background-color: rgba(255, 107, 53, .08) !important; }
.table-status-expirado { background-color: rgba(255, 56, 56, .08) !important; }
.table-status-inativo { background-color: rgba(90, 108, 125, .08) !important; }
.table-status-adiantado { background-color: rgba(0, 217, 255, .08) !important; }
.table-status-pendente { background-color: rgba(255, 193, 7, .08) !important; }
