/**
 * Enhanced Tutor Interface Features
 * Adaptive content zones, smart scrolling, and question isolation mode
 */

/* ============================
   Adaptive Content Zones
   ============================ */

.sfpe-content-zones {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 90px 40px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.sfpe-content-zone {
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sfpe-zone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    cursor: pointer;
    user-select: none;
    position: relative;
}

.sfpe-zone-header:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.sfpe-zone-title {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 18px;
    font-weight: 600;
    color: #2C3E50;
}

.sfpe-zone-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2C3E50;
    color: white;
    border-radius: 50%;
    font-size: 14px;
}

.sfpe-zone-toggle {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.sfpe-zone-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.sfpe-content-zone.collapsed .sfpe-zone-toggle svg {
    transform: rotate(-90deg);
}

.sfpe-zone-content {
    padding: 30px;
    max-height: 600px;
    overflow-y: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sfpe-content-zone.collapsed .sfpe-zone-content {
    max-height: 0;
    padding: 0 30px;
    opacity: 0;
}

/* Zone-specific styles */
.sfpe-zone-overview .sfpe-zone-icon { background: #3498db; }
.sfpe-zone-current .sfpe-zone-icon { background: #e74c3c; }
.sfpe-zone-qa .sfpe-zone-icon { background: #f39c12; }
.sfpe-zone-resources .sfpe-zone-icon { background: #27ae60; }

/* ============================
   Smart Auto-Scroll
   ============================ */

.sfpe-content-container {
    scroll-behavior: smooth;
    position: relative;
}

.sfpe-content-container.auto-scrolling {
    scroll-behavior: smooth;
}

.sfpe-scroll-indicator {
    position: fixed;
    right: 20px;
    bottom: 100px;
    width: 50px;
    height: 50px;
    background: rgba(44, 62, 80, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 50;
}

.sfpe-scroll-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

.sfpe-scroll-indicator:hover {
    background: rgba(44, 62, 80, 1);
    transform: scale(1.1);
}

.sfpe-scroll-indicator svg {
    width: 24px;
    height: 24px;
    color: white;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}


/* ============================
   Expandable Content Cards
   ============================ */

.sfpe-expandable-card {
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.sfpe-card-preview {
    padding: 20px;
    cursor: pointer;
    position: relative;
}

.sfpe-card-preview::after {
    content: 'Click to expand';
    position: absolute;
    bottom: 10px;
    right: 20px;
    font-size: 12px;
    color: #3498db;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sfpe-expandable-card:hover .sfpe-card-preview::after {
    opacity: 1;
}

.sfpe-card-content {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sfpe-expandable-card.expanded .sfpe-card-content {
    max-height: 1000px;
    padding: 0 20px 20px;
}

.sfpe-card-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #3498db;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 10px;
}

.sfpe-card-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.sfpe-expandable-card.expanded .sfpe-card-toggle svg {
    transform: rotate(180deg);
}

/* ============================
   Question Isolation Mode
   ============================ */

.sfpe-question-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.sfpe-question-overlay.active {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    opacity: 1;
    pointer-events: all;
}

.sfpe-question-container {
    background: white;
    border-radius: 24px;
    padding: 50px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(50px);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.sfpe-question-overlay.active .sfpe-question-container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.sfpe-question-header {
    text-align: center;
    margin-bottom: 40px;
}

.sfpe-question-title {
    font-size: 28px;
    font-weight: 700;
    color: #2C3E50;
    margin-bottom: 10px;
    animation: fadeInUp 0.6s ease;
}

.sfpe-question-subtitle {
    font-size: 16px;
    color: #7f8c8d;
    animation: fadeInUp 0.6s ease 0.1s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sfpe-question-content {
    margin-bottom: 40px;
}

.sfpe-question-text {
    font-size: 20px;
    line-height: 1.6;
    color: #34495e;
    margin-bottom: 30px;
    animation: fadeInUp 0.6s ease 0.2s both;
}

.sfpe-answer-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    animation: fadeInUp 0.6s ease 0.3s both;
}

.sfpe-answer-option {
    display: flex;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sfpe-answer-option:hover {
    background: #e9ecef;
    border-color: #3498db;
    transform: translateX(5px);
}

.sfpe-answer-option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    cursor: pointer;
}

.sfpe-answer-option label {
    flex: 1;
    cursor: pointer;
    font-size: 16px;
    color: #2C3E50;
}

.sfpe-answer-option.selected {
    background: #e8f4f8;
    border-color: #3498db;
}

/* Timer and Progress */
.sfpe-question-timer {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
}

.sfpe-timer-circle {
    transform: rotate(-90deg);
}

.sfpe-timer-bg {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 4;
}

.sfpe-timer-progress {
    fill: none;
    stroke: #3498db;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 188.5;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.sfpe-timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: 600;
    color: #2C3E50;
}

/* Submit Button */
.sfpe-question-submit {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    animation: fadeInUp 0.6s ease 0.4s both;
}

.sfpe-submit-btn {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(52, 152, 219, 0.3);
}

.sfpe-submit-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(52, 152, 219, 0.4);
}

.sfpe-submit-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    box-shadow: none;
}

/* ============================
   Enhanced Online Indicator
   ============================ */

.sfpe-online-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(46, 204, 113, 0.1);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: #27ae60;
}

.sfpe-online-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #27ae60;
    border-radius: 50%;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

/* ============================
   Minimized Overlay Fix
   ============================ */

.sfpe-tutor-overlay.minimized {
    display: block;
    opacity: 1;
    background: transparent;
    pointer-events: none;
}

.sfpe-tutor-overlay.minimized .sfpe-tutor-interface {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 60px;
    background: linear-gradient(90deg, rgba(16, 43, 48, 0.98) 0%, rgba(13, 53, 62, 0.98) 100%);
    border-radius: 30px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    pointer-events: all;
    transition: all 0.3s ease;
}

.sfpe-tutor-overlay.minimized .sfpe-tutor-interface:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.sfpe-minimized-content {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.sfpe-minimized-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.sfpe-minimized-info {
    flex: 1;
}

.sfpe-minimized-name {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
}

.sfpe-minimized-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.sfpe-minimized-actions {
    display: flex;
    gap: 10px;
}

.sfpe-minimized-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sfpe-minimized-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.sfpe-minimized-btn svg {
    width: 16px;
    height: 16px;
    color: white;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sfpe-content-zones {
        padding: 80px 20px 20px;
    }
    
    .sfpe-question-container {
        padding: 30px 20px;
    }
    
    .sfpe-tutor-overlay.minimized .sfpe-tutor-interface {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
    }
}

/* Section notification styles */
.sfpe-section-notification {
    position: fixed;
    top: 140px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: linear-gradient(135deg, #6CFFC4 0%, #4AE3B5 100%);
    color: #000;
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(108, 255, 196, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 95;
}

.sfpe-section-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.sfpe-section-icon {
    font-size: 20px;
}

/* Ensure sticky progress doesn't overlap content */
.sfpe-tutor-overlay.open .sfpe-tutor-content {
    padding-top: 20px;
}

/* Section progress markers */
.sfpe-progress-section {
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
}

.sfpe-section-marker {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.sfpe-section-marker.active {
    background: #6CFFC4;
    border-color: #4AE3B5;
    transform: translateY(-50%) scale(1.1);
}

.sfpe-section-number {
    font-size: 12px;
    font-weight: bold;
    color: #666;
}

.sfpe-section-marker.active .sfpe-section-number {
    color: #000;
}

.sfpe-section-title {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    font-weight: 500;
    color: #666;
    white-space: nowrap;
}

.sfpe-section-progress {
    position: absolute;
    left: 30px;
    right: 0;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    top: 50%;
    transform: translateY(-50%);
}

.sfpe-section-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6CFFC4 0%, #4AE3B5 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}