/* ==========================================
   Premium Visual System | Auto-Generated
   ========================================== */

/* ── CSS Variables ── */
:root {
    --brand-primary: #2563EB;
    --brand-dark: #1D4ED8;
    --brand-black: #0f172a;
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --body-bg: #F8FAFC;
    --text-main: #1e293b;
    --card-bg: #FFFFFF;
}

.dark {
    --body-bg: #0B0F19;
    --text-main: #F8FAFC;
    --card-bg: #151B2C;
    --glass-bg: rgba(21, 27, 44, 0.8);
    --glass-border: rgba(255, 255, 255, 0.05);
}


/* ── Body with Radial Gradient ── */
body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--body-bg);
    background-image:
        radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(37, 99, 235, 0.06) 0px, transparent 50%);
    background-attachment: fixed;
    -webkit-tap-highlight-color: transparent;
    color: var(--text-main);
    overflow-x: hidden;
}

/* ── Glassmorphism Utilities ── */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.glass-dark {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ── Premium Interactions ── */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.3);
}

.nav-item {
    transition: all 0.2s ease;
}

.nav-item:hover {
    transform: translateX(4px);
}

.active-nav {
    background: rgba(255, 255, 255, 0.08) !important;
    border-left: 3px solid #2563EB;
    color: white !important;
    box-shadow: inset 0 0 20px rgba(37, 99, 235, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Active Nav Item ── */
.active-nav {
    background: rgba(255, 255, 255, 0.12) !important;
    border-left: 3px solid #2563EB;
    color: white !important;
}

/* ── Stock Status Row Colors ── */
.stock-critical td { background-color: rgba(254, 202, 202, 0.2); }
.stock-low td { background-color: rgba(254, 240, 138, 0.2); }
.stock-ok td { background-color: transparent; }
.text-critical { color: #dc2626; }
.text-low { color: #d97706; }
.text-ok { color: #16a34a; }

/* ── Animations ── */
.hide {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Modal and Overlays ── */
.modal-backdrop {
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

/* ── Sidebar & Mobile ── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 50;
        height: 100vh;
        width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
    }
}

@media (min-width: 1025px) {
    #sidebar {
        width: 68px !important;
        position: fixed;
        height: 100vh;
        overflow: hidden;
        transition: none !important;
    }

    #sidebar:hover {
        width: 280px !important;
        box-shadow: 4px 0 32px rgba(0, 0, 0, 0.3);
    }

    .main-content {
        margin-left: 68px;
    }

    /* Centraliza header quando retraído */
    #sidebar:not(:hover) .sidebar-header {
        justify-content: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    #sidebar:not(:hover) .sidebar-header > div:first-child {
        margin-right: 0 !important;
    }

    /* Remove padding horizontal do nav quando retraído */
    #sidebar:not(:hover) nav {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }

    /* Centraliza nav items quando retraído */
    #sidebar:not(:hover) .nav-item {
        justify-content: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* FIX: Lucide substitui <i> por <svg> — targetar svg */
    #sidebar:not(:hover) .nav-item svg {
        margin-right: 0 !important;
        flex-shrink: 0;
    }

    /* Remove translateX no hover quando retraído */
    #sidebar:not(:hover) .nav-item:hover {
        transform: none !important;
    }

    /* Active nav sem border-left quando retraído */
    #sidebar:not(:hover) .active-nav {
        border-left: none !important;
        border-radius: 0.75rem;
    }

    /* Oculta textos quando retraído */
    #sidebar:not(:hover) .sidebar-header-text,
    #sidebar:not(:hover) .sidebar-label,
    #sidebar:not(:hover) .sidebar-section-divider,
    #sidebar:not(:hover) .sidebar-footer-content {
        opacity: 0;
        width: 0;
        overflow: hidden;
        pointer-events: none;
        white-space: nowrap;
    }

    /* Revela textos ao expandir — sem fade, instantâneo */
    #sidebar:hover .sidebar-header-text,
    #sidebar:hover .sidebar-label,
    #sidebar:hover .sidebar-section-divider,
    #sidebar:hover .sidebar-footer-content {
        opacity: 1;
        width: auto;
        pointer-events: auto;
    }
}

/* ── Chart Container ── */
.chart-container {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 180px;
    gap: 2%;
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    position: relative;
}

.bar-wrapper {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    height: 100%;
    width: 100%;
}

.bar {
    width: 45%;
    border-radius: 6px 6px 0 0;
    transition: height 0.5s ease;
    min-height: 2px;
    position: relative;
    cursor: pointer;
}

.bar:hover::after {
    content: attr(data-value);
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10;
}

.x-label {
    font-size: 10px;
    color: #666;
    text-align: center;
    margin-top: 8px;
    font-weight: 500;
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success { background-color: #DCFCE7; color: #166534; }
.badge-warning { background-color: #FEF3C7; color: #92400E; }
.badge-danger  { background-color: #FEE2E2; color: #991B1B; }

/* ── Progress Bar ── */
.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563EB 0%, #1D4ED8 100%);
    transition: width 0.3s ease;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ── Manual Section ── */
.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 12px;
    flex-shrink: 0;
}

.checklist-item {
    transition: all 0.2s ease;
}

.checklist-item.completed {
    opacity: 0.7;
    text-decoration: line-through;
}

/* ── Utilities ── */
.blur-bg {
    backdrop-filter: blur(8px);
}

.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.code-block {
    background: #1a1a1a;
    color: #f8f8f2;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    overflow-x: auto;
    margin: 8px 0;
}

/* ── Loading Spinner ── */
.spinner {
    border: 3px solid rgba(37, 99, 235, 0.1);
    border-radius: 50%;
    border-top: 3px solid #2563EB;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Print Styles ── */

.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

@media print {
    .sidebar, #overlay, button, .header-buttons, .no-print, header,
    #month-selector, .view-section.hide {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        width: 100% !important;
        padding: 0 !important;
    }

    body {
        background: white !important;
    }

    #receipt-print, #receipt-print * {
        visibility: visible;
    }

    #receipt-print {
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm;
        font-size: 12px;
        line-height: 1.2;
        font-family: 'Courier New', monospace;
    }

    /* Estilos específicos para a Impressão da O.S (A4) */
    #invoice-print {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        background: white !important;
    }

    #invoice-print * {
        color: black !important;
    }

    .print-header-container {
        display: block !important;
        visibility: visible !important;
    }
}
