/**
 * Try-It Plugin - MINIMAL CSS
 *
 * Only styles that are UNIQUE to the try-it quiz interaction.
 * Marketing sections should use your existing HP/theme classes.
 *
 * This file should be ~150 lines, not 500+
 */

/* ============================================
   LEVEL SELECTOR (the 3 audio choice pills)
   ============================================ */
.tryit-level-intro {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    text-align: center;
}

.tryit-level-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0 0 1rem 0;
    text-align: center;
}

.tryit-level-selector {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    padding: 0 1rem;
}

.tryit-level-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: #f1f5f9;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    color: #64748b;
}

.tryit-level-pill:hover {
    border-color: #7d92ff;
    background: #e8ecff;
    color: #4b5563;
    transform: translateY(-2px);
}

.tryit-level-pill.is-active {
    background: linear-gradient(135deg, #7d92ff 0%, #6b7ff0 100%);
    border-color: #7d92ff;
    color: white;
}

.tryit-level-pill .pill-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.tryit-level-pill .pill-hint {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 2px;
}

.tryit-level-note {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0.5rem 0 1rem 0;
    text-align: center;
}

/* ============================================
   QUIZ CONTAINER - Match retail card styling
   ============================================ */
.tryit-quiz-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 400px;
    position: relative;
}

.tryit-quiz-slot {
    display: none;
}

.tryit-quiz-slot.is-active {
    display: block;
    background: #f7f7fb;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.14);
    padding: 2rem 2.5rem 2.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .tryit-quiz-slot.is-active {
        border-radius: 0;
        box-shadow: none;
        padding: 1.25rem 1rem 2rem;
        margin: 0 -1rem;
    }
}

/* Force CEFR quiz visible */
.tryit-quiz-slot.is-active .single_word_container,
.tryit-quiz-slot.is-active .tw-bs4 {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Hide CEFR's login prompts - we use our own CTAs */
.tryit-experience .sir-login-prompt,
.tryit-experience .sir-guest-instruction,
.tryit-experience #practice-indicator {
    display: none !important;
}

/* ============================================
   HIDE CEFR ELEMENTS NOT NEEDED ON TRY-IT
   ============================================ */

/* Hide the slider container completely - users use level pills, not slider */
.tryit-experience .main-slider,
.tryit-experience .slider-container {
    display: none !important;
}

/* Hide the CEFR madlibs dropdown - try-it uses its own .tryit-transcript-help */
.tryit-experience .irl-difficulty-madlib,
.tryit-experience .irl-dropdown-overlay {
    display: none !important;
}

/* Hide the "Custom" level pill - slider doesn't work via AJAX load */
.tryit-experience .irl-level-pill[data-level="custom"],
.quizShortcode .irl-level-pill[data-level="custom"],
section.quizShortcode .irl-level-pill[data-level="custom"],
.tryit-quiz-slot .irl-level-pill[data-level="custom"],
button.irl-level-pill[data-level="custom"] {
    display: none !important;
}

/* Hide the slider tooltip */
.tryit-experience .slider-tooltip {
    display: none !important;
}

/* Hide yellow instruction banner - we have our own sample label */
.tryit-experience .sir-guest-instruction {
    display: none !important;
}

/* ============================================
   CEFR BUTTON OVERRIDES FOR TRY-IT
   ============================================ */

/* Keep Start Practice button purple, not red */
.tryit-experience #start-quiz-button {
    background: linear-gradient(135deg, #7d92ff 0%, #6b7ff0 100%) !important;
    border-color: #7d92ff !important;
    color: white !important;
}

.tryit-experience #start-quiz-button:hover {
    background: linear-gradient(135deg, #6b7ff0 0%, #5a6ee0 100%) !important;
}

.tryit-experience #start-quiz-button.is-active {
    background: linear-gradient(135deg, #6b7ff0 0%, #5a6ee0 100%) !important;
}

/* Fix play/pause button icon visibility */
.tryit-experience .sir-audio-play {
    background: #7d92ff !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 36px;
    min-height: 36px;
}

.tryit-experience .sir-audio-play i,
.tryit-experience .sir-audio-play svg {
    color: white !important;
    fill: white !important;
}

/* Fallback play icon if phosphor doesn't load */
.tryit-experience .sir-audio-play::before {
    content: "▶";
    font-size: 14px;
}

.tryit-experience .sir-audio-play.is-playing::before {
    content: "⏸";
}

/* Hide ::before if icon element exists */
.tryit-experience .sir-audio-play:has(i)::before,
.tryit-experience .sir-audio-play:has(svg)::before {
    display: none;
}

/* Ensure SVG icons in buttons are visible */
.tryit-experience #start-quiz-button svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

/* Fix audio player visibility */
.tryit-experience .sir-audio-player {
    opacity: 1 !important;
    visibility: visible !important;
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.tryit-quiz-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #64748b;
    gap: 1rem;
}

.tryit-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #7d92ff;
    border-radius: 50%;
    animation: tryit-spin 0.8s linear infinite;
}

@keyframes tryit-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   LEVEL NAVIGATION (Easier / Harder)
   ============================================ */
.tryit-level-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 500px;
    margin: 1rem auto 2rem;
    padding: 0 1rem;
}

.tryit-nav-btn {
    padding: 0.75rem 1rem;
    background: #f1f5f9;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #475569;
}

.tryit-nav-btn:hover:not(:disabled) {
    border-color: #7d92ff;
    background: #e8ecff;
    color: #7d92ff;
}

.tryit-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f8fafc;
}

.tryit-nav-current {
    font-weight: 600;
    color: #7d92ff;
}

/* ============================================
   STICKY CTA BAR
   ============================================ */
.tryit-sticky-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    padding: 0.875rem 1rem;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.tryit-sticky-cta.is-visible {
    transform: translateY(0);
}

.tryit-sticky-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.tryit-sticky-text {
    font-size: 0.9rem;
    text-align: center;
}

/* ============================================
   COMPLETION MESSAGE - Floating decision card
   ============================================ */
.tryit-completion {
    background: #f4fff9;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    padding: 20px 24px;
    margin: 16px auto;
    max-width: 420px;
    text-align: center;
}

.tryit-completion-message {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a5a32;
    margin: 0 0 16px 0;
    line-height: 1.4;
}

.tryit-completion-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.tryit-completion-actions .tryit-btn-primary {
    width: 100%;
}

/* Link-style button for "Try another clip" */
.tryit-btn-link {
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    text-decoration: underline;
    transition: color 0.2s;
}

.tryit-btn-link:hover {
    color: #7d92ff;
}

/* ============================================
   TRANSCRIPT HELP DROPDOWN (Mad-libs style)
   Matches explore page .irl-madlibs styling
   ============================================ */
.tryit-transcript-help {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1.25rem 1rem;
    margin-bottom: 1rem;
    font-size: 1.125rem;
    line-height: 2;
    color: #334155;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.tryit-th-text {
    font-weight: 500;
}

.tryit-th-dropdown-wrap {
    position: relative;
    display: inline-block;
}

.tryit-th-dropdown {
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    border: 2px dashed #cbd5e1;
    border-radius: 24px;
    padding: 0.5rem 2.25rem 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    min-width: 200px;
    text-align: center;
    text-align-last: center;
}

.tryit-th-dropdown:hover {
    border-style: solid;
    border-color: #7d92ff;
    color: #7d92ff;
    background-color: #f8faff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237d92ff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.tryit-th-dropdown:focus {
    outline: none;
    border-style: solid;
    border-color: #7d92ff;
    box-shadow: 0 0 0 3px rgba(125, 146, 255, 0.2);
}

.tryit-th-dropdown option {
    font-weight: 500;
    color: #334155;
    text-align: left;
}

/* ============================================
   BUTTONS
   ============================================ */
.tryit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.tryit-btn-primary {
    background: linear-gradient(135deg, #7d92ff 0%, #6b7ff0 100%);
    color: white;
    border-color: #7d92ff;
}

.tryit-btn-primary:hover {
    background: linear-gradient(135deg, #6b7ff0 0%, #5a6ee0 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(125, 146, 255, 0.4);
}

.tryit-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

.tryit-btn-secondary:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.tryit-btn-sm {
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    /* Level pills stack vertically on mobile */
    .tryit-level-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .tryit-level-pill {
        flex-direction: row;
        justify-content: space-between;
        min-width: 100%;
    }

    .tryit-level-pill .pill-hint {
        margin-top: 0;
        margin-left: auto;
    }

    /* Transcript help wraps on mobile */
    .tryit-transcript-help {
        flex-wrap: wrap;
        font-size: 1rem;
        padding: 1rem 0.75rem;
        line-height: 1.8;
        text-align: left;
    }

    .tryit-th-dropdown {
        min-width: 180px;
        font-size: 0.9rem;
        padding: 0.4rem 2rem 0.4rem 0.75rem;
    }

    /* Level nav stacks on mobile */
    .tryit-level-nav {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .tryit-nav-btn {
        width: 100%;
    }

    /* Sticky CTA stacks on mobile */
    .tryit-sticky-inner {
        flex-direction: column;
        gap: 0.75rem;
    }

    .tryit-sticky-text {
        font-size: 0.85rem;
    }

    /* Completion actions stack on mobile */
    .tryit-completion-actions {
        flex-direction: column;
    }

    .tryit-completion-actions .tryit-btn {
        width: 100%;
    }
}
