/**
 * XFIT Grade de Aulas - Design Premium Minimalista
 * Versão 1.3.5 - Totalmente alinhado com identidade visual XFIT
 * Design: Clean, Moderno, Profissional
 * Atualização: Badge cancelada corrigido + Aulas canceladas funcionando
 */

/* ===== FORÇA CENTRALIZAÇÃO - Override tema WordPress ===== */
body .xfit-grade-container,
.entry-content .xfit-grade-container,
.site-content .xfit-grade-container,
article .xfit-grade-container,
main .xfit-grade-container {
    margin-left: auto !important;
    margin-right: auto !important;
    float: none !important;
    text-align: left !important;
}

/* ===== RESET E BASE ===== */
.xfit-grade-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto !important;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    box-sizing: border-box;
    position: relative;
    left: 0 !important;
    right: 0 !important;
}

/* ===== HEADER - Elegante e Simples ===== */
.xfit-grade-header {
    margin: 0 auto 48px auto !important;
    padding-bottom: 32px;
    border-bottom: 2px solid #000000;
    width: 100%;
    max-width: 1400px;
    box-sizing: border-box;
    text-align: center;
}

.xfit-periodo {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: #fff !important;
    background: transparent !important;
    letter-spacing: -0.5px;
    text-transform: uppercase;
}

/* Se tema aplicar fundo preto, forçar texto preto visível */
body .xfit-periodo,
.entry-content .xfit-periodo,
h3.xfit-periodo {
    color: #000000 !important;
    background: transparent !important;
}

/* ===== GRADE SEMANAL - Grid Premium ===== */
.xfit-grade-semanal {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    margin: 0 auto 60px auto !important;
    width: 100%;
    max-width: 1400px;
    box-sizing: border-box;
    padding: 0 !important;
    justify-content: center;
}

/* ===== COLUNA DE DIA - Card Minimalista ===== */
.xfit-dia-coluna {
    background: #ffffff;
    border: 2px solid #000000;
    border-radius: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.xfit-dia-coluna:hover {
    transform: translateY(-4px);
    box-shadow: 8px 8px 0px #000000;
}

/* ===== HEADER DO DIA - Bold e Marcante ===== */
.xfit-dia-header {
    background: #000000;
    padding: 20px 16px;
    text-align: center;
    position: relative;
}

.xfit-dia-header h4 {
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    text-transform: uppercase !important;
    letter-spacing: 2px !important;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    line-height: 1 !important;
}

.xfit-dia-numero {
    display: block;
    font-size: 28px;
    font-weight: 900;
    color: #ffffff;
    margin-top: 8px;
    line-height: 1;
}

/* ===== LISTA DE AULAS - Organizada ===== */
.xfit-aulas-lista {
    padding: 0;
    background: #ffffff;
}

.xfit-sem-aulas {
    padding: 40px 20px;
    text-align: center;
    color: #999999;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== CARD DE AULA - Premium Clean ===== */
.xfit-aula-card {
    background: #ffffff;
    border: none;
    border-top: 2px solid #f0f0f0;
    border-radius: 0;
    padding: 24px 20px;
    position: relative;
    transition: all 0.3s ease;
}

.xfit-aula-card:first-child {
    border-top: none;
}

.xfit-aula-card:hover {
    background: #fafafa;
    padding-left: 28px;
}

.xfit-aula-card.cancelada {
    opacity: 0.4;
    background: #f5f5f5;
}

/* ===== HORÁRIO - Destaque ===== */
.xfit-horario {
    font-size: 18px;
    font-weight: 900;
    color: #000000;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.xfit-horario::before {
    content: '';
    width: 4px;
    height: 20px;
    background: #000000;
    display: inline-block;
}

/* ===== MODALIDADE - Título Principal ===== */
.xfit-modalidade {
    font-size: 16px;
    font-weight: 800;
    color: #000000;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== PROFESSOR - Subtítulo ===== */
.xfit-professor {
    font-size: 13px;
    font-weight: 600;
    color: #666666;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.xfit-professor::before {
    content: '●';
    color: #000000;
    font-size: 8px;
}

/* ===== AMBIENTE - Info Adicional ===== */
.xfit-ambiente {
    font-size: 12px;
    font-weight: 600;
    color: #999999;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== VAGAS - Sistema de Disponibilidade ===== */
.xfit-vagas {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.xfit-vagas-bar {
    width: 100%;
    height: 6px;
    background: #f0f0f0;
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid #e0e0e0;
}

.xfit-vagas-fill {
    height: 100%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
    background: #000000 !important;
}

/* Barra VERMELHA quando lotada */
.xfit-fill-lotada {
    background: #dc2626 !important;
}

/* Barra LARANJA quando poucas vagas */
.xfit-fill-poucas {
    background: #ea580c !important;
}

.xfit-vagas-texto {
    font-size: 12px;
    font-weight: 700;
    color: #000000;
    display: block;
    text-align: right;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Status DISPONÍVEL = Verde */
.xfit-vagas-disponivel {
    color: #16a34a !important; /* Verde */
}

/* Status POUCAS VAGAS = Laranja */
.xfit-vagas-poucas {
    color: #ea580c !important; /* Laranja */
}

/* Status LOTADA = Vermelho */
.xfit-vagas-lotada {
    color: #dc2626 !important; /* Vermelho */
}

/* ===== BADGE CANCELADA ===== */
.xfit-badge-cancelada {
    display: inline-block;
    background: #dc2626; /* Vermelho */
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 0;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    border: 2px solid #dc2626;
    margin-top: 12px;
    line-height: 1;
}

/* ===== LEGENDA - Informativa ===== */
.xfit-legenda {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 48px;
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid #000000;
}

.xfit-legenda-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.xfit-legenda-label {
    font-size: 12px;
    color: #000000;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.xfit-badge {
    width: 20px;
    height: 20px;
    border-radius: 0;
    display: inline-block;
    border: 2px solid #000000;
}

.xfit-badge.disponivel {
    background: #16a34a; /* Verde */
    border-color: #16a34a;
}

.xfit-badge.lotada {
    background: #dc2626; /* Vermelho */
    border-color: #dc2626;
}

.xfit-badge.cancelada {
    background: #6b7280; /* Cinza */
    border-color: #6b7280;
}

/* ===== ÚLTIMA ATUALIZAÇÃO - Discreto ===== */
.xfit-ultima-atualizacao {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e5e5;
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* ===== LOADING - Elegante ===== */
.xfit-loading {
    text-align: center;
    padding: 80px 20px;
    font-size: 14px;
    font-weight: 700;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.xfit-loading::after {
    content: '...';
    display: inline-block;
    animation: xfit-dots 1.5s infinite;
}

@keyframes xfit-dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ===== ERRO - Informativo ===== */
.xfit-erro {
    text-align: center;
    padding: 60px 20px;
    background: #fafafa;
    border: 2px solid #000000;
    border-radius: 0;
    margin: 40px 0;
}

.xfit-erro p {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== RESPONSIVO - TABLET ===== */
@media (max-width: 992px) {
    .xfit-grade-semanal {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .xfit-periodo {
        font-size: 20px;
    }

    .xfit-legenda {
        gap: 20px;
        flex-wrap: wrap;
        padding-top: 32px;
        margin-top: 48px;
    }
}

/* ===== RESPONSIVO - MOBILE ===== */
@media (max-width: 768px) {
    .xfit-grade-container {
        padding: 24px 16px;
    }

    .xfit-grade-semanal {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .xfit-grade-header {
        margin-bottom: 32px;
        padding-bottom: 20px;
    }

    .xfit-periodo {
        font-size: 18px;
        letter-spacing: 0;
    }

    .xfit-dia-header h4 {
        font-size: 13px !important;
        letter-spacing: 1.5px !important;
    }

    .xfit-dia-numero {
        font-size: 24px;
        margin-top: 6px;
    }

    .xfit-aula-card {
        padding: 20px 16px;
    }

    .xfit-horario {
        font-size: 16px;
    }

    .xfit-modalidade {
        font-size: 15px;
    }

    .xfit-professor {
        font-size: 12px;
    }

    .xfit-ambiente {
        font-size: 11px;
    }

    .xfit-legenda {
        gap: 12px;
        margin-top: 32px;
        padding-top: 24px;
        justify-content: space-evenly;
    }

    .xfit-legenda-item {
        gap: 8px;
    }

    .xfit-legenda-item span:not(.xfit-badge) {
        font-size: 10px;
        letter-spacing: 0.5px;
    }

    .xfit-badge {
        width: 14px;
        height: 14px;
    }

    .xfit-ultima-atualizacao {
        font-size: 10px;
        margin-top: 20px;
        padding-top: 20px;
    }
}

/* ===== MOBILE PEQUENO ===== */
@media (max-width: 480px) {
    .xfit-grade-container {
        padding: 20px 12px;
    }

    .xfit-periodo {
        font-size: 16px;
    }

    .xfit-btn-prev,
    .xfit-btn-next {
        padding: 10px 16px;
        font-size: 10px;
    }

    .xfit-aula-card {
        padding: 16px 12px;
    }

    .xfit-legenda {
        flex-direction: row;
        gap: 16px;
        justify-content: center;
        flex-wrap: wrap;
        padding-top: 20px;
        margin-top: 24px;
    }

    .xfit-legenda-item {
        gap: 6px;
        min-width: fit-content;
    }

    .xfit-legenda-item span:not(.xfit-badge) {
        font-size: 9px;
        letter-spacing: 0.3px;
        white-space: nowrap;
    }

    .xfit-badge {
        width: 12px;
        height: 12px;
    }

    .xfit-ultima-atualizacao {
        font-size: 9px;
        margin-top: 16px;
        padding-top: 16px;
        letter-spacing: 0.2px;
    }
}

/* ===== ACESSIBILIDADE ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== IMPRESSÃO ===== */
@media print {
    .xfit-btn-prev,
    .xfit-btn-next {
        display: none;
    }

    .xfit-dia-coluna {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .xfit-aula-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
