/*
|--------------------------------------------------------------------------
| GLOBAL DESIGN SYSTEM - STRUCTURE ONLY
|--------------------------------------------------------------------------
| This file controls:
| - Layout structure (.page-wrapper, .page-card, etc)
| - Global components (buttons, tables, forms)
| - Spacing system
|
| Do NOT place page-specific styles here.
|--------------------------------------------------------------------------
*/

/**
 * DESIGN SYSTEM - APP.CSS
 * 
 * Ponto de entrada principal do Design System.
 * Importa todos os módulos CSS base em ordem.
 */

/* ============================================
   IMPORTAÇÕES - ORDEM CRÍTICA
   ============================================ */

/* 1. Variáveis CSS - Deve ser primeiro */
@import url('./core/variables.css');

/* 2. Reset - Normalizações básicas */
@import url('./core/reset.css');

/* 3. Layout - Containers, grid, flexbox */
@import url('./core/layout.css');

/* 4. Components - Componentes base */
@import url('./core/components.css');

/* 5. Utilities - Classes utilitárias */
@import url('./core/utilities.css');

/* ============================================
   GLOBAL LAYOUT HARDENING
   Centralized from layout-base.html
   ============================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--color-background-tertiary);
    display: flex;
    overflow-x: hidden;
    /* Prevent horizontal overflow globally */
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    padding: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 2rem 1rem 1rem;
    text-align: center;
}

.sidebar h1 {
    color: var(--color-background-primary);
    font-size: 1.3rem;
    margin-bottom: 0;
}

.nav-menu {
    list-style: none;
    padding: 1rem;
    flex: 1;
}

.sidebar-footer {
    padding: 1rem;
    background: rgba(15, 23, 42, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--border-color);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-background-primary);
}

.nav-link.active {
    background: var(--color-primary-600);
    color: var(--color-background-primary);
}

.nav-link i {
    margin-right: 0.75rem;
    width: 20px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 260px;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    transition: margin-left 0.3s;
    overflow-y: auto;
    /* Ensure proper scroll management */
}

/* ===== HEADER ===== */
.header {
    background: white;
    color: #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

/* ===== MENU TOGGLE (MOBILE) ===== */
.menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--color-text-primary);
    color: var(--color-background-primary);
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .header {
        padding: 4rem 1rem 1rem;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* ============================================
   LOGOUT MODAL - Professional Design
   ============================================ */

.modal-logout-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 40, 0.6);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.modal-logout-overlay.show {
    display: flex;
}

.modal-logout-content {
    background: #1e2a3a;
    padding: 35px;
    border-radius: 14px;
    width: 420px;
    max-width: 90%;
    text-align: center;
    color: #fff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    animation: scaleIn 0.2s ease;
}

/* Animatioins */
@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0
    }

    to {
        transform: scale(1);
        opacity: 1
    }
}

/* ============================================
   MODERN PAGE WRAPPER PATTERN
   Standardized layout for all SPA pages
   ============================================ */

.page-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

.page-header {
    margin-bottom: 25px;
}

.page-header h1 {
    font-size: 26px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 5px 0;
}

.page-header p {
    color: #64748b;
    font-size: 14px;
    margin: 0;
}

/* ============================================
   CARD COMPONENT SYSTEM
   ============================================ */

/* Base Card */
.page-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.page-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.page-card h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 20px 0;
}

/* KPI Card */
.page-card.kpi {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Warning Card */
.page-card.warning {
    border-left: 4px solid #f59e0b;
}

/* Danger Card */
.page-card.danger {
    border-left: 4px solid #ef4444;
}

/* Compact Card */
.page-card.compact {
    padding: 15px;
}

/* Responsive adjustments for page wrapper */
@media (max-width: 768px) {
    .page-wrapper {
        padding: 20px 15px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .page-card {
        padding: 20px;
        margin-bottom: 20px;
    }
}