/* Smart Shorts Engine - Frontend Styles */

/* Page wrapper for single pages */
.sse-page-wrapper {
    background: linear-gradient(180deg, #0f0f1a 0%, #1a1a2e 50%, #0f0f1a 100%);
}

@media (min-width: 769px) {
    .sse-page-wrapper {
        padding: 60px 20px 100px;
    }
}

.sse-shorts,
.sse-shorts * {
    box-sizing: border-box;
}

.sse-shorts {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-width: 500px;
    margin: 0 auto;
    overflow: hidden;
    background: #1a1a2e;
    touch-action: pan-y;
    user-select: none;
    border-radius: 0;
    overscroll-behavior: contain;
}

/* Desktop styling */
@media (min-width: 769px) {
    .sse-shorts {
        height: calc(100vh - 200px);
        max-height: 750px;
        margin: 0 auto;
        border-radius: 20px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    }
}

.sse-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.sse-slides {
    position: relative;
    width: 100%;
    height: 100%;
}

.sse-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
}

.sse-slide.active {
    transform: translateY(0);
    opacity: 1;
    z-index: 2;
}

.sse-slide.next {
    transform: translateY(100%);
    opacity: 0;
    z-index: 1;
}

.sse-slide.prev {
    transform: translateY(-100%);
    opacity: 0;
    z-index: 1;
}

.sse-slide-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 1;
}

.sse-slide.active .sse-slide-bg {
    animation: kenBurns 8s ease-out forwards;
}

@keyframes kenBurns {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

.sse-slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(26,26,46,0.4) 0%, rgba(26,26,46,0.1) 30%, rgba(26,26,46,0.2) 60%, rgba(26,26,46,0.85) 100%);
    z-index: 2;
}

.sse-slide-content {
    position: relative;
    z-index: 3;
    width: 100%;
    padding: 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.sse-slide-text {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 4px 30px rgba(0,0,0,0.8);
    line-height: 1.35;
    max-width: 90%;
    margin: 0;
}

.sse-slide.active .sse-slide-text {
    animation: textReveal 0.8s cubic-bezier(0.4,0,0.2,1) 0.2s forwards;
    opacity: 0;
    transform: translateY(30px);
}

@keyframes textReveal {
    to { opacity: 1; transform: translateY(0); }
}

/* Progress bar */
.sse-shorts .sse-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255,255,255,0.15);
    z-index: 10;
}

.sse-shorts .sse-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    transition: width 0.4s;
    width: 0%;
}

/* Sound toggle */
.sse-shorts .sse-sound-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    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;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.sse-shorts .sse-sound-toggle svg {
    width: 22px !important;
    height: 22px !important;
}

.sse-shorts .sse-sound-toggle.muted {
    background: rgba(239,68,68,0.3);
}

/* Swipe hint */
.sse-shorts .sse-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 10;
    animation: hintPulse 2s ease-in-out infinite;
}

.sse-shorts .sse-hint svg {
    width: 24px !important;
    height: 24px !important;
}

.sse-shorts .sse-hint.hidden {
    opacity: 0;
}

@keyframes hintPulse {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.7; }
    50% { transform: translateX(-50%) translateY(-8px); opacity: 1; }
}

/* Reactions */
.sse-shorts .sse-reactions {
    position: absolute;
    right: 15px;
    bottom: 100px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 15;
}

.sse-shorts .sse-reaction {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.sse-shorts .sse-reaction.selected {
    background: rgba(37,99,235,0.4);
    border-color: #2563eb;
}

/* XP Popup */
.sse-shorts .sse-xp-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
}

.sse-shorts .sse-xp-popup.show {
    animation: xpPopup 1.5s forwards;
}

.sse-shorts .sse-xp-amount {
    font-size: 36px;
    font-weight: 800;
    color: #22c55e;
    text-shadow: 0 0 30px rgba(34,197,94,0.8);
}

@keyframes xpPopup {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    40% { transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -70%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -90%) scale(0.8); }
}

/* Quiz styling */
.sse-slide-quiz .sse-slide-overlay {
    background: linear-gradient(135deg, rgba(26,26,46,0.95) 0%, rgba(37,99,235,0.3) 50%, rgba(26,26,46,0.95) 100%);
}

.sse-quiz-icon {
    font-size: 56px;
    margin-bottom: 24px;
}

.sse-quiz-question {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 32px 0;
    line-height: 1.4;
}

.sse-quiz-choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 340px;
}

.sse-quiz-choice {
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.15);
    color: #fff;
    padding: 18px 24px;
    border-radius: 16px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
}

.sse-quiz-choice:hover {
    background: rgba(37,99,235,0.2);
    border-color: #2563eb;
}

.sse-quiz-choice.correct {
    background: rgba(34,197,94,0.3);
    border-color: #22c55e;
}

.sse-quiz-choice.wrong {
    background: rgba(239,68,68,0.3);
    border-color: #ef4444;
}

/* Completion slide */
.sse-completion-icon {
    font-size: 72px;
    margin-bottom: 16px;
}

.sse-completion-title {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 8px 0;
}

.sse-completion-subtitle {
    font-size: 16px;
    color: rgba(255,255,255,0.7);
    margin: 0 0 32px 0;
}

/* Course promo card */
.sse-course-promo {
    width: 100%;
    max-width: 340px;
}

.sse-promo-label {
    font-size: 14px;
    font-weight: 600;
    color: #2563eb;
    text-transform: uppercase;
    margin: 0 0 12px 0;
    text-align: center;
}

.sse-course-card-link {
    display: block;
    text-decoration: none;
}

.sse-promo-card {
    background: linear-gradient(145deg, rgba(13,27,77,0.9), rgba(39,65,163,0.7));
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.12);
}

.sse-promo-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background-size: cover;
    background-position: center;
}

.sse-promo-content {
    padding: 20px;
}

.sse-promo-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px 0;
}

.sse-promo-excerpt {
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    margin: 0 0 12px 0;
}

.sse-promo-cta {
    font-size: 14px;
    font-weight: 600;
    color: #2563eb;
}

/* Next hint on completion */
.sse-next-hint {
    margin-top: 20px;
    font-size: 14px;
    color: rgba(255,255,255,0.5);
    animation: hintPulse 2s ease-in-out infinite;
}

/* Next short slide */
.sse-slide-next-short .sse-slide-overlay {
    background: linear-gradient(135deg, rgba(15,15,26,0.98) 0%, rgba(37,99,235,0.2) 50%, rgba(15,15,26,0.98) 100%);
}

.sse-next-label {
    font-size: 14px;
    font-weight: 600;
    color: #2563eb;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 24px 0;
}

.sse-next-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 24px;
    max-width: 300px;
    text-align: center;
}

.sse-next-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background-size: cover;
    background-position: center;
    background-color: rgba(37,99,235,0.2);
    border-radius: 12px;
    margin-bottom: 16px;
}

.sse-next-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 16px 0;
    line-height: 1.3;
}

.sse-next-btn {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    padding: 12px 28px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.sse-next-btn:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

/* Audio indicator */
.sse-audio-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 3px;
    z-index: 20;
    opacity: 0;
}

.sse-audio-indicator.playing {
    opacity: 1;
}

.sse-audio-indicator span {
    width: 3px;
    height: 16px;
    background: #fff;
    border-radius: 2px;
    animation: audioBar 0.5s ease-in-out infinite alternate;
}

.sse-audio-indicator span:nth-child(2) { animation-delay: 0.1s; }
.sse-audio-indicator span:nth-child(3) { animation-delay: 0.2s; }
.sse-audio-indicator span:nth-child(4) { animation-delay: 0.3s; }

@keyframes audioBar {
    from { height: 8px; }
    to { height: 20px; }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .sse-slide-text { font-size: 24px; }
    .sse-quiz-question { font-size: 22px; }
    .sse-quiz-choice { font-size: 15px; padding: 16px 20px; }
}
