/* ════════════════════════════════════════════════════
   HIMALAYA FORMATION SIMULATOR — style.css
   EduNudge GeoLab
   ════════════════════════════════════════════════════ */

:root {
    --primary: #e86c2f;
    --primary-light: #f5924e;
    --primary-dark: #c0521a;
    --secondary: #1a3545;
    --secondary-light: #264d63;
    --accent: #f0a500;
    --accent-light: #ffc533;
    --surface: #ffffff;
    --surface-2: #f4f7fa;
    --surface-3: #e8edf2;
    --border: #d0dbe6;
    --text-primary: #1a2e3b;
    --text-secondary: #4a6070;
    --text-muted: #7a95a5;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-pill: 100px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.18);
    --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.28);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --canvas-height: 560px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(145deg, #0d1f2b 0%, #1a3545 40%, #0f2535 100%);
    min-height: 100vh;
    padding: 24px 16px;
    -webkit-font-smoothing: antialiased;
}

.sim-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    background: var(--surface-2);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.5s ease both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── HEADER ── */
.sim-header {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 100%);
    color: white;
    padding: 18px 32px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.sim-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.edunudge-logo {
    height: 38px;
    background: white;
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    transition: transform var(--transition-fast);
}

.edunudge-logo:hover {
    transform: scale(1.04);
}

.geolab-badge {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.geolab-badge i {
    margin-right: 5px;
    color: var(--accent-light);
}

.header-center {
    text-align: center;
}

.sim-title {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.sim-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 2px;
}

.header-right {
    display: flex;
    justify-content: flex-end;
}

.header-link {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    transition: color var(--transition-fast);
}

.header-link:hover {
    color: var(--accent-light);
}

/* ── FEATURE GRID ── */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr) 1.4fr;
    gap: 0;
    background: var(--secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.feature-card {
    padding: 18px 20px;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 100%);
    transition: background var(--transition-fast);
}

.feature-card:last-child {
    border-right: none;
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

.feature-card--wide {
    border-left: 2px solid var(--primary);
}

.feature-icon {
    font-size: 1rem;
    color: var(--primary-light);
    margin-bottom: 4px;
}

.feature-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
    margin-bottom: 4px;
}

.feature-value {
    font-family: var(--font-display);
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--accent-light);
    line-height: 1;
}

.feature-value small {
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    margin-left: 2px;
}

.feature-sub {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 5px;
}

.mini-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.mini-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent-light));
    border-radius: 2px;
    transition: width 0.3s ease;
}

.process-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    color: #7be8a2;
    margin-top: 4px;
}

.process-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.process-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #7be8a2, #4fc57a);
    border-radius: 2px;
    transition: width 0.5s ease;
    width: 0%;
}

/* ── CANVAS SECTION ── */
.canvas-section {
    padding: 24px 28px 16px;
    background: var(--surface-2);
}

.canvas-container {
    position: relative;
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border);
    cursor: crosshair;
}

#himalayasCanvas {
    display: block;
    width: 100%;
    height: var(--canvas-height);
    border-radius: calc(var(--radius-lg) - 2px);
}

.stage-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(26, 53, 69, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 7px;
    pointer-events: none;
}

.stage-badge i {
    color: var(--accent-light);
}

.geo-tooltip {
    position: absolute;
    background: rgba(10, 25, 35, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 8px 13px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    line-height: 1.5;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 10;
    max-width: 220px;
}

.geo-tooltip.visible {
    opacity: 1;
}

.geo-tooltip strong {
    display: block;
    color: var(--accent-light);
    font-size: 0.8rem;
    margin-bottom: 2px;
}

/* ── LEGEND ── */
.legend-panel {
    margin-top: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 20px;
}

.legend-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-swatch {
    width: 28px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ── CONTROLS SECTION ── */
.controls-section {
    padding: 16px 28px 28px;
    background: var(--surface-2);
}

.controls-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    align-items: start;
}

.control-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
}

.control-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.control-panel-header i {
    color: var(--primary);
}

.epoch-markers {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0 2px;
    margin-bottom: 4px;
}

/* ── SLIDER ── */
.custom-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--primary) 0%, var(--surface-3) 100%);
    outline: none;
    cursor: pointer;
    margin: 6px 0 10px;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--surface);
    border: 3px solid var(--primary);
    box-shadow: 0 2px 8px rgba(232, 108, 47, 0.4);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.custom-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--surface);
    border: 3px solid var(--primary);
    cursor: pointer;
}

/* ── EVENT MARKERS ── */
.event-markers {
    position: relative;
    height: 36px;
    margin-bottom: 18px;
}

.event-marker {
    position: absolute;
    transform: translateX(-50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px var(--text-muted);
}

.event-dot--orange {
    background: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.event-dot--red {
    background: #c0392b;
    box-shadow: 0 0 0 1px #c0392b;
    animation: pulse-dot 2s ease infinite;
}

.event-dot--blue {
    background: #0277bd;
    box-shadow: 0 0 0 1px #0277bd;
}

.event-dot--teal {
    background: #00838f;
    box-shadow: 0 0 0 1px #00838f;
}

.event-label {
    font-size: 0.58rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
}

@keyframes pulse-dot {

    0%,
    100% {
        box-shadow: 0 0 0 1px #c0392b;
    }

    50% {
        box-shadow: 0 0 0 1px #c0392b, 0 0 0 5px rgba(192, 57, 43, 0.3);
    }
}

/* ── BUTTON GROUP ── */
.btn-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    border-radius: var(--radius-pill);
    border: none;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.btn-play {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 14px rgba(232, 108, 47, 0.35);
    min-width: 130px;
    justify-content: center;
}

.btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(232, 108, 47, 0.45);
}

.btn-play:active {
    transform: translateY(0);
}

.btn-play.playing {
    background: linear-gradient(135deg, #c0392b, #96281b);
    box-shadow: 0 4px 14px rgba(192, 57, 43, 0.35);
}

.btn-reset {
    background: var(--surface-3);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-reset:hover {
    transform: translateY(-2px);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

/* ── SPEED CONTROL ── */
.speed-control {
    display: flex;
    gap: 4px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 3px;
    margin-left: auto;
}

.speed-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
    font-family: var(--font-body);
}

.speed-btn:hover {
    background: rgba(232, 108, 47, 0.1);
    color: var(--primary);
}

.speed-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 6px rgba(232, 108, 47, 0.35);
}

/* ── NUDGE PANEL ── */
.nudge-panel {
    background: linear-gradient(135deg, #fffbf0 0%, #fff8e6 100%);
    border: 1px solid #f0d080;
    border-left: 5px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 22px 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nudge-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.82rem;
    color: #b07800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.nudge-title i {
    color: var(--accent);
}

#nudgeText {
    font-size: 0.85rem;
    color: #5a4000;
    line-height: 1.7;
    min-height: 70px;
    transition: opacity 0.3s ease;
}

.nudge-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.nudge-tag {
    background: rgba(240, 165, 0, 0.15);
    border: 1px solid rgba(240, 165, 0, 0.4);
    color: #8a6000;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
}

.nudge-footer {
    font-size: 0.68rem;
    color: #a08030;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(240, 165, 0, 0.2);
}

/* ── FOOTER ── */
.sim-footer {
    background: var(--secondary);
    color: rgba(255, 255, 255, 0.5);
    padding: 14px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.73rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sim-footer a {
    color: var(--accent-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.sim-footer a:hover {
    color: white;
}

.sim-footer i {
    color: var(--primary-light);
    margin-right: 5px;
}

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
    .feature-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .feature-card--wide {
        grid-column: 1 / -1;
        border-left: none;
        border-top: 2px solid var(--primary);
    }
}

@media (max-width: 860px) {
    body {
        padding: 12px 8px;
    }

    .sim-header {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        padding: 14px 20px;
    }

    .header-center {
        grid-column: 1 / -1;
        grid-row: 2;
        text-align: left;
    }

    .header-right {
        grid-row: 1;
        grid-column: 2;
    }

    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .canvas-section,
    .controls-section {
        padding: 16px;
    }

    :root {
        --canvas-height: 380px;
    }

    .controls-layout {
        grid-template-columns: 1fr;
    }

    .speed-control {
        margin-left: 0;
    }

    .legend-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .sim-title {
        font-size: 1rem;
    }

    .geolab-badge {
        display: none;
    }

    .btn-group {
        flex-direction: column;
        align-items: stretch;
    }

    .speed-control {
        justify-content: center;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .sim-footer {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }

    :root {
        --canvas-height: 280px;
    }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--surface-2);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}