/* =========================================================
   REHO-FM Interactive Tutorial Card
   ========================================================= */

#tutorial-card {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 360px;
    background: #1c3342;
    border-left: 4px solid #ffaa00;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65);
    z-index: 99999;
    overflow: hidden;
    font-family: 'Roboto', sans-serif;
    transition: opacity 0.25s ease, transform 0.25s ease;
    user-select: none;
}

#tutorial-card.tut-hidden {
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
}

.tut-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 10px;
    background: rgba(0, 0, 0, 0.2);
}

.tut-badge {
    background: #ffaa00;
    color: #1c3342;
    font-weight: 700;
    font-size: 13px;
    padding: 4px 14px;
    border-radius: 12px;
    letter-spacing: 0.2px;
    line-height: 1.3;
}

.tut-badge em {
    font-style: italic;
}

.tut-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tut-skip {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    transition: color 0.2s;
    line-height: 1;
}

.tut-skip:hover {
    color: #ef4636;
}

.tut-collapse {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.45);
    font-size: 13px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.tut-collapse:hover {
    color: #ffaa00;
}

/* === Collapse to the left edge === */
/* Re-expand tab — hidden by default, shown only when collapsed */
.tut-reopen {
    display: none;
    position: absolute;
    top: 50%;
    right: -28px;
    transform: translateY(-50%);
    width: 28px;
    height: 56px;
    background: #1c3342;
    border: none;
    border-left: 4px solid #ffaa00;
    border-radius: 0 8px 8px 0;
    color: #ffaa00;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.45);
    line-height: 1;
    z-index: 1;
}

.tut-reopen:hover {
    color: #ffc030;
    background: #234254;
}

#tutorial-card.tut-collapsed {
    transform: translateX(calc(-100% - 24px));
    overflow: visible;
}

/* Keep vertical centering transform intact while collapsed */
#tutorial-card.tut-left-middle.tut-collapsed {
    transform: translate(calc(-100% - 24px), -50%);
}

/* Bottom-positioned step cards (step 3+) have transform:none by default */
#tutorial-card.tut-left-bottom.tut-collapsed {
    transform: translateX(calc(-100% - 24px));
}

#tutorial-card.tut-collapsed .tut-reopen {
    display: block;
}

.tut-body {
    padding: 14px 16px 8px;
}

.tut-title {
    font-size: 16px;
    font-weight: 600;
    color: #ffaa00;
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

.tut-text {
    font-size: 15px;
    line-height: 1.7;
    color: #b8cdd6;
}

.tut-text strong {
    color: #ffffff;
    font-weight: 600;
}

.tut-text em {
    color: rgba(255, 200, 80, 0.85);
    font-style: normal;
}

.tut-text a {
    color: #ffaa00;
    text-decoration: underline;
    font-weight: 500;
}

.tut-text a:hover {
    color: #ffc030;
}

.tut-progress {
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    margin: 12px 16px 4px;
    border-radius: 2px;
    overflow: hidden;
}

.tut-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffaa00, #f5793b);
    border-radius: 2px;
    transition: width 0.35s ease;
}

.tut-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 14px;
    gap: 8px;
}

.tut-btn {
    background: rgba(255, 255, 255, 0.07);
    color: #c8d8e0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-family: 'Roboto', sans-serif;
    line-height: 1;
}

.tut-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.tut-btn:disabled {
    opacity: 0.28;
    cursor: not-allowed;
}

.tut-btn:disabled:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #c8d8e0;
}

.tut-btn-primary {
    background: #ffaa00;
    color: #1c3342;
    border-color: transparent;
    font-weight: 600;
}

.tut-btn-primary:hover {
    background: #ffc030;
    color: #1c3342;
}


/* =========================================================
   Highlight glow — two variants, same orange (#ffaa00) spirit.
   JS (glow() in tutorial.js) picks the class per element:
     .tut-glow-btn  → clickable targets (buttons, links, .btn)
     .tut-glow-box  → everything else (inputs, selects, panels, cells)
   --------------------------------------------------------- */

/* Shared: rounded glow corners. No position override — some targets (Leaflet/map
   controls) are absolutely positioned and must keep their own placement. */
.tut-glow-btn,
.tut-glow-box {
    border-radius: 6px;
}

/* --- Buttons: a crisp ring that "breathes" so it reads as pressable --- */
@keyframes tut-glow-btn {
    0%, 100% {
        box-shadow:
            0 0 0 2px rgba(255, 170, 0, 0.95),
            0 0 10px 2px rgba(255, 170, 0, 0.40);
        transform: scale(1);
    }
    50% {
        box-shadow:
            0 0 0 2px rgba(255, 170, 0, 1),
            0 0 24px 7px rgba(255, 170, 0, 0.62);
        transform: scale(1.05);
    }
}

.tut-glow-btn {
    animation: tut-glow-btn 1.4s ease-in-out infinite !important;
    transform-origin: center;
}

/* --- Boxes: steady orange contour + soft pulsing halo, no movement --- */
@keyframes tut-glow-box {
    0%, 100% {
        box-shadow:
            0 0 0 2px rgba(255, 170, 0, 0.90),
            0 0 0 5px rgba(255, 170, 0, 0.16),
            0 0 16px 4px rgba(255, 170, 0, 0.28);
    }
    50% {
        box-shadow:
            0 0 0 2px rgba(255, 170, 0, 1),
            0 0 0 7px rgba(255, 170, 0, 0.08),
            0 0 28px 9px rgba(255, 170, 0, 0.16);
    }
}

.tut-glow-box {
    animation: tut-glow-box 1.9s ease-in-out infinite !important;
}

/* Respect users who prefer no motion — drop the animation, keep a static ring */
@media (prefers-reduced-motion: reduce) {
    .tut-glow-btn,
    .tut-glow-box {
        animation: none !important;
        box-shadow: 0 0 0 2px rgba(255, 170, 0, 1), 0 0 14px 3px rgba(255, 170, 0, 0.45);
        transform: none;
    }
}

/* Card positioned on the left (for steps where action area is on the right) */
#tutorial-card.tut-card-left {
    right: auto;
    left: 24px;
}

/* === Home page view === */
#tutorial-card.tut-home {
    width: 420px;
}

.tut-home-content {
    padding: 4px 16px 8px;
}

.tut-home-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffaa00;
    margin: 0 0 16px;
    letter-spacing: 0.3px;
    text-align: center;
}

.tut-home-picture {
    width: 25%;
    height: auto;
    border-radius: 8px;
    margin: 0 auto 16px;
    display: block;
}

.tut-home-credits-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.tut-logo {
    height: 28px;
    width: auto;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.tut-logo:hover {
    opacity: 1;
}

.tut-home-desc {
    font-size: 14px;
    line-height: 1.7;
    color: #b8cdd6;
    margin-bottom: 12px;
}

.tut-home-desc p {
    margin: 0 0 7px;
}

.tut-home-desc a {
    color: #ffaa00;
    text-decoration: underline;
    font-weight: 500;
}

.tut-home-desc a:hover {
    color: #ffc030;
}

.tut-home-credits {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.65;
    text-align: center;
}

.tut-home-credits p {
    margin: 0 0 4px;
}

.tut-home-credits strong {
    color: rgba(255, 255, 255, 0.78);
}

.tut-license {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.32);
    letter-spacing: 0.3px;
    margin-top: 2px !important;
}

/* === Card positions === */

/* Home page: centred on screen */
#tutorial-card.tut-centered {
    bottom: auto;
    right: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* All step cards: left side, vertically centred */
#tutorial-card.tut-left-middle {
    bottom: auto;
    right: auto;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
}

/* Step 3+: left side, bottom corner */
#tutorial-card.tut-left-bottom {
    bottom: 24px;
    right: auto;
    left: 24px;
    top: auto;
    transform: none;
}

/* Step 4: enlarged width */
#tutorial-card.tut-step-4 {
    width: 600px;
}

/* Step 12: wider to reduce vertical stacking on district map page, moved down slightly */
#tutorial-card.tut-step-12 {
    width: 480px;
    top: calc(50% + 40px);
}

/* Full-screen click blocker shown behind the home card */
#tut-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99998;
    pointer-events: auto;
}
