/**
 * SENCE Integration Public Styles
 */

/* SENCE Logo */
.sence-logo-container {
    text-align: center;
    margin-bottom: 15px;
}

.sence-logo {
    max-width: 150px;
    height: auto;
}

.sence-logo-small {
    max-width: 100px;
}

/* Button Container */
.sence-button-container {
    margin: 20px 0;
    padding: 20px;
    background: #f7f7f7;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Messages */
.sence-message {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.sence-message-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.sence-message-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.sence-message p {
    margin: 0;
}

/* Buttons */
.sence-btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.sence-btn-start {
    background: #0073aa;
    color: #fff;
}

.sence-btn-start:hover {
    background: #005177;
}

.sence-btn-close {
    background: #d63638;
    color: #fff;
}

.sence-btn-close:hover {
    background: #a82d2f;
}

.sence-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Session Active */
.sence-session-active {
    text-align: center;
}

.sence-session-info {
    font-weight: 600;
    color: #155724;
    margin-bottom: 10px;
}

/* Timer */
.sence-timer {
    background: #1e1e1e;
    color: #fff;
    padding: 10px 15px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 18px;
    margin-bottom: 15px;
    display: inline-block;
}

.sence-timer-label {
    font-size: 12px;
    opacity: 0.8;
    margin-right: 10px;
}

.sence-timer-value {
    font-weight: bold;
}

.sence-timer.sence-timer-warning {
    background: #856404;
    animation: pulse 1s infinite;
}

.sence-timer.sence-timer-expired {
    background: #721c24;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Fixed Timer Position */
.sence-timer-fixed {
    position: fixed;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.sence-timer-fixed.top-right {
    top: 20px;
    right: 20px;
}

.sence-timer-fixed.top-left {
    top: 20px;
    left: 20px;
}

.sence-timer-fixed.bottom-right {
    bottom: 20px;
    right: 20px;
}

/* CUS Help Links */
.sence-cus-help {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    font-size: 13px;
}

.sence-cus-help p {
    margin: 0 0 8px 0;
    color: #666;
}

.sence-cus-help ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sence-cus-help li {
    display: inline-block;
    margin-right: 15px;
}

.sence-cus-help a {
    color: #0073aa;
    text-decoration: none;
}

.sence-cus-help a:hover {
    text-decoration: underline;
}

/* RUT Form */
.sence-rut-form {
    text-align: center;
}

.sence-rut-form p {
    margin-bottom: 10px;
}

.sence-rut-notice {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: left;
}

.sence-rut-notice h4 {
    margin: 0 0 10px 0;
    color: #856404;
    font-size: 16px;
}

.sence-rut-notice p {
    margin: 0 0 5px 0;
    color: #856404;
    font-size: 14px;
}

.sence-rut-option {
    margin-bottom: 15px;
}

.sence-btn-profile {
    background: #28a745;
    color: #fff;
    text-decoration: none;
}

.sence-btn-profile:hover {
    background: #218838;
    color: #fff;
    text-decoration: none;
}

.sence-rut-quick-entry {
    border-top: 1px solid #ddd;
    padding-top: 15px;
    margin-top: 10px;
}

.sence-rut-toggle-text {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

.sence-rut-input-form {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.sence-rut-input-form input[type="text"] {
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.sence-rut-input-form button {
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.sence-rut-input-form button:hover {
    background: #005177;
}

.sence-btn-save-rut {
    font-size: 14px;
}

/* Login Required */
.sence-login-required {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    color: #856404;
}

/* Content Blocked */
.sence-content-blocked {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    margin: 20px 0;
}

.sence-blocked-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.sence-content-blocked h3 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 20px;
}

.sence-content-blocked p {
    margin: 0 0 15px 0;
    color: #6c757d;
}

.sence-blocked-warning {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    padding: 10px 15px;
    color: #856404;
    font-size: 13px;
    display: inline-block;
    max-width: 500px;
}

/* Close Session Warning */
.sence-close-warning {
    background: #cce5ff;
    border: 1px solid #b8daff;
    border-radius: 4px;
    padding: 12px 15px;
    margin-bottom: 20px;
    color: #004085;
}

.sence-close-warning p {
    margin: 0;
    font-size: 14px;
}

/* Status Badge */
.sence-status {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.sence-status-active {
    background: #d4edda;
    color: #155724;
}

.sence-status-inactive {
    background: #e2e3e5;
    color: #383d41;
}

/* Loading Overlay */
.sence-loading {
    position: relative;
}

.sence-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive */
@media (max-width: 600px) {
    .sence-button-container {
        padding: 15px;
    }

    .sence-btn {
        display: block;
        width: 100%;
    }

    .sence-rut-input-form {
        flex-direction: column;
    }

    .sence-cus-help li {
        display: block;
        margin-bottom: 5px;
    }
}

/* ===========================================
   TUTOR LMS SPECIFIC STYLES
   =========================================== */

/* Tutor Block Container - overlay and message */
.sence-tutor-block-container {
    position: relative;
    z-index: 1000;
}

.sence-tutor-block-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
}

.sence-tutor-block-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.sence-tutor-block-message .sence-button-container {
    margin: 0 0 20px 0;
    background: transparent;
    border: none;
    padding: 0;
}

.sence-tutor-block-message .sence-content-blocked {
    margin: 0;
    padding: 20px;
    border: none;
    background: transparent;
}

/* Ensure RUT input is clickable within block modal */
.sence-tutor-block-message .sence-rut-form,
.sence-tutor-block-message .sence-rut-input-form,
.sence-tutor-block-message .sence-rut-input-form input,
.sence-tutor-block-message .sence-rut-input-form button,
.sence-tutor-block-message input[type="text"],
.sence-tutor-block-message button {
    pointer-events: auto;
    position: relative;
    z-index: 1002;
}

.sence-tutor-block-message .sence-rut-input-form input {
    cursor: text;
}

.sence-tutor-block-message .sence-rut-input-form input:focus {
    outline: 2px solid #0073aa;
    border-color: #0073aa;
}

/* Hide Tutor LMS content when blocked */
body.sence-tutor-blocked .tutor-course-content-wrap,
body.sence-tutor-blocked .tutor-single-course-segment,
body.sence-tutor-blocked .tutor-course-details-tab,
body.sence-tutor-blocked .tutor-course-content-list,
body.sence-tutor-blocked .tutor-course-topics-wrap,
body.sence-tutor-blocked .tutor-course-topics-contents,
body.sence-tutor-blocked .tutor-course-curriculum,
body.sence-tutor-blocked .tutor-lesson-content-area,
body.sence-tutor-blocked .tutor-single-lesson-segment,
body.sence-tutor-blocked .tutor-lesson-video-wrap,
body.sence-tutor-blocked .tutor-video-player,
body.sence-tutor-blocked .tutor-single-course-content,
body.sence-tutor-blocked .tutor-course-content,
body.sence-tutor-blocked .tutor-single-page-top-bar,
body.sence-tutor-blocked .tutor-quiz-wrap,
body.sence-tutor-blocked .tutor-course-purchase-box,
body.sence-tutor-blocked .tutor-course-sidebar,
body.sence-tutor-blocked .tutor-course-details-widget,
body.sence-tutor-blocked .tutor-course-details-widget-item,
body.sence-tutor-blocked .tutor-course-enroll-box,
body.sence-tutor-blocked .tutor-course-complete-form-wrap,
body.sence-tutor-blocked .tutor-course-announcement,
body.sence-tutor-blocked .tutor-course-qa,
body.sence-tutor-blocked .tutor-course-reviews {
    display: none !important;
}

/* Keep the header and basic info visible but blur sensitive content */
body.sence-tutor-blocked .tutor-course-content-list-wrap {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

/* Curriculum blocked (blurred) */
.sence-curriculum-blocked {
    position: relative;
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
}

.sence-curriculum-blocked::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.5);
}

/* Lesson blocked message */
.sence-lesson-blocked {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
    border-radius: 8px;
    margin: 20px;
}

.sence-lesson-blocked .sence-blocked-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.sence-lesson-blocked h3 {
    font-size: 24px;
    color: #333;
    margin-bottom: 15px;
}

.sence-lesson-blocked p {
    color: #666;
    font-size: 16px;
    margin-bottom: 20px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.sence-lesson-blocked .sence-btn {
    display: inline-block;
    text-decoration: none;
    background: #0073aa;
    color: #fff;
}

.sence-lesson-blocked .sence-btn:hover {
    background: #005177;
    color: #fff;
}

/* Show SENCE message prominently in Tutor */
body.sence-tutor-blocked .sence-button-container {
    position: relative;
    z-index: 100;
}

/* Ensure the block message is visible above everything */
body.sence-tutor-blocked main,
body.sence-tutor-blocked .tutor-wrap,
body.sence-tutor-blocked .tutor-single-course-main-content {
    position: relative;
}

/* Animation for blocked overlay */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.sence-tutor-block-overlay,
.sence-tutor-block-message {
    animation: fadeIn 0.3s ease-out;
}

/* Responsive adjustments for Tutor blocking */
@media (max-width: 768px) {
    .sence-tutor-block-message {
        padding: 20px;
        width: 95%;
    }

    .sence-lesson-blocked {
        padding: 40px 15px;
        margin: 10px;
    }

    .sence-lesson-blocked h3 {
        font-size: 20px;
    }

    .sence-lesson-blocked p {
        font-size: 14px;
    }
}

/* ===========================================
   TUTOR LMS SESSION PANEL (when active)
   =========================================== */

.sence-tutor-session-panel {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 15px 20px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.sence-tutor-session-panel .sence-logo-container {
    margin: 0;
    flex-shrink: 0;
}

.sence-session-info-inline {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
}

.sence-session-status {
    font-weight: 600;
    color: #2e7d32;
    font-size: 14px;
}

.sence-timer-inline {
    margin: 0;
}

.sence-btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

/* Tutor LMS status message container */
.sence-tutor-status-message {
    margin: 15px 0;
}

.sence-tutor-status-message .sence-message {
    margin: 0;
}

/* Session closed confirmation - more prominent */
.sence-message-closed {
    padding: 20px;
    font-size: 16px;
    border-width: 2px;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

.sence-message-closed p {
    font-weight: 500;
}

/* Container for actions after session is closed */
.sence-session-closed-actions {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.sence-session-closed-actions .sence-button-container {
    display: inline-block;
}

.sence-session-closed-actions .sence-btn-start {
    padding: 12px 24px;
    font-size: 14px;
}

/* Inactivity alert modal */
.sence-inactivity-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sence-inactivity-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.sence-inactivity-content h3 {
    color: #856404;
    margin: 0 0 15px 0;
}

.sence-inactivity-content p {
    margin: 0 0 20px 0;
    color: #333;
}

.sence-inactivity-btn {
    background: #28a745;
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
}

.sence-inactivity-btn:hover {
    background: #218838;
}

/* ===========================================
   SESSION CLOSURE/START CONFIRMATION MODAL
   =========================================== */

.sence-closure-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.sence-closure-content {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.sence-closure-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
    font-size: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.3);
}

.sence-started-icon {
    background: linear-gradient(135deg, #0073aa 0%, #00b4d8 100%);
    box-shadow: 0 8px 20px rgba(0, 115, 170, 0.3);
}

.sence-closure-content h3 {
    font-size: 24px;
    color: #28a745;
    margin: 0 0 15px 0;
    font-weight: 700;
}

.sence-started-modal .sence-closure-content h3 {
    color: #0073aa;
}

.sence-closure-main-text {
    font-size: 16px;
    color: #333;
    margin: 0 0 15px 0;
    line-height: 1.5;
}

.sence-modal-duration {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 15px 20px;
    margin: 15px 0;
    font-size: 18px;
}

.sence-duration-value {
    color: #2e7d32;
    font-weight: 700;
    font-size: 20px;
}

.sence-closure-info {
    font-size: 14px;
    color: #666;
    margin: 0 0 20px 0;
}

.sence-closure-warning {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 6px;
    padding: 12px 15px;
    margin: 15px 0 20px 0;
    color: #856404;
    font-size: 14px;
    text-align: left;
}

.sence-closure-btn {
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    background: #28a745;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sence-closure-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.sence-started-modal .sence-closure-btn.sence-btn-start {
    background: #0073aa;
}

.sence-started-modal .sence-closure-btn.sence-btn-start:hover,
.sence-started-modal .sence-closure-btn.sence-btn-continue:hover {
    background: #005177;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.sence-started-modal .sence-closure-btn.sence-btn-continue {
    background: #0073aa;
}

/* Modal Logo */
.sence-modal-logo {
    text-align: center;
    margin-bottom: 15px;
}

.sence-modal-logo img {
    max-width: 120px;
    height: auto;
}

/* Responsive */
@media (max-width: 480px) {
    .sence-closure-content {
        padding: 25px 20px;
    }

    .sence-closure-icon {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }

    .sence-closure-content h3 {
        font-size: 20px;
    }

    .sence-closure-main-text {
        font-size: 14px;
    }

    .sence-modal-duration {
        padding: 10px 15px;
        font-size: 16px;
    }

    .sence-duration-value {
        font-size: 18px;
    }
}

/* Responsive for session panel */
@media (max-width: 600px) {
    .sence-tutor-session-panel {
        flex-direction: column;
        text-align: center;
    }

    .sence-session-info-inline {
        flex-direction: column;
        justify-content: center;
    }
}
