/* 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-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --sala-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.sala-theme-dark {
    --sala-primary: #3ea6ff; /* YouTube Blue/Blueish */
    --sala-primary-hover: #65b8ff;
    --sala-success: #2ba640; /* Green */
    --sala-background: #0f0f0f; /* YouTube Dark BG */
    --sala-secondary-background: #0f0f0f; /* Secondary same as bg usually */
    --sala-text-primary: #f1f1f1; /* White text */
    --sala-text-secondary: #aaaaaa; /* Gray text */
    --sala-border: #3f3f3f; /* Subtle border */
    --sala-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    
    /* Extra vars for dark mode specific overrides */
    --sala-hover-bg: #272727;
    --sala-active-bg: #272727;
    --sala-bubble-bg: #272727; /* Dark bubble */
    --sala-input-bg: #0f0f0f;
    --sala-input-border: #3f3f3f;
}

/* Override bubble color in dark mode */
.sala-theme-dark .sala-comment-bubble {
    background-color: var(--sala-bubble-bg);
    color: var(--sala-text-primary);
}

.sala-theme-dark .sala-comment-content {
    color: var(--sala-text-primary);
}

.sala-theme-dark .sala-comment-author {
    color: var(--sala-text-primary);
}

.sala-theme-dark .sala-comment-actions,
.sala-theme-dark .sala-action-link,
.sala-theme-dark .sala-comment-time {
    color: #aaaaaa;
}

.sala-theme-dark .sala-action-link:hover {
    color: #f1f1f1;
}

/* L-shape connector color in dark mode */
.sala-theme-dark .sala-comment-item.sala-comment-reply::before {
    border-color: #3f3f3f;
}

/* Input/Textarea in dark mode */
.sala-theme-dark .sala-comment-form textarea {
    background-color: var(--sala-input-bg);
    border-color: var(--sala-input-border);
    color: var(--sala-text-primary);
}

.sala-theme-dark .sala-comment-form textarea::placeholder {
    color: #666;
}

/* Lesson list hover/active in dark mode */
.sala-theme-dark .sala-lesson-item:hover {
    background-color: var(--sala-hover-bg);
}

.sala-theme-dark .sala-lesson-item.active {
    background-color: var(--sala-active-bg);
    border-left-color: var(--sala-primary);
    color: var(--sala-text-primary);
}

/* Navigation buttons in dark mode */
.sala-theme-dark .sala-prev-btn {
    color: var(--sala-text-primary);
    border-color: var(--sala-border);
}

.sala-theme-dark .sala-prev-btn:hover:not(:disabled) {
    background-color: var(--sala-hover-bg);
    border-color: var(--sala-hover-bg);
}

.sala-theme-dark .sala-lesson-name {
    color: var(--sala-text-primary);
}

.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: var(--sala-shadow);
    overflow: hidden;
    /* Força o widget a sair do container do tema */
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

/* 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;
}

/* 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: 999px;
    overflow: hidden;
}

.sala-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sala-primary) 0%, #818CF8 100%);
    border-radius: 999px;
    transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.3);
}

/* Main Content Layout */
.sala-main-content {
    display: grid;
    grid-template-columns: 3fr 300px; /* Sidebar fixa em 300px */
    gap: 0;
    min-height: 600px;
    position: relative;
}

/* Video Section */
.sala-video-section {
    padding: 30px;
    background: var(--sala-background);
    border-right: 1px solid var(--sala-border);
}

.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;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.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);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

/* Video Locked Overlay */
.sala-video-locked {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.sala-video-locked::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Dark overlay */
    z-index: 1;
}

.sala-locked-message,
.sala-locked-actions {
    position: relative;
    z-index: 2;
    text-align: center;
}

.sala-locked-message {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Sidebar (Lessons List) */
.sala-lessons-sidebar {
    background: var(--sala-secondary-background);
    display: flex;
    flex-direction: column;
    max-height: 100%;
    overflow-y: auto;
}

.sala-lessons-header {
    padding: 20px;
    border-bottom: 1px solid var(--sala-border);
    background: var(--sala-background);
}

.sala-lessons-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--sala-text-primary);
}

.sala-lessons-list {
    flex: 1;
    overflow-y: auto;
}

.sala-lesson-item {
    padding: 15px 20px;
    border-bottom: 1px solid var(--sala-border);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sala-lesson-item:hover {
    background: rgba(0,0,0,0.02);
}

.sala-lesson-item.active {
    background: #fff;
    border-left: 4px solid var(--sala-primary);
}

.sala-lesson-item.completed .sala-lesson-name {
    text-decoration: line-through;
    opacity: 0.7;
}

.sala-lesson-status {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sala-success);
}

.sala-lesson-details {
    flex: 1;
}

.sala-lesson-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--sala-text-primary);
    line-height: 1.4;
}

/* General Button Styles (Shared) */
.sala-btn {
    display: inline-block;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 10px 20px;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 6px;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    cursor: pointer;
    text-decoration: none;
}

.sala-btn-primary {
    color: #fff;
    background-color: var(--sala-primary);
    border-color: var(--sala-primary);
}

.sala-btn-primary:hover {
    color: #fff;
    background-color: var(--sala-primary-hover);
    border-color: var(--sala-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
}

.sala-lesson-button {
    margin-top: 20px;
}

/* 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: 50px; /* Pill Shape */
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.sala-nav-btn#sala-back-btn,
.sala-prev-btn {
    background: transparent;
    color: var(--sala-text-secondary);
    border-color: var(--sala-border);
}

.sala-nav-btn:hover:not(:disabled) {
    background: var(--sala-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    color: white;
}

.sala-prev-btn:hover:not(:disabled) {
    background: var(--sala-secondary-background);
    color: var(--sala-text-primary);
    border-color: var(--sala-secondary-background);
    box-shadow: none;
}

.sala-nav-btn:active:not(:disabled) {
    transform: translateY(0);
}

.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: 24px;
    font-weight: 700;
    color: var(--sala-text-primary);
    margin-bottom: 15px;
    line-height: 1.3;
}

.sala-lesson-description {
    color: var(--sala-text-secondary);
    line-height: 1.6;
    font-size: 16px;
}

/* Comments Section */
.sala-comments-section {
    padding: 30px;
    border-top: 1px solid var(--sala-border);
    background: var(--sala-secondary-background);
}

.sala-comments-section h4 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    color: var(--sala-text-primary);
}

.sala-comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 1px solid var(--sala-border);
    border-radius: 8px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 10px;
}

.sala-comment-help,
.sala-char-counter {
    font-size: 12px;
    color: var(--sala-text-secondary);
    margin-bottom: 15px;
}

#sala-submit-comment {
    margin-bottom: 20px;
}

/* Comments List Styles - Facebook Style */
.sala-comment-item {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    position: relative;
    border: none;
    background: transparent;
    padding: 0;
}

/* Avatar */
.sala-avatar {
    flex-shrink: 0;
}

.sala-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.sala-avatar.sala-avatar-small img {
    width: 24px;
    height: 24px;
}

/* Comment Body */
.sala-comment-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Bubble */
.sala-comment-bubble {
    background-color: #f0f2f5;
    padding: 8px 12px;
    border-radius: 18px;
    display: inline-block;
    position: relative;
}

.sala-comment-author {
    font-weight: 600;
    color: var(--sala-text-primary);
    font-size: 13px;
    line-height: 1.2;
    margin-bottom: 2px;
}

.sala-comment-content {
    color: var(--sala-text-primary);
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    margin: 0;
}

/* Actions (Like, Reply, Time) */
.sala-comment-actions {
    display: flex;
    gap: 12px;
    margin-top: 2px;
    margin-left: 12px;
    padding: 0;
    border: none;
    font-size: 12px;
    color: #65676b;
}

.sala-action-link {
    background: none;
    border: none;
    padding: 0;
    font-weight: 600;
    font-size: 12px;
    color: #65676b;
    cursor: pointer;
    transition: text-decoration 0.2s;
}

.sala-action-link:hover {
    text-decoration: underline;
    background: none;
    color: #65676b;
}

.sala-action-link.liked {
    color: var(--sala-primary);
}

.sala-comment-time {
    font-weight: 400;
}

/* Replies */
.sala-replies {
    width: 100%;
    margin-top: 8px;
}

.sala-comment-item.sala-comment-reply {
    margin-left: 0; /* Reset previous margin */
    padding: 0;
    background: transparent;
    border: none;
    margin-bottom: 10px;
}

/* L-shape connector for replies */
.sala-comment-item.sala-comment-reply::before {
    content: '';
    position: absolute;
    top: -20px; /* Adjust based on parent height */
    left: -22px; /* Position relative to avatar */
    width: 30px;
    height: 35px; /* Curve height */
    border-bottom: 2px solid #e5e7eb;
    border-left: 2px solid #e5e7eb;
    border-bottom-left-radius: 12px;
    z-index: 0;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sala-comment-item.sala-comment-reply::before {
        display: none; /* Hide connector on mobile if too complex */
    }
}



/* Responsive */
@media (max-width: 1024px) {
    .sala-main-content {
        grid-template-columns: 1fr;
    }
    
    .sala-video-section {
        padding: 20px;
        border-right: none;
        border-bottom: 1px solid var(--sala-border);
    }

    .sala-lessons-sidebar {
        max-height: 400px; /* Limit height on mobile */
    }
}
