/* ==========================================================================
   VARIÁVEIS E TEMAS
   ========================================================================== */
:root {
    --cal-bg: #2c3036;
    --cal-cell: #343a40;
    --cal-text: #ffffff;
    --cal-border: #454d55;
    --cal-selected: #4e555c;

    --color-primary: #3699ff;
    --color-almoco: #f1c40f;
    --color-jantar: #3699ff;
    --color-muted: #a2a3b7;

    --layout-width: var(--layout-w, 80%);
}

body {
    padding-top: 70px !important;
    background-color: #f4f7fe;
    overflow-x: hidden;
}

/* ===== LAYOUT GLOBAL (mesma variavel que reservationQuery.css) ===== */
:root { --layout-w: 80%; }
@media (max-width: 968px) { :root { --layout-w: 98%; } }
@media (max-width: 480px) { :root { --layout-w: 98%; } }

#calendarArea {
    margin-top: 10px !important;
}

/* ==========================================================================
   ESTRUTURA PRINCIPAL
   ========================================================================== */
#calendarWrapper {
    width: var(--layout-width);
    margin: 0 auto 15px auto;
    background: var(--cal-bg);
    border-radius: 12px;
    overflow: hidden;
    color: var(--cal-text);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

/* ==========================================================================
   CALENDÁRIO: CABEÇALHO E GRID
   ========================================================================== */
.calendar-header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 15px;
    position: relative;
}

#monthYear {
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    font-weight: 700;
    text-transform: capitalize;
}

/* Botões de navegação de mês — fixos nos cantos, SEM deslocamento */
.btn-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
    z-index: 10;
    /* IMPEDIR deslocamento no hover */
    margin: 0;
    padding: 0;
}

.btn-nav:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
    /* Manter posicao fixa - sem transform adicional */
    transform: translateY(-50%);
}

.btn-nav:active {
    background: rgba(255,255,255,0.35);
    transform: translateY(-50%);
}

#prevMonth { left: 12px; }
#nextMonth { right: 12px; }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--cal-border);
    border-top: 1px solid var(--cal-border);
}

.day-header {
    background: var(--cal-bg);
    color: var(--color-muted);
    text-align: center;
    padding: 8px;
    font-size: clamp(0.6rem, 1.3vw, 0.75rem);
    font-weight: 800;
    text-transform: uppercase;
}

/* Células de Dia */
.day-cell {
    background: var(--cal-cell);
    min-height: 80px;
    padding: 8px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.day-cell:hover { background: #3d444b; }
.day-cell.today { border: 2px solid var(--color-primary); }
.day-cell.selected {
    background: var(--cal-selected) !important;
    box-shadow: inset 0 0 0 2px var(--color-primary);
}

.day-num { font-weight: 700; font-size: clamp(0.75rem, 1.6vw, 0.95rem); }

/* Badges de Almoço/Jantar */
.pill-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.pill {
    font-size: clamp(7px, 1.2vw, 10px);
    padding: 2px 6px;
    border-radius: 4px;
    width: fit-content;
    font-weight: 900;
    text-transform: uppercase;
}
.pill-a { background: var(--color-almoco); color: #000; }
.pill-j { background: var(--color-jantar); color: #fff; }

/* ==========================================================================
   BOTÃO ESCONDER/EXPANDIR CALENDÁRIO
   ========================================================================== */
.toggle-calendar-btn {
    display: block;
    margin: 0 auto;
    padding: 8px 24px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--cal-text);
    border-radius: 0 0 12px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
}

.toggle-calendar-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* ==========================================================================
   BARRA DE FILTROS HORIZONTAL
   ========================================================================== */
.filter-bar-horizontal {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    flex-wrap: nowrap;
}

/* Esconde labels para compactar */
.filter-bar-horizontal label { display: none; }

.filter-item-date { width: 160px; flex-shrink: 0; }
.filter-item-search { flex-grow: 1; }

/* Períodos e Ícones */
.period-icons {
    display: flex;
    gap: 6px;
    border-right: 1px solid #eee;
    padding-right: 12px;
    margin-right: 4px;
}

.btn-period {
    border: 1px solid #ebedf3;
    background: #f3f6f9;
    color: #3f4254;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-period:hover { background: #e1e9f1; }
.btn-period.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.filter-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ==========================================================================
   ESTADOS: COLLAPSED
   ========================================================================== */
.collapsed #calendarGrid,
.collapsed .calendar-header-top,
.collapsed #totalMonth {
    display: none !important;
}

/* ==========================================================================
   RESPONSIVIDADE
   ========================================================================== */

/* Largura do calendario segue --layout-w global */
/* Desktop: 80% | Tablet/Mobile: 98% (definido no :root acima) */

/* Tablet (até 968px) */
@media (max-width: 968px) {
    .filter-bar-horizontal { flex-wrap: wrap; }
    .filter-item-date, .filter-item-search { width: 100%; }
}

/* ==========================================================================
   IMPRESSÃO
   ========================================================================== */
@media print {
    header,
    #calendarArea,
    .filter-bar-horizontal,
    .toggle-calendar-btn,
    .fab-main,
    #logoutBtn {
        display: none !important;
    }

    body, #mainContent {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #reservasTable {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    #reservasTable th, #reservasTable td {
        border: 1px solid #ddd !important;
        color: black !important;
    }
}
