/**
 * Suno-Inspired Immersive Lesson Viewer
 * Mobile-first, full-screen card design with vertical action buttons
 */

/* ==========================================================================
   Base Lesson Viewer
   ========================================================================== */

.htp-lesson-immersive {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 9999;
    overflow: hidden;
}

/* Top Info Bar */
.htp-lesson-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    z-index: 100;
    background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
}

.htp-back-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.htp-back-circle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.htp-lesson-info-badge {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 8px 16px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

/* ==========================================================================
   Main Lesson Card
   ========================================================================== */

.htp-lesson-card {
    position: relative;
    width: 100%;
    height: calc(100vh - 40px);
    margin: 20px auto;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Background Image - Full screen */
.htp-lesson-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
}

/* Overlay - Dark on left, transparent on right */
.htp-lesson-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.7) 30%,
        rgba(0, 0, 0, 0.4) 60%,
        rgba(0, 0, 0, 0.2) 100%
    );
    z-index: 2;
}

/* ==========================================================================
   Lesson Content
   ========================================================================== */

.htp-lesson-content-wrapper {
    position: relative;
    z-index: 10;
    width: 40%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 80px 90px 100px 32px; /* Increased right padding to 90px to prevent overlap with action buttons */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

/* Responsive: Full width on mobile */
@media (max-width: 768px) {
    .htp-lesson-content-wrapper {
        width: 100%;
        padding: 80px 90px 100px 24px; /* Increased right padding to 90px for mobile to prevent overlap */
        background: linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.3) 0%,
            rgba(0, 0, 0, 0.6) 50%,
            rgba(0, 0, 0, 0.9) 100%
        );
    }
}

/* Module Badge */
.htp-module-badge {
    display: inline-block;
    background: rgba(212, 175, 55, 0.2);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 8px;
    padding: 6px 12px;
    margin-bottom: 16px;
}

.htp-module-badge span {
    color: #FFD700;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Lesson Title */
.htp-lesson-title {
    font-size: 48px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    margin: 0 0 16px 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    text-align: left;
}

@media (max-width: 768px) {
    .htp-lesson-title {
        font-size: 32px;
    }
}

.htp-lesson-subtitle {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    margin: 0 0 28px 0;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    text-align: left;
}

@media (max-width: 768px) {
    .htp-lesson-subtitle {
        font-size: 16px;
    }
}

/* Lesson Body */
.htp-lesson-body {
    color: rgba(255, 255, 255, 0.95);
    font-size: 22px;
    line-height: 1.8;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    transition: all 0.4s ease;
    text-align: left;
}

@media (max-width: 768px) {
    .htp-lesson-body {
        font-size: 16px;
        line-height: 1.7;
    }
}

.htp-lesson-body.expanded {
    max-height: none;
}

.htp-lesson-body p {
    margin: 0 0 20px 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Key Points */
.htp-key-points {
    margin-top: 24px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.htp-key-points h3 {
    color: #FFD700;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px 0;
}

.htp-key-points ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.htp-key-points li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.95);
}

.htp-key-points li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #FFD700;
    font-weight: bold;
}

/* Expand Button */
.htp-expand-btn {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 50;
}

.htp-expand-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(-50%) scale(1.05);
}

.htp-expand-btn.rotated svg {
    transform: rotate(180deg);
}

/* ==========================================================================
   Vertical Action Buttons (Right Side)
   ========================================================================== */

.htp-action-buttons {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 50;
}

.htp-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.htp-action-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.08);
}

.htp-action-btn:active {
    transform: scale(0.95);
}

.htp-action-btn svg {
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
}

.htp-action-count {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
}

/* Active States */
.htp-action-btn.active {
    background: rgba(212, 175, 55, 0.3);
    border-color: rgba(212, 175, 55, 0.6);
    color: #FFD700;
}

.htp-action-btn.active svg {
    fill: #FFD700;
}

/* Complete Button Special Style */
.htp-complete-btn.completed {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.6);
    color: #22c55e;
}

.htp-complete-btn.completed svg {
    stroke: #22c55e;
}

/* Animation on click */
@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(1.1); }
}

.htp-action-btn.animating {
    animation: heartBeat 0.5s ease;
}

/* ==========================================================================
   Bottom Navigation Controls
   ========================================================================== */

.htp-lesson-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    backdrop-filter: blur(10px);
    z-index: 40;
}

.htp-control-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.htp-control-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.htp-control-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.htp-next-btn {
    background: linear-gradient(135deg, #D4AF37 0%, #FFD700 100%);
    border-color: rgba(212, 175, 55, 0.5);
}

.htp-next-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #FFD700 0%, #D4AF37 100%);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

/* Progress Container */
.htp-progress-container {
    flex: 1;
    margin: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.htp-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.htp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #D4AF37 0%, #FFD700 100%);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.htp-progress-text {
    font-size: 13px;
    font-weight: 600;
    color: #FFD700;
    min-width: 40px;
    text-align: right;
}

/* ==========================================================================
   Comments Modal
   ========================================================================== */

.htp-comments-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.htp-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.htp-modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 70vh;
    background: #1a1a1a;
    border-radius: 24px 24px 0 0;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.htp-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.htp-modal-header h3 {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.htp-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.htp-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.htp-modal-body {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.htp-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 12px;
}

.htp-comment-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    resize: none;
    min-height: 44px;
    max-height: 120px;
}

.htp-comment-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.htp-submit-comment {
    background: linear-gradient(135deg, #D4AF37 0%, #FFD700 100%);
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    color: #000;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.htp-submit-comment:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .htp-lesson-card {
        margin: 0;
        height: 100vh;
        border-radius: 0;
    }
    
    .htp-lesson-title {
        font-size: 28px;
    }
    
    .htp-action-buttons {
        right: 12px;
        gap: 12px;
    }
    
    .htp-action-btn {
        width: 48px;
        height: 48px;
    }
    
    .htp-lesson-controls {
        padding: 16px 20px;
    }
}

@media (max-width: 480px) {
    .htp-lesson-title {
        font-size: 24px;
    }
    
    .htp-lesson-subtitle {
        font-size: 14px;
    }
    
    .htp-action-btn {
        width: 44px;
        height: 44px;
    }
    
    .htp-action-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* ==========================================================================
   Smooth Transitions
   ========================================================================== */

* {
    -webkit-tap-highlight-color: transparent;
}

button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Loading State */
.htp-lesson-immersive.loading .htp-lesson-content-wrapper {
    opacity: 0.5;
    pointer-events: none;
}
