/* main.css - Responsivo otimizado */

/* --- Estilos globais --- */
html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #dbe2f2;
    color: #2d3748;
    box-sizing: border-box;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    width: 100%;
    padding: 0;
    max-width: 1200px;
    margin: 0 auto;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Cabeçalho --- */
header {
    width: 100%;
    background-color: #2d3748;
    color: white;
    padding: 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0;
    font-size: 2rem;
}

/* --- Tabela de Calendário --- */
.calendar-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0 18px;
    border-radius: 8px;
    overflow: hidden;
    table-layout: fixed;
}

.calendar-table th,
.calendar-table td {
    padding: 2px 4px;
    text-align: center;
    border: 1px solid #e2e8f0;
    background-color: #f9fafb;
    color: #4a5568;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-table .KW {
    background-color: #e6edf7;
    font-weight: bold;
    color: #2d3748;
}

.calendar-table th:not(.Leandro):not(.Rafaela),
.calendar-table td:not(.Leandro):not(.Rafaela) {
    width: 7%;
}

.calendar-table .Leandro {
    background-color: #e0e7ff;
    color: #2d3748;
    font-weight: 500;
    width: 22%;
}

.calendar-table .Rafaela {
    background-color: #d1e2f7;
    color: #2d3748;
    font-weight: 500;
    width: 22%;
}

.calendar-table th.Leandro,
.calendar-table th.Rafaela {
    white-space: normal;
}

.calendar-table th {
    padding: 2px;
    background-color: #cbd5e0;
    color: #2d3748;
    font-weight: bold;
}

.calendar-table .sa {
    background-color: #d1e8ff;
    color: #2d3748;
}

.calendar-table .so {
    background-color: #cbd5e0;
    color: #2d3748;
}

.calendar-table td.holiday {
    background-color: #c4e7f4;
    color: #2d3748;
    font-weight: bold;
}

.calendar-table td.today {
    background-color: #2c5282;
    color: white;
    font-weight: bold;
    text-decoration: underline;
    border: 2px solid #001f3f;
    position: relative;
    z-index: 2;
}

.calendar-table tr.highlight-current {
    background-color: #a0c4ff; /* Um azul pastel para o destaque geral da semana/dia */
    border: 2px solid #4f9dfd; /* Borda geral para destaque */
}

.calendar-table tr.highlight-current .KW {
    background-color: #d7edf4;
    border-color: #64b5f6;
}

.calendar-table td.empty-day {
    color: transparent;
    cursor: default;
}

.calendar-table td:not(.empty-day):hover {
    background-color: #dae4ef;
    cursor: pointer;
}

.calendar-table tr:nth-child(odd) {
    background-color: #f9fafb;
}

.calendar-table tr:nth-child(even) {
    background-color: #e2e8f0;
}

/* --- Legenda --- */
.legend {
    margin-top: 4px;
    padding: 5px;
    background-color: #f1f4f8;
    border-left: 5px solid #2d3748;
    border-radius: 8px;
    line-height: 1.6;
}

.legend-item strong {
    color: #2d3748;
    margin-bottom: 2px;
    display: block;
}

.legend-item span.sa::before,
.legend-item span.so::before,
.legend-item span.holiday::before,
.legend-item span.today::before,
.legend-item span.current-week::before,
.legend-item span.empty-day::before {
    content: '';
    display: inline-block;
    width: 15px;
    height: 15px;
    vertical-align: middle;
    margin-right: 5px;
}

.legend-item span.sa::before { background-color: #d1e8ff; border: 1px solid #a0c4ff; }
.legend-item span.so::before { background-color: #cbd5e0; border: 1px solid #8e9ba9; }
.legend-item span.holiday::before { background-color: #c4e7f4; border: 1px solid #99c0d3; }
.legend-item span.today::before { background-color: #2c5282; border: 1px solid #001f3f; }
.legend-item span.current-week::before { background-color: #e0f2f7; border: 1px solid #64b5f6; }
.legend-item span.empty-day::before { background-color: #f9fafb; border: 1px solid #e2e8f0; }

/* --- Tabela de Turnos --- */
.turnosRafaela {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 15px 0 18px;
    border-radius: 8px;
    overflow: hidden;
}

.turnosRafaela th,
.turnosRafaela td {
    padding: 2px;
    text-align: center;
    border: 1px solid #e2e8f0;
    background-color: #f9fafb;
    color: #4a5568;
    box-sizing: border-box;
    word-wrap: break-word;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.turnosRafaela th {
    background-color: #cbd5e0;
    font-weight: bold;
}

.turnosRafaela th:nth-child(1),
.turnosRafaela td:nth-child(1) {
    width: 15.04%;
    font-weight: bold;
}

.turnosRafaela th:nth-child(n + 2),
.turnosRafaela td:nth-child(n + 2) {
    width: 14.16%;
}

.turnosRafaela .turno {
    background-color: #e6edf7;
    color: #2d3748;
    font-weight: bold;
}

.turnosRafaela td.frei {
    background-color: #edf2f7;
    font-style: italic;
    font-weight: bold;
}

/* --- Tabela de Meses --- */
.month-table {
    width: 99.99%; /* Keep this to avoid potential 100% overflow issues */
    max-width: 600px;
    margin: 20px auto;
    border-collapse: collapse;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    table-layout: fixed; /* Essential for fixed column widths */
}

/* Set the width for each data cell (<td>) */
.month-table td {
    width: 33.33%; /* This makes each column exactly 33.33% wide */
    padding: 7px 7px; /* Reduced padding on TD itself to maximize content space */
    text-align: center;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    vertical-align: top; /* Consistent vertical alignment */
}

/* Style for the header row 'Meses' */
.month-table th {
    padding: 2px 2px;
    text-align: center;
    border: 1px solid #e2e8f0;
    background-color: #cbd5e0;
    font-weight: bold;
    text-transform: uppercase;
    color: #2d3748;
}

/* Apply text overflow properties directly to the <a> tag */
.month-table td a {
    text-decoration: none;
    background-color: #e6edf7;
    color: #2c5282;
    font-weight: bold;
    display: block; /* Makes the link fill the cell, crucial for overflow properties */
    /* Adjust padding here - this is likely the main culprit */
    padding: 8px 5px; /* Consider reducing horizontal padding (e.g., from 15px to 5px) */
    border-radius: 4px;
    transition: background-color 0.3s ease;
    
    white-space: nowrap; /* Prevents the month name (e.g., "Fevereiro") from wrapping if too long */
    overflow: hidden;    /* Hides overflowing content */
    text-overflow: ellipsis; /* Adds "..." for hidden content */
    box-sizing: border-box; /* Ensure padding is included in the element's total width */
}

.month-table td a:hover {
    background-color: #cbd5e0;
    color: #2d3748;
    cursor: pointer;
}
/* --- Rodapé --- */
footer {
    width: 100%;
    margin-top: auto;
    background-color: #2d3748;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 15px 0;
    font-size: 0.9em;
}

/* --- Responsividade --- */
@media (max-width: 600px) {
    .calendar-table th,
    .calendar-table td,
    .turnosRafaela th,
    .turnosRafaela td {
        font-size: 10px;
        padding: 1px;
        white-space: normal;
    }

    .calendar-table .Leandro,
    .calendar-table .Rafaela {
        width: 18%;
    }

    .calendar-table th:not(.Leandro):not(.Rafaela),
    .calendar-table td:not(.Leandro):not(.Rafaela) {
        width: calc((100% - 36%) / 8);
    }

    .turnosRafaela .turno {
        width: 20%;
    }

    .legend-item {
        font-size: 10px;
    }

    .month-table {
        width: 90%;

    }
}

@media (max-width: 400px) {
    .calendar-table th,
    .calendar-table td,
    .turnosRafaela th,
    .turnosRafaela td {
        font-size: 8.5px;
        padding: 1px 2px;
    }

    .legend-item {
        font-size: 9px;
    }

    .month-table {
        width: 95%;

    }
}
