/* Reset e estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* Grid de calendário */
.calendario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 30px;
    background: #f8f9fa;
}

/* Container do mês */
.mes-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mes-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.mes-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    text-align: center;
}

.mes-header h2 {
    font-size: 1.3em;
    font-weight: 600;
}

/* Tabela do calendário */
.calendario-mes {
    width: 100%;
    border-collapse: collapse;
}

.calendario-mes thead th {
    padding: 10px 5px;
    background: #f1f3f5;
    font-weight: 600;
    font-size: 0.85em;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.calendario-mes tbody td {
    width: 14.28%; /* 100% / 7 dias */
    height: 0;
    padding-bottom: 14.28%; /* Células quadradas */
    vertical-align: top;
    border: 1px solid #e9ecef;
    background: white;
    position: relative;
}

/* Célula do dia */
.dia-celula {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dia-celula:hover {
    background-color: #f8f9fa;
}

.dia-celula.hoje {
    border: 2px solid #667eea;
    box-shadow: inset 0 0 10px rgba(102, 126, 234, 0.3);
}

.dia-numero {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    font-size: 0.9em;
    color: #000;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

/* Indicador de atividade (ponto vermelho) */
.indicador-atividade {
    display: block;
    width: 8px;
    height: 8px;
    background-color: #dc3545;
    border-radius: 50%;
    cursor: pointer;
    animation: pulse 2s infinite;
    z-index: 10;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Indicador de reunião (quadrado cinza) */
.indicador-reuniao {
    display: block;
    width: 8px;
    height: 8px;
    background-color: #6c757d;
    cursor: pointer;
    z-index: 10;
}

.indicador-reuniao:hover {
    background-color: #495057;
}

/* Eventos do dia (barras coloridas) */
.eventos-dia {
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.evento-barra {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    position: relative;
}

.evento-barra:hover {
    opacity: 0.9;
}

.evento-tipo {
    display: none; /* Não mostrar texto dos eventos - apenas cores */
}

/* Tooltip de atividades - VERSÃO MELHORADA */
.tooltip-atividades {
    position: fixed;
    background: rgba(33, 37, 41, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    pointer-events: auto !important;
    z-index: 10000;
    display: none;
    max-width: 400px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.tooltip-atividades.show {
    display: block;
}

.tooltip-atividades h4 {
    margin: 0 0 8px 0;
    font-size: 1em;
    color: #ffc107;
    padding-bottom: 5px;
}

/* Header do tooltip com layout flexbox */
.tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 5px;
}

.tooltip-header h4 {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    flex: 1;
}

/* Botão X - VERSÃO MELHORADA */
.tooltip-close {
    position: relative;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    background: #dc3545;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer !important;
    font-size: 18px;
    line-height: 22px;
    text-align: center;
    font-weight: bold;
    pointer-events: auto !important;
    z-index: 10001;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.tooltip-close:hover {
    background: #c82333;
    transform: scale(1.15);
    border-color: #ffc107;
}

.tooltip-close:active {
    transform: scale(0.95);
}

.tooltip-atividades ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tooltip-atividades li {
    margin: 5px 0;
    padding-left: 15px;
    position: relative;
}

.tooltip-atividades li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #ffc107;
    font-weight: bold;
}

.atividade-hora {
    color: #ffc107;
    font-weight: 600;
    margin-right: 5px;
}

/* Estilo para pares de reunião (4 por linha) */
.reuniao-pares {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.reuniao-par {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 8px;
    border-radius: 4px;
    text-align: center;
    font-size: 0.85em;
}

.reuniao-par .hora {
    color: #ffc107;
    font-weight: 600;
}

.reuniao-par .turma {
    color: #fff;
}

/* Footer */
.calendario-footer {
    background: #f8f9fa;
    padding: 30px;
    border-top: 3px solid #dee2e6;
}

.calendario-footer h3 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.5em;
}

/* Legenda */
.legenda-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.legenda-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.legenda-item:hover {
    transform: translateX(5px);
}

.legenda-cor {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    margin-right: 12px;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.legenda-texto {
    font-size: 0.95em;
    color: #495057;
    font-weight: 500;
}

.legenda-quantidade {
    color: #868e96;
    font-weight: 600;
    margin-left: 5px;
}

/* Informação adicional */
.info-adicional {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #dee2e6;
}

.info-adicional p {
    color: #6c757d;
    margin: 8px 0;
    display: flex;
    align-items: center;
}

.indicador-atividade-exemplo {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: #dc3545;
    border-radius: 50%;
    margin-right: 8px;
}

.indicador-reuniao-exemplo {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: #6c757d;
    margin-right: 8px;
}

.data-atualizacao {
    font-style: italic;
    color: #868e96;
    font-size: 0.9em;
}

/* Responsividade */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .calendario-grid {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    
    .calendario-mes tbody td {
        height: 60px;
    }
    
    .evento-tipo {
        font-size: 0.6em;
    }
    
    .legenda-container {
        grid-template-columns: 1fr;
    }
    
    .reuniao-pares {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Botão de impressão/PDF */
.btn-imprimir {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin: 20px 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-imprimir:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-imprimir:active {
    transform: translateY(0);
}

.btn-imprimir svg {
    width: 20px;
    height: 20px;
}

/* Estilos para impressão - LANDSCAPE 1 PÁGINA */
@media print {
    body {
        background: white;
        padding: 0;
        margin: 0;
    }
    
    .container {
        box-shadow: none;
        max-width: 100%;
        border-radius: 0;
    }
    
    /* Header compacto */
    header {
        background: white !important;
        color: #333 !important;
        border-bottom: 2px solid #333;
        page-break-after: avoid;
        padding: 10px 15px !important;
    }
    
    header h2 {
        font-size: 0.9em !important;
        margin-bottom: 3px !important;
        color: #333 !important;
        text-shadow: none !important;
    }
    
    header h1 {
        font-size: 1.3em !important;
        color: #333 !important;
        text-shadow: none !important;
        margin: 0 !important;
    }
    
    .btn-imprimir {
        display: none !important;
    }
    
    /* Grid compacto - 4 colunas para caber tudo */
    .calendario-grid {
        background: white;
        gap: 5px !important;
        padding: 10px !important;
        grid-template-columns: repeat(4, 1fr) !important;
        page-break-inside: avoid;
    }
    
    /* Containers dos meses mais compactos */
    .mes-container {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
        margin-bottom: 0;
    }
    
    .mes-header {
        background: #f8f9fa !important;
        color: #333 !important;
        border-bottom: 1px solid #333;
        padding: 5px !important;
    }
    
    .mes-header h2 {
        font-size: 0.85em !important;
        margin: 0 !important;
    }
    
    /* Tabela do calendário mais compacta */
    .calendario-mes thead th {
        padding: 3px 2px !important;
        font-size: 0.65em !important;
    }
    
    .calendario-mes tbody td {
        font-size: 0.7em !important;
    }
    
    .dia-numero {
        font-size: 0.75em !important;
    }
    
    .indicador-atividade {
        width: 5px !important;
        height: 5px !important;
    }
    
    .indicador-reuniao {
        width: 5px !important;
        height: 5px !important;
    }
    
    /* Evento barra mais fina */
    .evento-barra {
        opacity: 0.6 !important;
    }
    
    /* Esconder tooltip */
    .tooltip-atividades {
        display: none !important;
    }
    
    /* Footer compacto */
    .calendario-footer {
        padding: 10px 15px !important;
        page-break-before: avoid;
    }
    
    .calendario-footer h3 {
        font-size: 1em !important;
        margin-bottom: 8px !important;
    }
    
    /* Legenda mais compacta */
    .legenda-container {
        gap: 5px !important;
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    .legenda-item {
        box-shadow: none;
        border: 1px solid #ddd;
        padding: 4px 6px !important;
        font-size: 0.7em !important;
    }
    
    .legenda-cor {
        width: 20px !important;
        height: 20px !important;
        margin-right: 6px !important;
    }
    
    .legenda-texto {
        font-size: 0.85em !important;
    }
    
    .info-adicional {
        margin-top: 8px !important;
        padding-top: 8px !important;
        font-size: 0.75em !important;
    }
    
    .info-adicional p {
        margin: 3px 0 !important;
    }
    
    /* Logo menor */
    .footer-logo {
        margin-top: 10px !important;
        padding-top: 10px !important;
    }
    
    .footer-logo img {
        max-width: 200px !important;
    }
    
    /* Configuração da página - LANDSCAPE */
    @page {
        size: A4 landscape;
        margin: 8mm;
    }
    
    /* Garantir que tudo cabe em 1 página */
    html, body {
        height: 100%;
        overflow: hidden;
    }
    
    .container {
        display: flex;
        flex-direction: column;
        height: 100vh;
    }
    
    .calendario-grid {
        flex: 1;
        overflow: hidden;
    }
}

/* Logo rodapé */
.footer-logo {
    text-align: center;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #dee2e6;
}

.footer-logo img {
    max-width: 400px;
    height: auto;
}

/* Garantir que barras de eventos não interferem com tooltips */
.evento-barra {
    pointer-events: none;
}

@media print {
    .footer-logo img {
        max-width: 300px;
    }
}

/* Botões em grupo */
.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Botão Gerar PDF */
.btn-pdf {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-pdf:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.btn-pdf:active {
    transform: translateY(0);
}

.btn-pdf svg {
    width: 20px;
    height: 20px;
}

/* Loading spinner */
.loading-spinner {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px 50px;
    border-radius: 10px;
    z-index: 99999;
    font-size: 1.2em;
    text-align: center;
}

.loading-spinner.show {
    display: block;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Esconder botões na impressão */
@media print {
    .btn-group,
    .loading-spinner {
        display: none !important;
    }
}