/* =====================================================
   Controle Comercial - Estilos Principais
   ===================================================== */

:root {
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #16213e;
    --sidebar-active: #0f3460;
    --sidebar-width: 250px;
    --sidebar-collapsed: 60px;
    --topbar-height: 56px;
    --primary: #0d6efd;
    --text-muted-sidebar: #8a9bb0;
}

* { box-sizing: border-box; }

body {
    background: #f0f2f5;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 0.9rem;
}

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    transition: width 0.25s ease;
    overflow-x: hidden;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .sidebar-link .me-2 { display: none; }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 0.6rem; }

.sidebar-header {
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: var(--topbar-height);
}

.sidebar-brand { font-size: 1.1rem; white-space: nowrap; }

.sidebar-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted-sidebar);
    text-transform: uppercase;
    padding: 1rem 1rem 0.3rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.55rem 1rem;
    color: #c8d3e0;
    text-decoration: none;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

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

.sidebar-link.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left: 3px solid var(--primary);
}

/* ---- TOPBAR ---- */
.topbar {
    background: #fff;
    border-bottom: 1px solid #e0e4ea;
    min-height: var(--topbar-height);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* ---- MAIN CONTENT ---- */
.main-content { overflow-x: hidden; }
.content-area { min-height: calc(100vh - var(--topbar-height)); }

/* ---- CARDS KPI ---- */
.kpi-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    transition: transform 0.15s, box-shadow 0.15s;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.kpi-value { font-size: 1.5rem; font-weight: 700; }
.kpi-label { font-size: 0.8rem; color: #6c757d; }

/* ---- TABELAS ---- */
.table-hover tbody tr:hover { background: #f0f4ff; }
.table th { font-weight: 600; font-size: 0.82rem; color: #495057; }

/* ---- FORMULÁRIOS ---- */
.form-label { font-weight: 500; font-size: 0.85rem; }
.card { border: none; box-shadow: 0 1px 6px rgba(0,0,0,0.07); border-radius: 10px; }
.card-header { background: #fff; border-bottom: 1px solid #e9ecef; font-weight: 600; }

/* ---- BADGES STATUS ---- */
.badge { font-size: 0.75rem; padding: 0.3em 0.6em; }

/* ---- ESTOQUE BAIXO ---- */
.estoque-baixo td { background: #fff5f5 !important; }
.estoque-zerado td { background: #fff0f0 !important; }

/* ---- PDV (NOVA VENDA) ---- */
.pdv-section { background: #fff; border-radius: 10px; box-shadow: 0 1px 6px rgba(0,0,0,0.07); padding: 1.25rem; }
.pdv-total-row { background: #f8f9fa; font-weight: 700; }
.pdv-grand-total { font-size: 1.3rem; font-weight: 800; color: #0d6efd; }

/* ---- CALCULADORAS ---- */
.calc-result {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 10px;
    padding: 1.25rem;
    margin-top: 1rem;
}
.calc-result .result-value { font-size: 1.8rem; font-weight: 800; }
.calc-result .result-label { font-size: 0.85rem; opacity: 0.85; }

/* ---- PRINT ---- */
@media print {
    .sidebar, .topbar, .btn, .no-print { display: none !important; }
    .main-content { margin: 0 !important; }
    .content-area { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #dee2e6 !important; }
    body { background: #fff !important; }
}

/* ---- RESPONSIVO ---- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .wrapper { flex-direction: column; }
}

/* ---- SCROLLBAR SIDEBAR ---- */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* ---- LOGIN ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
    color: #fff;
}

/* ---- ALERTAS ---- */
.alert { border-radius: 10px; border: none; }

/* ---- TABS ---- */
.nav-tabs .nav-link { font-size: 0.85rem; }
