/* Sala de Aula - Elementor Widget Styles - Design "Foco & Fluidez" */

/* Importa a fonte Inter do Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --sala-primary: #4F46E5; /* Indigo */
    --sala-primary-hover: #4338CA;
    --sala-success: #10B981; /* Emerald */
    --sala-background: #FFFFFF;
    --sala-secondary-background: #F3F4F6; /* Cool Gray */
    --sala-text-primary: #111827; /* Almost Black */
    --sala-text-secondary: #6B7280; /* Medium Gray */
    --sala-border: #E5E7EB; /* Light Gray */
}

.sala-theme-dark {
    --sala-primary: #6366F1; /* Brighter Indigo for dark bg */
    --sala-primary-hover: #818CF8;
    --sala-success: #34D399; /* Brighter Emerald */
    --sala-background: #1F2937; /* Dark Slate */
    --sala-secondary-background: #374151; /* Medium Slate */
    --sala-text-primary: #F9FAFB; /* Almost White */
    --sala-text-secondary: #9CA3AF; /* Light Slate */
    --sala-border: #4B5563; /* Slate Border */
}

.sala-de-aula-widget {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 1642px;
    margin: 0 auto;
    background: var(--sala-background);
    border: 1px solid var(--sala-border);
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    /* Força o widget a sair do container do tema */
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}
/* width variants */
.sala-de-aula-widget.sala-width-wide {
    max-width: 1368px;
}
.sala-de-aula-widget.sala-width-full {
    max-width: none;
    border-radius: 0; /* flush edges for full-bleed */
    border: none;
    box-shadow: none;
}
.sala-de-aula-widget.sala-width-full {
    max-width: none;
    width: 100vw;
}

/* Progress Bar */
.sala-progress-container {
    background: var(--sala-secondary-background);
    padding: 20px 30px;
    border-bottom: 1px solid var(--sala-border);
}

.sala-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--sala-text-primary);
}

.sala-progress-percentage {
    color: var(--sala-primary);
    font-size: 16px;
}

.sala-progress-bar {
    width: 100%;
    height: 10px;
    background: var(--sala-border);
    border-radius: 5px;
    overflow: hidden;
}

.sala-progress-fill {
    height: 100%;
    background: var(--sala-primary);
    border-radius: 5px;
    transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Main Content Layout */
.sala-main-content {
    display: grid;
    grid-template-columns: 3fr 1.2fr; /* Adjusted ratio */
    gap: 0;
    min-height: 600px;
}

/* Video Section */
.sala-video-section {
    padding: 30px;
    background: var(--sala-background);
}

.sala-video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    margin-bottom: 25px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.sala-video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.sala-video-player iframe,
.sala-video-player video {
    width: 100%;
    height: 100%;
    border: none;
}

.sala-no-video,
.sala-video-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--sala-text-secondary);
    font-size: 16px;
    background: var(--sala-secondary-background);
}

/* Navigation Buttons */
.sala-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 15px;
}

.sala-nav-btn {
    background: var(--sala-primary);
    color: white;
    border: 2px solid transparent;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sala-nav-btn#sala-back-btn {
    background: transparent;
    color: var(--sala-text-secondary);
    border-color: var(--sala-border);
}

.sala-nav-btn#sala-back-btn:hover:not(:disabled) {
    background: var(--sala-secondary-background);
    color: var(--sala-text-primary);
    border-color: var(--sala-secondary-background);
}

.sala-nav-btn:hover:not(:disabled) {
    background: var(--sala-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.sala-nav-btn:disabled {
    background: var(--sala-border);
    color: var(--sala-text-secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border-color: transparent;
}

/* Lesson Info */
.sala-lesson-info {
    border-top: 1px solid var(--sala-border);
    padding-top: 30px;
}

.sala-lesson-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--sala-text-primary);
    margin: 0 0 15px 0;
    line-height: 1.3;
}

.sala-lesson-description {
    font-size: 16px;
    line-height: 1.7;
    color: var(--sala-text-secondary);
    margin-bottom: 20px;
}

.sala-lesson-button {
    margin-top: 20px;
}

.sala-btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s ease-in-out;
    border: none;
    cursor: pointer;
}

.sala-btn-primary {
    background: var(--sala-primary);
    color: white;
}

.sala-btn-primary:hover {
    background: var(--sala-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
    color: white; /* força manter texto branco no hover */
}

/* Lessons Sidebar */
.sala-lessons-sidebar {
    background: var(--sala-secondary-background);
    border-left: 1px solid var(--sala-border);
    display: flex;
    flex-direction: column;
}

.sala-lessons-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--sala-border);
}

.sala-lessons-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--sala-text-primary);
}

.sala-lessons-list {
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
}

.sala-lesson-item {
    display: flex;
    align-items: center;
    padding: 18px 25px;
    border-bottom: 1px solid var(--sala-border);
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    background: transparent;
}

.sala-lesson-item:hover {
    background: #E5E7EB; /* Light Gray on hover */
}

.sala-lesson-item.active {
    background: var(--sala-primary);
    color: white;
    border-left: 4px solid var(--sala-primary-hover);
    padding-left: 21px;
}

.sala-lessons-sidebar .sala-lesson-item.active {
    background: var(--sala-primary);
}

.sala-lesson-status {
    margin-right: 15px;
    width: 22px;
    text-align: center;
}

.sala-checkmark {
    color: var(--sala-success);
    font-weight: bold;
    font-size: 18px;
}

.sala-lesson-item.active .sala-checkmark {
    color: white;
}

.sala-play-icon {
    color: var(--sala-text-secondary);
    font-size: 14px;
}

.sala-lesson-item.active .sala-play-icon {
    color: white;
}

.sala-lesson-details {
    flex: 1;
}

.sala-lesson-name {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--sala-text-primary);
}

.sala-lesson-item.active .sala-lesson-name {
    color: white;
    font-weight: 600;
}

/* Comments Section */
.sala-comments-section {
    padding: 30px;
    border-top: 1px solid var(--sala-border);
    background: var(--sala-background);
}

.sala-comments-section h4 {
    margin: 0 0 25px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--sala-text-primary);
}

.sala-comment-form {
    margin-bottom: 30px;
}

.sala-comment-form textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 1px solid var(--sala-border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sala-comment-form textarea:focus {
    outline: none;
    border-color: var(--sala-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.sala-login-message {
    padding: 20px;
    background: var(--sala-secondary-background);
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

.sala-login-message a {
    color: var(--sala-primary);
    text-decoration: none;
    font-weight: 600;
}

.sala-comments-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px; /* Space for scrollbar */
}

.sala-comment {
    padding: 20px;
    border: 1px solid var(--sala-border);
    border-radius: 12px;
    margin-bottom: 20px;
    background: var(--sala-background);
}

.sala-comment-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.sala-comment-author {
    font-weight: 600;
    color: var(--sala-text-primary);
    margin-right: 10px;
}

.sala-comment-date {
    font-size: 13px;
    color: var(--sala-text-secondary);
}

.sala-comment-text {
    line-height: 1.7;
    color: var(--sala-text-primary);
}

/* Comment Actions & Replies */
.sala-comment-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.sala-action-btn {
    background: transparent;
    border: 1px solid var(--sala-border);
    color: var(--sala-text-secondary);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.sala-action-btn:hover {
    color: var(--sala-primary);
    border-color: var(--sala-primary);
    background: rgba(79, 70, 229, 0.06);
}

.sala-like-btn.liked {
    color: var(--sala-primary);
    border-color: var(--sala-primary);
    background: rgba(79, 70, 229, 0.08);
}

.sala-like-count {
    margin-left: 6px;
    font-weight: 600;
    color: var(--sala-text-primary);
}

.sala-reply-form {
    margin-top: 12px;
    background: var(--sala-secondary-background);
    border: 1px solid var(--sala-border);
    border-radius: 10px;
    padding: 10px;
}

.sala-reply-text {
    width: 100%;
    min-height: 60px;
    padding: 10px;
    border: 1px solid var(--sala-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.sala-reply-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.sala-replies {
    margin-top: 12px;
    padding-left: 14px;
    border-left: 2px dashed var(--sala-border);
}

.sala-comment.sala-reply {
    background: var(--sala-secondary-background);
    border-color: var(--sala-border);
}
.sala-no-comments {
    text-align: center;
    color: var(--sala-text-secondary);
    font-style: italic;
    padding: 40px 20px;
    background: var(--sala-secondary-background);
    border-radius: 12px;
}

/* Responsive Design */
@media (max-width: 992px) {
    .sala-main-content {
        grid-template-columns: 1fr;
    }
    
    .sala-lessons-sidebar {
        border-left: none;
        border-top: 1px solid var(--sala-border);
    }
}

@media (max-width: 768px) {
    .sala-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .sala-nav-btn {
        width: 100%;
    }
    
    .sala-video-section,
    .sala-comments-section {
        padding: 20px;
    }
    
    .sala-lesson-title {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .sala-de-aula-widget {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .sala-progress-container,
    .sala-video-section,
    .sala-comments-section {
        padding: 15px;
    }
    
    .sala-lesson-title {
        font-size: 22px;
    }
    
    .sala-lesson-item {
        padding: 15px;
    }
}

/* Loading & Animations */
.sala-loading {
    opacity: 0.6;
    pointer-events: none;
}

.sala-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(79, 70, 229, 0.2);
    border-top-color: var(--sala-primary);
    border-radius: 50%;
    animation: sala-spin 0.8s linear infinite;
}

@keyframes sala-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.sala-fade-in {
    animation: salaFadeIn 0.4s ease-out;
}

@keyframes salaFadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Custom Scrollbar */
.sala-lessons-list::-webkit-scrollbar,
.sala-comments-list::-webkit-scrollbar {
    width: 8px;
}

.sala-lessons-list::-webkit-scrollbar-track,
.sala-comments-list::-webkit-scrollbar-track {
    background: transparent;
}

.sala-lessons-list::-webkit-scrollbar-thumb,
.sala-comments-list::-webkit-scrollbar-thumb {
    background: #D1D5DB; /* Gray-300 */
    border-radius: 4px;
}

.sala-lessons-list::-webkit-scrollbar-thumb:hover,
.sala-comments-list::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF; /* Gray-400 */
}

/* Acessibilidade: foco visível nos itens de aula */
.sala-lesson-item:focus {
    outline: 3px solid var(--sala-primary);
    outline-offset: 2px;
}

/* Botões com spinner de loading */
.sala-btn.is-loading {
    position: relative;
    opacity: 0.85;
    pointer-events: none;
}
.sala-btn.is-loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: sala-spin .8s linear infinite;
}
@keyframes sala-spin { to { transform: rotate(360deg); } }

/* Toast notifications */
.sala-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    background: #111827;
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .25s ease, transform .25s ease;
    z-index: 9999;
}
.sala-toast.is-visible { opacity: 1; transform: translateY(0); }
.sala-toast--success { background: #065f46; }
.sala-toast--error { background: #991b1b; }

/* Screen reader utility (fallback caso tema não tenha) */
.screen-reader-text {
    position: absolute !important;
    height: 1px; width: 1px;
    overflow: hidden; clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* Contador de caracteres e ajuda do formulário */
.sala-comment-help { font-size: 12px; color: var(--sala-text-secondary); margin-top: -8px; margin-bottom: 6px; }
.sala-char-counter { font-size: 12px; color: var(--sala-text-secondary); text-align: right; margin-top: -4px; margin-bottom: 10px; }

/* Estado ocupado para formularios */
.sala-comment-form[aria-busy="true"] {
    opacity: 0.7;
}

/* Overlay bloqueado do vídeo */
.sala-video-locked {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centraliza verticalmente */
    align-items: center; /* Centraliza horizontalmente */
    padding: 20px;
    background: #000; /* fallback */
    background-size: cover;
    background-position: center;
    z-index: 10; /* Z-index alto para ficar acima do vídeo */
}
.sala-video-locked::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45); /* aumenta contraste */
    z-index: 1; /* Fica atrás do conteúdo do overlay mas acima do fundo */
    pointer-events: none; /* não bloqueia cliques */
}
.sala-locked-message {
    position: relative; /* acima do overlay */
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    z-index: 20; /* Z-index muito alto para garantir visibilidade */
    text-align: center; /* Centraliza o texto */
}
.sala-locked-actions {
    position: relative; /* acima do overlay */
    display: flex;
    justify-content: center; /* Centraliza o botão horizontalmente */
    z-index: 20; /* Z-index muito alto para garantir que seja clicável */
}
.sala-locked-actions .sala-btn {
    margin: 0 auto; /* centraliza dentro do container */
}
.sala-btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s ease-in-out;
    border: none;
    cursor: pointer;
}

.sala-btn-primary {
    background: var(--sala-primary);
    color: white;
}

.sala-btn-primary:hover {
    background: var(--sala-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
    color: white; /* força manter texto branco no hover */
}