/* ========================================
   CSS Principal do Dashboard - Sistema 100
   Versão Responsiva Completa - CORRIGIDO
   ======================================== */

/* Variáveis para cores do sistema de restaurante */
:root {
    --primary: #d32f2f;
    --primary-dark: #b71c1c;
    --secondary: #ff9800;
    --accent-color: #ffc107;
    --section-vendas-color: #e53935;
    --section-estoque-color: #fb8c00;
    --section-cardapio-color: #ffb74d;
    --section-financeiro-color: #4caf50;
    --section-relatorios-color: #2196f3;
    --section-configuracoes-color: #607d8b;
    --text-color: #333;
    --bg-color: #f5f5f5;
    --card-bg: #fff;
    --sidebar-bg: #1a1a1a;
    --sidebar-text: #ffffff;
    --sidebar-width: 260px;
}

/* Tema escuro */
[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #f5f5f5;
    --card-bg: #1e1e1e;
}

/* Reset e configurações base */
* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.card {
    background-color: var(--card-bg);
    transition: background-color 0.3s ease;
}

/* ========================================
   HEADER RESPONSIVO - CORRIGIDO
   ======================================== */
.header {
    background: linear-gradient(180deg, #212529 0%, #1c59b7 100%);
    color: white;
    padding: 0;
    height: 60px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040; /* Bootstrap navbar z-index */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 15px;
}

.logo {
    /* max-width: 140px; */
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo img {
    width: 100%;
    height: auto;
    max-height: 48px;
}

.logo i {
    font-size: 2rem;
    margin-right: 10px;
    color: #ffc107;
}

/* Área de acessos rápidos - RESPONSIVA */
.quick-access {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.quick-access-item {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    font-weight: 500;
    white-space: nowrap;
}

.quick-access-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateY(-2px);
}

.quick-access-item.active {
    background-color: rgba(255, 255, 255, 0.2);
}

.quick-access-item i {
    font-size: 18px;
    margin-right: 6px;
}

/* Área do usuário */
.user-menu {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.user-name {
    margin-right: 15px;
    font-weight: 500;
    white-space: nowrap;
}

.logout-btn {
    background: none;
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.logout-btn i {
    margin-right: 5px;
}

/* ========================================
   SIDEBAR RESPONSIVA
   ======================================== */
.sidebar {
    position: fixed;
    top: 55px;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: #f5f5f5;
    color: var(--sidebar-text);
    z-index: 1030; /* Bootstrap sidebar z-index */
    overflow-y: auto;
    transition: transform 0.3s ease; /* Mudado para transform */
    padding: 15px 0;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
}

/* Botão toggle do sidebar*/
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px 12px;
    margin-right: 15px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    position: relative;
    z-index: 1041; /* Acima do header */
}

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

.sidebar-toggle:focus {
    outline: 2px solid #ffc107;
    outline-offset: 2px;
}

/* Cards de seção no sidebar */
.menu-section {
    margin: -3px 8px 10px 6px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    background: linear-gradient(270deg, #0a58ca 0%, #1a1a1a 100%);
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.menu-section:hover {
    transform: translateX(2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.section-header {
    padding: 15px 18px;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.1) 100%);
    display: flex;
    align-items: center;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 1px;
    color: #ffffff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.section-header i {
    margin-right: 12px;
    font-size: 16px;
}

.menu-items {
    list-style: none;
    font-size: 16px;
    letter-spacing: 0.5px;
    padding: 0;
    margin: 0;
}

.menu-item {
    padding: 0;
}

.menu-item a {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    color: #e0e0e0;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
}

.menu-item a:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: #ffffff;
    padding-left: 24px;
}

.menu-item.active a {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
    color: #ffffff;
    font-weight: 600;
    border-right: 3px solid #ffc107;
}

.menu-item i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
    font-size: 16px;
}

/* Cores para cada seção do restaurante */
.section-vendas { border-left-color: var(--section-vendas-color); }
.section-estoque { border-left-color: var(--section-estoque-color); }
.section-cardapio { border-left-color: var(--section-cardapio-color); }
.section-financeiro { border-left-color: var(--section-financeiro-color); }
.section-relatorios { border-left-color: var(--section-relatorios-color); }
.section-configuracoes { border-left-color: var(--section-configuracoes-color); }

/* ========================================
   OVERLAY PARA MOBILE
   ======================================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1025; /* Entre conteúdo e sidebar */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   CONTEÚDO PRINCIPAL RESPONSIVO
   ======================================== */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: 80px;
    padding: 80px 20px 20px 20px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
}

/* Page title styles */
.page-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 16px;
    color: #6c757d;
    margin-bottom: 25px;
    font-weight: 500;
}

/* Texto de protótipo piscando */
.prototype-warning {
    color: #dc3545;
    font-size: 16px;
    font-weight: 600;
    margin-left: 35px;
    animation: blink 1.5s infinite;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* ========================================
   CARDS DE ESTATÍSTICAS RESPONSIVOS
   ======================================== */
.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    padding: 20px;
    height: 100%;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

/* Container principal do card - ícone e número lado a lado */
.stat-main {
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-card .stat-icon {
    width: 60px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.stat-card .stat-number {
    font-size: 24px;
    font-weight: 800;
    color: #333;
    line-height: 1;
    margin: 0;
}

.stat-card .stat-label {
    color: #666;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.stat-card .stat-change {
    font-size: 12px;
    font-weight: 600;
    margin: 0;
}

.stat-card .stat-change.positive {
    color: #4caf50;
}

.stat-card .stat-change.negative {
    color: #f44336;
}

/* Gradientes para os ícones */
.bg-primary-gradient { background: linear-gradient(135deg, #d32f2f, #b71c1c); }
.bg-success-gradient { background: linear-gradient(135deg, #4caf50, #388e3c); }
.bg-info-gradient { background: linear-gradient(135deg, #2196f3, #1976d2); }
.bg-warning-gradient { background: linear-gradient(135deg, #ff9800, #f57c00); }
.bg-orange-gradient { background: linear-gradient(135deg, #ff5722, #d84315); }

/* ========================================
   COMPONENTES GERAIS
   ======================================== */

/* Charts container */
.chart-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    padding: 25px;
    height: 100%;
    position: relative;
}

/* Activity timeline */
.activity-item {
    border-left: 3px solid #e9ecef;
    padding-left: 20px;
    margin-bottom: 20px;
    position: relative;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.activity-item .activity-time {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* Tables */
.custom-table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    width: 100%;
}

.custom-table th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-weight: 700;
    border-top: none;
    color: #333;
}

.custom-table .avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.custom-table .badge {
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
}

/* ========================================
   RESPONSIVIDADE AVANÇADA
   ======================================== */

/* Tablets e telas médias (768px - 1199px) */
@media (max-width: 1199px) {
    .main-content {
        margin-left: var(--sidebar-width);
        padding: 80px 15px 20px 15px;
    }
    
    .stat-card .stat-icon {
        width: 50px;
        height: 40px;
        font-size: 20px;
    }
    
    .stat-card .stat-number {
        font-size: 24px;
    }
    
    .page-title {
        font-size: 24px;
    }
}


/* Ajustes específicos para mobile */
@media (max-width: 575px) {
    .stat-card {
        padding: 12px;
    }
    
    .stat-main {
        gap: 8px;
    }
    
    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .stat-card .stat-number {
        font-size: 18px;
    }
    
    .stat-card .stat-label {
        font-size: 12px;
    }
    
    .stat-change {
        font-size: 10px;
    }
}


/* Tablets pequenos e mobile landscape (768px - 991px) */
@media (max-width: 991px) {
    .sidebar-toggle {
        display: block; /* Mostrar botão toggle */
    }
    
    .sidebar {
        transform: translateX(-100%); /* Esconder sidebar */
        width: 280px;
        top: 45px;
    }
    
    .sidebar.show {
        transform: translateX(0); /* Mostrar sidebar */
    }
    
    .main-content {
        margin-left: 0; /* Remover margem */
        padding: 80px 15px 20px 15px;
    }
    
    .logo span {
        display: none;
    }
    
    .logo img {
        width: 100%;
        height: auto;
        max-height: 48px;
        margin-left: 40px;
    }
}

/* Mobile (568px - 767px) */
@media (max-width: 767px) {
    .header-content {
        padding: 0 10px;
    }
    
    .quick-access {
        gap: 3px;
    }
    
    .quick-access-item {
        padding: 6px 8px;
        font-size: 14px;
    }
    
    .quick-access-item span {
        display: none;
    }
    
    .quick-access-item i {
        margin-right: 0;
        font-size: 18px;
    }
    
    .user-name {
        display: none;
    }
    
    .logout-btn span {
        display: none;
    }
    
    .main-content {
        padding: 80px 10px 20px 10px;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .prototype-warning {
        font-size: 14px;
        margin-left: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-main {
        gap: 10px;
    }
    
    .stat-card .stat-icon {
        width: 45px;
        height: 40px;
        font-size: 18px;
    }
    
    .stat-card .stat-number {
        font-size: 20px;
    }
    
    .stat-card .stat-label {
        font-size: 13px;
    }
    
    .chart-container {
        padding: 15px;
    }
    
    .logo img {
        width: 100%;
        height: auto;
        max-height: 48px;
        margin-left: 40px;
    }
    
    /* Ajustar cards em mobile para layout vertical */
    .row.g-4 {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 1rem;
    }
    
    /* Fazer tabelas responsivas */
    .table-responsive {
        font-size: 14px;
    }
    
    .custom-table th,
    .custom-table td {
        padding: 8px;
    }
}

/* Mobile pequeno (320px - 567px) */
@media (max-width: 567px) {
    .header {
        height: 55px;
    }
    
    .main-content {
        padding-top: 75px;
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .logo {
        max-width: 100px;
    }
    
    .quick-access-item {
        padding: 5px 6px;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .prototype-warning {
        font-size: 12px;
        margin-left: 5px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-main {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
        margin: 0 auto;
    }
    
    .stat-card .stat-number {
        font-size: 18px;
    }
    
    .chart-container {
        padding: 12px;
    }
    
    /* Ajustar layout da sidebar em mobile */
    .sidebar {
        width: 250px;
    }
    
    .menu-section {
        margin: 2px 4px 8px 4px;
    }
    
    .section-header {
        padding: 12px 15px;
        font-size: 12px;
    }
    
    .menu-item a {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* Ajustes específicos para orientação landscape em mobile */
@media (max-width: 767px) and (orientation: landscape) {
    .main-content {
        padding-top: 70px;
    }
}

/* ========================================
   ANIMAÇÕES E EFEITOS
   ======================================== */

/* Animações para elementos que entram na tela */
.stat-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.stat-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* ========================================
   UTILITÁRIOS E HELPERS
   ======================================== */

/* Loading states */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Focus states para acessibilidade */
.quick-access-item:focus,
.logout-btn:focus,
.menu-item a:focus {
    outline: 2px solid #ffc107;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .sidebar,
    .header,
    .sidebar-toggle,
    .btn,
    .dropdown {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
    }
    
    .chart-container {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Acessibilidade */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Contraste alto */
@media (prefers-contrast: high) {
    .card,
    .chart-container {
        border: 2px solid #000;
    }
    
    .sidebar {
        border-right: 3px solid #000;
    }
}