:root {
    --bg-dark: #000000;
    --sidebar-bg: #0a0a0a;
    --card-bg: rgba(20, 20, 20, 0.85);
    --accent-gold: #c5a059;
    --accent-red: #8e1c1c;
    --text-primary: #ffffff;
    --text-secondary: #d1d1d1;
    --glass-border: 1px solid rgba(255, 255, 255, 0.15);
}

html { color-scheme: dark; }

body {
    background-color: var(--bg-dark);
    font-family: 'Open Sans', sans-serif;
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
}

.login-body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-dark);
}

#animated-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; pointer-events: none; overflow: hidden;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
}

.floating-text {
    position: absolute;
    color: rgba(255, 255, 255, 0.71); 
    font-weight: 900;
    font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    user-select: none;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

@keyframes floatUp {
    0% { transform: translateY(110vh) rotate(0deg) scale(0.8); opacity: 0; }
    10% { opacity: 0.15; }
    90% { opacity: 0.15; }
    100% { transform: translateY(-10vh) rotate(15deg) scale(1); opacity: 0; }
}

h1, h2, h3, h4, h5, h6, .section-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: white !important;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.text-muted { color: var(--text-secondary) !important; }

/* Wrapper principal sem z-index para não prender o menu */
#wrapper { 
    display: flex; 
    width: 100%; 
    min-height: 100vh; 
    position: relative; 
}

.sidebar-wrapper {
    min-width: 260px; max-width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid #333;
    display: flex; flex-direction: column;
    /* Espaço extra para o cronômetro não colar no final */
    padding-bottom: 50px; 
    
    /* CORREÇÃO AQUI: Permite que o menu tenha sua própria rolagem */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Rolagem suave no mobile */
    
    /* BLOQUEIO DE ROLAGEM: Impede que a rolagem do menu passe para a página de trás */
    overscroll-behavior: contain; 
}

/* OVERLAY PARA MOBILE */
.menu-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    
    /* Efeito de Embaçado (Blur) */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    
    z-index: 9998; /* Abaixo do menu (9999), acima do site */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    
    /* BLOQUEIO TOTAL: Impede cliques e rolagem na parte de trás */
    touch-action: none;
    cursor: default;
}

/* CORREÇÃO CRÍTICA: GARANTE QUE A TELA PRETA (OVERLAY) SUMA NO DESKTOP */
@media (min-width: 769px) {
    .menu-overlay {
        display: none !important;
        pointer-events: none !important;
        opacity: 0 !important;
    }
}

/* BOTÃO FECHAR SIDEBAR (MOBILE) */
.btn-close-sidebar {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
}

.nav-btn {
    display: flex; align-items: center; padding: 16px 20px;
    color: #888; text-decoration: none; font-weight: 600;
    transition: all 0.3s; border-right: 3px solid transparent;
}
.nav-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav-btn.active {
    color: var(--accent-gold);
    background: linear-gradient(90deg, rgba(197, 160, 89, 0.1) 0%, transparent 100%);
    border-right: 3px solid var(--accent-gold);
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border-radius: 16px; border: var(--glass-border);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    position: relative;
}

.dashboard-bg-icon {
    position: absolute;
    top: -10px; right: 10px;
    font-size: 6rem;
    color: rgba(255, 255, 255, 0.03) !important;
    z-index: 0; pointer-events: none;
}
.glass-card h6, .glass-card h2, .glass-card p { position: relative; z-index: 1; }

.glass-input {
    background: #2a2a2a; border: 1px solid #444;
    color: #fff !important; padding: 14px; border-radius: 8px; font-size: 1rem;
}
.glass-input:focus {
    background: #333; border-color: var(--accent-gold); outline: none;
    box-shadow: 0 0 15px rgba(197, 160, 89, 0.15);
}
::-webkit-calendar-picker-indicator { filter: invert(1); opacity: 0.6; cursor: pointer; }

/* --- AGENDA --- */
.calendar-wrapper { min-height: 75vh; background: #1a1a1a; border-radius: 12px; padding: 15px; }
.fc a { color: #ffffff !important; text-decoration: none !important; }
.fc-col-header-cell-cushion { color: #ffffff !important; text-transform: uppercase; }
.fc-daygrid-day-number { color: #ffffff !important; }
.fc { color: white; font-family: 'Open Sans', sans-serif; }
.fc-toolbar-title { color: var(--accent-gold) !important; font-size: 1.5rem !important; }
.fc-button-primary { background-color: #333 !important; border: none !important; }
.fc-button-primary:hover { background-color: #444 !important; }
.fc-button-active { background-color: var(--accent-gold) !important; color: black !important; }
.fc-daygrid-day { border-color: #333 !important; }
.fc-col-header-cell { border-color: #333 !important; background: #111; }
.fc-event { cursor: pointer; }
.fc-event-main { color: #ffffff !important; font-weight: 600; }

/* --- BOTÕES --- */
.btn-action {
    background: var(--accent-red); color: white; padding: 15px;
    border: none; border-radius: 8px; font-weight: bold;
    letter-spacing: 1px; text-transform: uppercase; transition: 0.3s;
}
.btn-action:hover { background: #ff3b3b; box-shadow: 0 0 20px rgba(255, 59, 59, 0.4); }

.btn-gold {
    background: var(--accent-gold); color: #000; padding: 15px;
    border: none; border-radius: 8px; font-weight: bold;
    letter-spacing: 1px; text-transform: uppercase; transition: 0.3s;
}
.btn-gold:hover { 
    background: #fff; 
    color: #000;
    box-shadow: 0 0 20px rgba(197, 160, 89, 0.5); 
}

.motta-footer { width: 100%; padding: 20px; background: #000; border-top: 1px solid #222; }

/* --- TABELA DE CLIENTES --- */
.table-responsive {
    overflow-x: auto;
}
.custom-table {
    width: 100%;
    color: #fff;
    border-collapse: separate;
    border-spacing: 0 10px;
}
.custom-table thead th {
    background: transparent;
    color: var(--accent-gold);
    text-transform: uppercase;
    font-size: 0.8rem;
    border: none;
    padding: 15px;
}
.custom-table tbody tr {
    background: rgba(40, 40, 40, 0.6);
    transition: 0.3s;
}
.custom-table tbody tr:hover {
    background: rgba(197, 160, 89, 0.1);
}
.custom-table td {
    padding: 15px;
    vertical-align: middle;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
}
.custom-table td:first-child { border-left: 1px solid #333; border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
.custom-table td:last-child { border-right: 1px solid #333; border-top-right-radius: 10px; border-bottom-right-radius: 10px; }

/* --- MODALS --- */
.custom-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px);
    display: none; justify-content: center; align-items: center; z-index: 9999;
    opacity: 0; transition: opacity 0.3s ease;
}
.custom-modal-overlay.show { display: flex; opacity: 1; }

.custom-modal-content {
    background: #151515; border: 1px solid var(--accent-gold);
    width: 90%; max-width: 500px; border-radius: 16px;
    padding: 30px; text-align: center;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    transform: scale(0.8); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh; overflow-y: auto;
}
.custom-modal-overlay.show .custom-modal-content { transform: scale(1); }

.modal-icon { font-size: 3rem; margin-bottom: 20px; color: var(--accent-gold); }
.modal-title { font-size: 1.5rem; color: white; margin-bottom: 15px; }
.modal-text { 
    color: #ccc; 
    margin-bottom: 25px; 
    font-size: 1rem; 
    line-height: 1.5; 
    white-space: pre-line; 
    text-align: center; 
}

.modal-btn {
    background: var(--accent-gold); color: #000; border: none;
    padding: 10px 30px; border-radius: 50px; font-weight: bold; cursor: pointer;
    transition: 0.2s; margin: 5px;
}
.modal-btn:hover { background: white; transform: scale(1.05); }

/* --- LISTA DE BUSCA NO MODAL --- */
.search-list-container {
    max-height: 300px;
    overflow-y: auto;
    text-align: left;
    margin-top: 10px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #111;
}

.search-item {
    padding: 15px;
    border-bottom: 1px solid #222;
    cursor: pointer;
    transition: background 0.2s;
    color: #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-item:hover {
    background: rgba(197, 160, 89, 0.2);
    color: var(--accent-gold);
}

.search-item:last-child { border-bottom: none; }

.edit-form-group { text-align: left; margin-bottom: 15px; }
.edit-form-group label { color: var(--accent-gold); font-size: 0.8rem; font-weight: bold; margin-bottom: 5px; display: block; }
.edit-form-group input { width: 100%; background: #222; border: 1px solid #444; color: #fff; padding: 10px; border-radius: 6px; }

/* RESPONSIVO MOBILE */
@media (max-width: 768px) {
    /* Menu Lateral Fixo no Topo (Z-INDEX ALTO) */
    .sidebar-wrapper { 
        margin-left: -260px; 
        position: fixed; 
        height: 100%;
        top: 0;
        left: 0;
        z-index: 9999; /* Fica acima de tudo (e do overlay 9998) */
        transition: margin-left 0.3s ease;
    }
    #wrapper.toggled .sidebar-wrapper { margin-left: 0; }
    
    .display-6 { font-size: 1.5rem; }

    /* CORREÇÃO DO CALENDÁRIO NO CELULAR */
    .fc .fc-toolbar {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    .fc-toolbar-title {
        font-size: 1.1rem !important; /* Título menor */
        margin: 0 !important;
    }
    .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    /* AJUSTE DOS QUADRADINHOS NO CELULAR (MAIS ALTURA) */
    .calendar-wrapper {
        height: auto !important; /* Remove altura fixa */
        min-height: 500px;
    }
    
    /* Força altura mínima em cada dia para não espremer */
    .fc-daygrid-day-frame {
        min-height: 85px !important; 
    }

    /* Fonte menor para caber mais texto */
    .fc-daygrid-day-number { 
        font-size: 0.8rem; 
        padding: 2px !important;
    }
    .fc-event { 
        font-size: 0.7rem !important; 
        padding: 1px !important;
    }
    .fc-col-header-cell-cushion {
        font-size: 0.8rem;
    }
}