/* =========================================
   1. VARIÁVEIS E RESET GLOBAL
   ========================================= */
:root {
    --primary: #6366f1;       /* Indigo Principal */
    --primary-hover: #4f46e5;
    --secondary: #64748b;     /* Cinza Texto */
    
    --success: #10b981;       /* Verde (Livre/Peguei) */
    --warning: #f59e0b;       /* Laranja (Reservado) */
    --danger: #ef4444;        /* Vermelho (Devolver/Cancelar) */
    --info: #3b82f6;          /* Azul */
    --purple: #8b5cf6;        /* Roxo (Em Uso) */

    --bg-body: #f1f5f9;       /* Fundo da Página */
    --bg-card: #ffffff;       /* Fundo dos Cards */
    
    --text-main: #1e293b;     /* Texto Escuro */
    --text-muted: #94a3b8;    /* Texto Claro */
    
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* =========================================
   2. LOGIN E RECUPERAÇÃO DE SENHA
   ========================================= */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* =========================================
   3. SIDEBAR (MENU LATERAL) - CORRIGIDO
   ========================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--bg-card);
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    z-index: 1000;
    transition: transform 0.3s ease;
    
    /* FIX: Flexbox para empurrar o rodapé para baixo corretamente */
    display: flex;
    flex-direction: column; 
}

.sidebar-header {
    padding: 25px;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    border-bottom: 1px solid var(--bg-body);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-menu {
    padding: 20px 0;
    /* Faz o menu ocupar todo o espaço disponível no meio */
    flex-grow: 1; 
    overflow-y: auto; /* Se tiver muitos itens, cria rolagem só no menu */
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: var(--secondary);
    font-weight: 500;
    transition: all 0.2s;
    gap: 12px;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background: #e0e7ff;
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.owldev-footer {
    padding: 25px;
    border-top: 1px solid var(--bg-body);
    font-size: 0.8rem;
    color: var(--text-muted);
    /* Garante espaço extra embaixo para telas pequenas */
    padding-bottom: 40px; 
}

.owldev-footer a:hover { text-decoration: underline; }

/* =========================================
   4. CONTEÚDO PRINCIPAL (LAYOUT)
   ========================================= */
.main-content {
    margin-left: var(--sidebar-width); /* Empurra conteúdo para direita no Desktop */
    padding: 30px;
    transition: margin 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.header-mobile {
    display: none; /* Escondido no Desktop */
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* =========================================
   5. COMPONENTES DE UI (Botões, Cards, Forms)
   ========================================= */

/* --- Cards Genéricos --- */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: transform 0.2s;
}

/* Cores da Borda Lateral dos Cards da Agenda */
.status-livre { border-left: 5px solid var(--success); }
.status-reservado { border-left: 5px solid var(--warning); }
.status-em_uso { border-left: 5px solid var(--purple); }
.status-expirado { border-left: 5px solid var(--secondary); opacity: 0.7; }

/* --- Badges (Etiquetas) --- */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-livre { background: #dcfce7; color: #166534; }
.badge-reservado { background: #fef3c7; color: #92400e; }
.badge-em_uso { background: #ede9fe; color: #5b21b6; }

/* --- Formulários --- */
.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* --- Botões --- */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
}
.btn:hover { opacity: 0.9; }
.btn:disabled { cursor: not-allowed; opacity: 0.6; }

.btn-block { width: 100%; }

.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: #fff; }

/* --- Tabelas (Admin) --- */
.table-responsive {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}
th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
th {
    background: #f8fafc;
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}
tr:hover { background: #f8fafc; }

/* =========================================
   6. GRID DA AGENDA (Responsivo Automático)
   ========================================= */
.grid {
    display: grid;
    /* Cria colunas automaticamente com largura mínima de 300px */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h3 { font-size: 1.1rem; color: var(--text-main); }

.card-time {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-user {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 10px;
    background: #f8fafc;
    border-radius: 6px;
}

/* =========================================
   7. RESPONSIVIDADE (MOBILE)
   ========================================= */
@media (max-width: 768px) {
    /* Esconde a sidebar lateralmente */
    .sidebar {
        transform: translateX(-100%);
    }
    
    /* Mostra sidebar quando ativa */
    .sidebar.active {
        transform: translateX(0);
    }

    /* Conteúdo ocupa tela toda */
    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    /* Mostra o header mobile (botão hambúrguer) */
    .header-mobile {
        display: flex;
    }

    /* Fundo escuro quando menu abre */
    .overlay {
        display: none;
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .overlay.active { display: block; }
}