/* ==========================================================================
   1. VARIÁVEIS GERAIS (DESIGN SYSTEM - TEMA SAAS MODERNO)
   ========================================================================== */
:root {
    /* Cores Principais (Marca) */
    --primary-color: #4F46E5;       /* Indigo 600 - Ação Principal */
    --primary-hover: #4338CA;       /* Indigo 700 - Hover */
    --primary-light: #EEF2FF;       /* Indigo 50 - Fundos de destaque */
    --primary-soft:  #E0E7FF;       /* Indigo 100 - Bordas suaves */

    /* Cores de Texto */
    --text-main: #111827;           /* Gray 900 - Títulos */
    --text-body: #4B5563;           /* Gray 600 - Parágrafos */
    --text-light: #9CA3AF;          /* Gray 400 - Placeholders/Detalhes */
    
    /* Cores de Fundo */
    --bg-body: #F4F5F9;             /* Cinza muito claro (Fundo da página) */
    --bg-card: #FFFFFF;             /* Branco (Cartões e Sidebar) */
    
    /* Cores de Status (Feedback) */
    --status-success-bg: #DCFCE7; --status-success-text: #166534;
    --status-warning-bg: #FEF9C3; --status-warning-text: #854D0E;
    --status-danger-bg:  #FEE2E2; --status-danger-text:  #991B1B;
    --status-info-bg:    #DBEAFE; --status-info-text:    #1E40AF;

    /* Espaçamentos e Bordas */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;              /* Bordas bem arredondadas (Estilo Kleon) */
    --border-color: #E5E7EB;        /* Gray 200 - Divisores */
    
    /* Sombras (Elevação Suave) */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Layout */
    --sidebar-width: 280px;
    --header-height: 80px;
}

/* ==========================================================================
   2. RESET E BASE
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter Tight', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-body);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden; /* Evita scroll horizontal indesejado */
}

a { text-decoration: none; color: inherit; transition: all 0.2s ease; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* Scrollbar Personalizada */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

.pb-safe { padding-bottom: env(safe-area-inset-bottom); }

/* ==========================================================================
   3. LAYOUT GRID (SIDEBAR + MAIN)
   ========================================================================== */
.admin-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Estilizada */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center; /* Logo centralizado */
    padding: 0 24px;
    border-bottom: 1px solid transparent; /* Limpo */
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.menu-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 20px 0 10px 12px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 32px 16px;
    margin-bottom: 4px;
    color: var(--text-body);
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
    position: relative;
    border-left: 2px solid transparent;
}

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

.sidebar-link.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
    /* border-left-color: var(--primary-color); Descomente se quiser a borda lateral */
}

.sidebar-link i { 
    width: 24px; 
    text-align: center; 
    font-size: 1.2em;
    transition: transform 0.2s;
}

.sidebar-link:hover i { transform: scale(1.1); }

/* Conteúdo Principal */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    background-color: var(--bg-body);
    transition: margin-left 0.3s ease;
}

/* Header Superior */
.top-header {
    height: var(--header-height);
    background-color: transparent; /* Transparente para fundir com o fundo */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(8px); /* Efeito vidro */
}

/* ==========================================================================
   4. COMPONENTES UI (ATÓMICOS)
   ========================================================================== */

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-icon { padding: 10px; width: 40px; height: 40px; border-radius: 50%; }

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(79, 70, 229, 0.35);
}
.btn-primary:active { transform: translateY(0); }

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-body);
}
.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: var(--primary-light);
}

.btn-danger-soft {
    background-color: #FEF2F2;
    color: #DC2626;
}
.btn-danger-soft:hover {
    background-color: #FEE2E2;
    color: #991B1B;
}

/* Inputs & Forms */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-body);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: #F9FAFB;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    background-color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Badges (Status) */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}
.badge-success { background: var(--status-success-bg); color: var(--status-success-text); }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning-text); }
.badge-danger  { background: var(--status-danger-bg);  color: var(--status-danger-text); }
.badge-info    { background: var(--status-info-bg);    color: var(--status-info-text); }

/* ==========================================================================
   5. CALENDÁRIO CUSTOMIZADO
   ========================================================================== */
.calendar-grid { 
    display: grid; 
    grid-template-columns: repeat(7, 1fr); 
    gap: 1px; 
    background-color: var(--border-color); 
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.calendar-cell { 
    background-color: white; 
    min-height: 80px; 
    padding: 6px; 
    transition: background 0.2s;
}

@media (min-width: 768px) { 
    .calendar-cell { min-height: 100px; padding: 10px; } 
}

.calendar-cell:hover { background-color: #F9FAFB; }
.calendar-cell.today { background-color: #F5F3FF; }
.calendar-cell.selected { background-color: var(--primary-light); box-shadow: inset 0 0 0 2px var(--primary-color); }

/* ==========================================================================
   6. RESPONSIVIDADE (TABLET & MOBILE)
   ========================================================================== */
@media (max-width: 1024px) {
    #sidebar {
        box-shadow: none;
    }
    
    #sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0,0,0,0.15);
    }
    
    .main-content {
        width: 100%;
    }
    
    .top-header { padding: 0 20px; }
    
    /* Overlay Escuro */
    #mobile-overlay {
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 45;
        opacity: 0; pointer-events: none;
        transition: opacity 0.3s;
        backdrop-filter: blur(2px);
    }
    
    #mobile-overlay.active {
        opacity: 1; pointer-events: auto;
    }
}