/* reddit_loading.css - Senior UI/UX Sentiment Loading Screen */

:root {
    --rl-shell-width: min(760px, 100%);
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--index-text-main, #e1f4e8);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    position: relative;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ==========================================================================
   TOP CONTROLS (STANDARD MAIN DESIGN HEADER)
   ========================================================================== */
.rl-top-controls {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    margin: 12px 0 8px 0;
    padding: 0 16px;
    box-sizing: border-box;
}

.rl-top-controls #global-controls-dock-slot {
    display: flex;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    min-width: 0;
    flex-shrink: 1;
}

#global-controls-dock-slot #lang-selector-container {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    margin: 0 auto;
    justify-content: center;
    width: 100%;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.rl-main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0.75rem 1.25rem 2.5rem;
    width: 100%;
    box-sizing: border-box;
}

.rl-content-wrap {
    width: 100%;
    max-width: var(--rl-shell-width);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

/* ==========================================================================
   INTRO SECTION (EYEBROW + H1 + SUBTITLE)
   ========================================================================== */
.rl-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.55rem;
    width: 100%;
}

.rl-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--index-accent, #79f0b8);
}

.rl-pulse-icon {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
    animation: rl-pulse-glow 2.2s infinite ease-in-out;
}

@keyframes rl-pulse-glow {
    0%, 100% {
        opacity: 0.6;
        transform: scale(0.96);
    }
    50% {
        opacity: 1;
        transform: scale(1.08);
    }
}

.rl-title {
    margin: 0;
    font-size: clamp(1.4rem, 4vw, 2.15rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--index-text-main, #ffffff);
    text-align: center;
}

.rl-subtitle {
    margin: 0;
    font-size: clamp(0.88rem, 2.2vw, 0.98rem);
    color: var(--index-text-soft, #a4cdb7);
    line-height: 1.5;
    text-align: center;
    max-width: 58ch;
}

/* ==========================================================================
   PRIMARY PROGRESS CARD (.ui-frame)
   ========================================================================== */
.rl-card {
    width: 100%;
    background: var(--index-card-bg, rgba(11, 23, 29, 0.88));
    border: 1px solid var(--index-border, rgba(95, 163, 133, 0.38));
    border-radius: 14px;
    padding: 1.65rem 1.85rem;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-sizing: border-box;
}

.rl-card-grid {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    width: 100%;
}

.rl-col-left,
.rl-col-right {
    display: contents;
}

/* Ordering inside flex container */
.rl-card-header { order: 1; }
.rl-progress-wrap { order: 2; }
.rl-stepper-wrap { order: 3; }
.rl-signals-section { order: 4; }
.rl-activity-line { order: 5; }
.rl-protocol-section { order: 6; }

/* --------------------------------------------------------------------------
   CARD HEADER: STATUS | % | TIMER
   -------------------------------------------------------------------------- */
.rl-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.75rem;
}

.rl-card-status-badge {
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--index-accent, #79f0b8);
    white-space: nowrap;
}

.rl-card-header-divider {
    flex: 0 0 1px;
    height: 14px;
    background: var(--index-border-soft, rgba(87, 128, 111, 0.28));
}

.rl-card-progress-num {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--index-accent, #79f0b8);
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.rl-card-timer {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--index-text-muted, #739182);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rl-card-timer svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* --------------------------------------------------------------------------
   PROGRESS BAR
   -------------------------------------------------------------------------- */
.rl-progress-wrap {
    width: 100%;
    margin-top: -0.35rem;
}

.rl-progress-track {
    width: 100%;
    height: 6px;
    background: var(--index-surface-raised, rgba(20, 38, 35, 0.95));
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.rl-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--index-accent, #79f0b8);
    border-radius: 999px;
    transition: width 0.35s ease-out;
    box-shadow: 0 0 12px var(--index-accent-soft, rgba(121, 240, 184, 0.4));
}

/* --------------------------------------------------------------------------
   4-STEP STEPPER
   -------------------------------------------------------------------------- */
.rl-stepper-wrap {
    width: 100%;
    padding: 0.35rem 0;
}

.rl-stepper {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    position: relative;
}

.rl-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    position: relative;
}

.rl-step-item:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 17px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--index-border-soft, rgba(87, 128, 111, 0.28));
    z-index: 1;
    transition: background 0.3s ease;
}

.rl-step-item.is-done:not(:last-child)::after {
    background: var(--index-accent, #79f0b8);
}

.rl-step-node {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--index-surface-raised, rgba(16, 32, 29, 0.96));
    border: 2px solid var(--index-border, rgba(95, 163, 133, 0.38));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    transition: all 0.25s ease;
}

.rl-step-node-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2.6;
    fill: none;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
}

.rl-step-label {
    margin-top: 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--index-text-muted, #739182);
    transition: color 0.2s ease;
}

/* Step States */
.rl-step-item.is-done .rl-step-node {
    background: var(--index-accent, #79f0b8);
    border-color: var(--index-accent, #79f0b8);
    color: #070f14;
}

.rl-step-item.is-done .rl-step-node-icon {
    opacity: 1;
    transform: scale(1);
}

.rl-step-item.is-done .rl-step-label {
    color: var(--index-text-soft, #a4cdb7);
}

.rl-step-item.is-active .rl-step-node {
    background: var(--index-card-bg, #070f14);
    border-color: var(--index-accent, #79f0b8);
    box-shadow: 0 0 0 4px var(--index-accent-soft, rgba(121, 240, 184, 0.22));
}

.rl-step-item.is-active .rl-step-node::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--index-accent, #79f0b8);
    box-shadow: 0 0 8px var(--index-accent, #79f0b8);
}

.rl-step-item.is-active .rl-step-label {
    color: var(--index-accent, #79f0b8);
}

/* --------------------------------------------------------------------------
   LIVE SIGNALS SECTION & 4 METRIC CARDS
   -------------------------------------------------------------------------- */
.rl-signals-section {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
}

.rl-signals-header {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--index-accent, #79f0b8);
}

.rl-signals-header svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
}

.rl-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    width: 100%;
}

.rl-metric-card {
    background: var(--index-surface-raised, rgba(16, 32, 29, 0.8));
    border: 1px solid var(--index-border-soft, rgba(87, 128, 111, 0.25));
    border-radius: 10px;
    padding: 0.95rem 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.3rem;
}

.rl-metric-value {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--index-accent, #79f0b8);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.rl-metric-label {
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--index-text-muted, #739182);
    line-height: 1.3;
}

/* --------------------------------------------------------------------------
   DYNAMIC ACTIVITY LINE
   -------------------------------------------------------------------------- */
.rl-activity-line {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.88rem;
    color: var(--index-text-soft, #a4cdb7);
    min-height: 24px;
    width: 100%;
}

.rl-spinner-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    animation: rl-spin 1s linear infinite;
    stroke: var(--index-accent, #79f0b8);
}

@keyframes rl-spin {
    100% {
        transform: rotate(360deg);
    }
}

/* --------------------------------------------------------------------------
   PROGRESSIVE DISCLOSURE: PROTOCOL ACCORDION
   -------------------------------------------------------------------------- */
.rl-protocol-section {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
}

.rl-protocol-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.65rem 0.95rem;
    background: var(--index-surface-raised, rgba(16, 32, 29, 0.75));
    border: 1px solid var(--index-border-soft, rgba(87, 128, 111, 0.25));
    border-radius: 8px;
    color: var(--index-text-soft, #a4cdb7);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.rl-protocol-btn:hover,
.rl-protocol-btn:focus-visible {
    background: var(--index-surface-raised, rgba(22, 42, 40, 0.95));
    border-color: var(--index-border, rgba(95, 163, 133, 0.5));
    color: var(--index-text-main, #ffffff);
    outline: none;
}

.rl-chevron-icon {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    stroke-width: 2.2;
    fill: none;
    transition: transform 0.25s ease;
}

.rl-protocol-btn[aria-expanded="true"] .rl-chevron-icon {
    transform: rotate(180deg);
}

.rl-protocol-drawer {
    width: 100%;
    border: 1px solid var(--index-border-soft, rgba(87, 128, 111, 0.22));
    border-radius: 8px;
    background: var(--index-card-bg, rgba(7, 15, 20, 0.85));
    padding: 0.75rem 0.95rem;
    box-sizing: border-box;
}

.rl-protocol-drawer[hidden] {
    display: none;
}

.rl-timeline-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.rl-timeline-item {
    font-size: 0.76rem;
    color: var(--index-text-soft, #a4cdb7);
    line-height: 1.4;
    word-break: break-word;
}

.rl-timeline-ts {
    color: var(--index-text-muted, #739182);
    font-variant-numeric: tabular-nums;
    margin-right: 0.45rem;
    font-weight: 500;
}

.rl-timeline-empty {
    font-size: 0.78rem;
    color: var(--index-text-muted, #739182);
    font-style: italic;
}

/* Footer Reassurance Hint */
.rl-footer-hint {
    font-size: 0.84rem;
    color: var(--index-text-muted, #739182);
    text-align: center;
    line-height: 1.45;
    max-width: 52ch;
}

/* ==========================================================================
   RESPONSIVE LAYOUT MODES (CENTRAL RUNTIME CLASSIFIER)
   ========================================================================== */

/* 1. PC WIDESCREEN (scan-layout-wide) */
body.scan-layout-wide .rl-main-container {
    padding: 2rem 1.5rem 3rem;
}

/* 2. MOBILE PORTRAIT (scan-layout-mobile-portrait) */
body.scan-layout-mobile-portrait .rl-main-container {
    padding: 1rem 1rem 2rem;
}

body.scan-layout-mobile-portrait .rl-content-wrap {
    gap: 1.35rem;
}

body.scan-layout-mobile-portrait .rl-card {
    padding: 1.25rem 1.15rem;
}

body.scan-layout-mobile-portrait .rl-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
}

body.scan-layout-mobile-portrait .rl-metric-card {
    padding: 0.75rem 0.5rem;
}

body.scan-layout-mobile-portrait .rl-step-label {
    font-size: 0.65rem;
    letter-spacing: 0.03em;
}

body.scan-layout-mobile-portrait .rl-step-node {
    width: 30px;
    height: 30px;
}

body.scan-layout-mobile-portrait .rl-step-item:not(:last-child)::after {
    top: 15px;
}

/* 3. MOBILE LANDSCAPE (scan-layout-mobile-landscape) */
body.scan-layout-mobile-landscape .rl-main-container {
    padding: 0.5rem 1rem 1rem;
    justify-content: flex-start;
}

body.scan-layout-mobile-landscape .rl-content-wrap {
    width: 100%;
    max-width: 900px;
    gap: 0.55rem;
}

/* Dense Intro on Mobile Landscape */
body.scan-layout-mobile-landscape .rl-intro {
    display: none; /* Highly dense landscape hides big intro to preserve viewport height */
}

body.scan-layout-mobile-landscape .rl-card {
    padding: 0.85rem 1.15rem;
}

/* 2-Column Split in Landscape */
body.scan-layout-mobile-landscape .rl-card-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1.25rem;
    align-items: start;
}

body.scan-layout-mobile-landscape .rl-col-left {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

body.scan-layout-mobile-landscape .rl-col-right {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    border-left: 1px solid var(--index-border-soft, rgba(87, 128, 111, 0.2));
    padding-left: 1.25rem;
}

body.scan-layout-mobile-landscape .rl-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
}

body.scan-layout-mobile-landscape .rl-metric-card {
    padding: 0.45rem 0.35rem;
}

body.scan-layout-mobile-landscape .rl-metric-value {
    font-size: 1.25rem;
}

body.scan-layout-mobile-landscape .rl-metric-label {
    font-size: 0.7rem;
}

body.scan-layout-mobile-landscape .rl-step-node {
    width: 26px;
    height: 26px;
}

body.scan-layout-mobile-landscape .rl-step-item:not(:last-child)::after {
    top: 13px;
}

body.scan-layout-mobile-landscape .rl-step-label {
    font-size: 0.62rem;
    margin-top: 0.3rem;
}

body.scan-layout-mobile-landscape .rl-footer-hint {
    font-size: 0.75rem;
}

/* ==========================================================================
   THEME COMPATIBILITY ADJUSTMENTS
   ========================================================================== */

/* Elfenbein (theme-carbon-indigo) - Light theme contrast */
body.theme-carbon-indigo {
    color: var(--index-text-main, #1c2e26);
}

body.theme-carbon-indigo .rl-title {
    color: var(--index-text-main, #1c2e26);
    text-shadow: none;
}

body.theme-carbon-indigo .rl-card {
    background: var(--index-surface, #ffffff);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

body.theme-carbon-indigo .rl-metric-card {
    background: var(--index-surface-raised, #f5f4ed);
}

body.theme-carbon-indigo .rl-step-node {
    background: #ffffff;
}

body.theme-carbon-indigo .rl-step-item.is-done .rl-step-node {
    color: #ffffff;
}

body.theme-carbon-indigo .rl-protocol-btn,
body.theme-carbon-indigo .rl-protocol-drawer {
    background: #f5f4ed;
}
