﻿/* CSS Otimizado Padronizado - Premium White Label */
:root {
    --brand-blue: #2563EB;
    --brand-dark: #0F172A;
    --brand-black: #020617;
    --glass-border: rgba(255, 255, 255, 0.5);
    --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 {
    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.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(96, 165, 250, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    -webkit-tap-highlight-color: transparent;
    color: var(--text-main);
}

/* 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.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 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);
}

.active-nav {
    background: rgba(255, 255, 255, 0.08) !important;
    border-left: 3px solid #D4AF37;
    color: white !important;
    box-shadow: inset 0 0 20px rgba(212, 175, 55, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Utilities */
.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 */
.sidebar.open {
    transform: translateX(0) !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 99px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ══════════════════════════════════════════════════════
   SIDEBAR AUTO-HOVER — Padrão ML Factory
   Retraído: 68px (só ícones) | Expandido: 280px (hover)
   Desktop only. Mobile usa toggle (translateX).

   COMO REPLICAR EM NOVOS SISTEMAS:
   1. No <aside id="sidebar">: remover classe de largura (w-64, w-72, etc.)
   2. No <main>: remover classe lg:ml-* (margin será via CSS)
   3. Adicionar estas classes nos elementos do sidebar HTML:
      - sidebar-header       → div do cabeçalho (logo + título)
      - sidebar-header-text  → div que envolve título + subtítulo
      - sidebar-label        → cada <span> de texto dos nav items
      - sidebar-section-divider → divs dos labels de seção (Operacional, Gestão, Sistema)
      - sidebar-footer-content  → div do rodapé (licença)
   4. Copiar este bloco CSS inteiro para o styles.css do novo sistema
   ══════════════════════════════════════════════════════ */

@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;
    }

    /* Lucide substitui <i> por <svg> — targetar svg */
    #sidebar:not(:hover) .nav-item svg,
    #sidebar:not(:hover) .nav-item .relative {
        margin-right: 0 !important;
        flex-shrink: 0;
    }

    #sidebar:not(:hover) .nav-item:hover {
        transform: none !important;
    }

    #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 — 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;
    }
}

/* Print Styles (Preserved) */
@media print {
    @page {
        margin: 1cm;
        size: A4;
    }

    body {
        background: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .sidebar,
    .no-print,
    button,
    .modal-backdrop,
    header,
    .hide {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        overflow: visible !important;
    }

    .view-section {
        display: none !important;
    }

    #view-reports,
    #view-finance {
        display: block !important;
    }

    #report-result {
        display: block !important;
        visibility: visible !important;
    }

    #report-result .grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }

    #view-finance table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 10pt !important;
    }

    #view-finance th,
    #view-finance td {
        border: 1px solid #ddd !important;
        padding: 6px !important;
        color: black !important;
    }

    #view-finance th:last-child,
    #view-finance td:last-child {
        display: none !important;
    }

    .glass,
    .glass-dark {
        background: white !important;
        backdrop-filter: none !important;
        border: none !important;
        box-shadow: none !important;
    }
}

/* Badges & Status */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.badge-pending,
.status-pending {
    background-color: #FEF3C7;
    color: #92400E;
}

.dark .badge-pending,
.dark .status-pending {
    background-color: rgba(251, 191, 36, 0.1);
    color: #FBBF24;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.badge-done,
.status-done {
    background-color: #DCFCE7;
    color: #166534;
}

.dark .badge-done,
.dark .status-done {
    background-color: rgba(34, 197, 94, 0.1);
    color: #4ADE80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-canceled,
.status-canceled {
    background-color: #FEE2E2;
    color: #991B1B;
}

.dark .badge-canceled,
.dark .status-canceled {
    background-color: rgba(239, 68, 68, 0.1);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.dark .progress-bar {
    background: rgba(255, 255, 255, 0.05);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563EB 0%, #60A5FA 100%);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}