/* ==========================================================================
   CSS Design System: PUA Defense Cabin
   ========================================================================== */

:root {
    --bg-dark: #05060d;
    --bg-card: rgba(13, 14, 28, 0.7);
    --border-color: rgba(255, 110, 110, 0.12); /* Crimson tint for warning */
    --border-hover: rgba(255, 110, 110, 0.35);
    
    --color-primary: #ff5e62;                   /* Crimson warning */
    --color-primary-glow: rgba(255, 94, 98, 0.3);
    
    --color-emerald: #10b981;                 /* Defensive emerald */
    --color-emerald-glow: rgba(16, 185, 129, 0.3);
    
    --color-cyan: #00f2fe;                      /* Intuitive blue */
    
    --text-main: #f5f6fa;
    --text-muted: #9ba1c6;
    --text-dim: #626786;
    
    --font-outfit: 'Outfit', 'Noto Sans SC', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-outfit);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Back to Hub button */
.back-home-btn {
    position: fixed;
    top: 2rem;
    left: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: var(--transition-smooth);
}

.back-home-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.back-home-btn svg {
    width: 20px;
    height: 20px;
}

/* Backgrounds */
.space-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.ambient-glow {
    position: absolute;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.12;
    mix-blend-mode: screen;
}

.orb-crimson {
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
    top: -20%;
    left: -10%;
    animation: floatOrb 25s infinite alternate ease-in-out;
}

.orb-emerald {
    background: radial-gradient(circle, var(--color-emerald) 0%, transparent 70%);
    bottom: -15%;
    right: -10%;
    animation: floatOrb 20s infinite alternate-reverse ease-in-out;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, -60px) scale(1.15); }
}

.stars-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 40px 80px, #fff, rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 200px 300px, rgba(255,255,255,0.6), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 600px 180px, #fff, rgba(0,0,0,0));
    background-size: 600px 600px;
    opacity: 0.18;
}

/* App Container */
.app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 3.5rem;
    animation: fadeInDown 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.badge {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    background: rgba(255, 94, 98, 0.08);
    border: 1px solid rgba(255, 94, 98, 0.2);
    border-radius: 50px;
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.8rem;
}

.main-title {
    font-size: 2.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 40%, #ffb6b9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.6rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* General Glassmorphism Cards */
.portal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.5);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.portal-card:hover {
    border-color: var(--border-hover);
}

.section-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 1rem;
}

.sec-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.sec-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.sec-icon {
    font-size: 1.25rem;
}

/* ==========================================================================
   1. HERO LANDING SECTION
   ========================================================================== */
.hero-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 3rem;
    align-items: center;
}

.hero-text h2 {
    font-size: 1.85rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
}

.hero-text p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 2rem;
    text-align: justify;
}

.emergency-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 94, 98, 0.06);
    border: 1px solid rgba(255, 94, 98, 0.15);
    border-radius: 8px;
    font-size: 0.82rem;
    color: var(--text-main);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-primary);
    box-shadow: 0 0 8px var(--color-primary);
    animation: glowPulse 1.8s infinite ease-in-out;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.15); }
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.shield-container {
    position: relative;
    width: 240px;
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rotating-shield {
    position: absolute;
    width: 240px;
    height: 240px;
    border: 2px dashed rgba(16, 185, 129, 0.25);
    border-radius: 50%;
    animation: rotateSlow 20s infinite linear;
}

@keyframes rotateSlow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.defense-shield-img {
    width: 175px;
    height: 175px;
    object-fit: contain;
    filter: drop-shadow(0 0 18px var(--color-emerald-glow));
    z-index: 2;
    animation: bounceSlow 5s infinite ease-in-out;
}

@keyframes bounceSlow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ==========================================================================
   2. INTERACTIVE TIMELINE: The 5-Step Trap
   ========================================================================== */
.step-navigator {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.step-tab {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 0.9rem 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    outline: none;
    font-family: inherit;
    transition: var(--transition-smooth);
}

.step-tab:hover {
    background: rgba(255, 94, 98, 0.04);
    border-color: rgba(255, 94, 98, 0.25);
}

.step-tab.active {
    background: rgba(255, 94, 98, 0.08);
    border-color: var(--color-primary);
    box-shadow: 0 0 15px var(--color-primary-glow);
}

.step-num {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-dim);
}

.step-tab.active .step-num {
    color: var(--color-primary);
}

.step-lbl {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
}

.step-tab.active .step-lbl {
    color: #fff;
}

.active-step-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 2rem;
    animation: fadeScaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeScaleIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

.step-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.step-dimension-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 94, 98, 0.08);
    border: 1px solid rgba(255, 94, 98, 0.2);
    border-radius: 4px;
    color: var(--color-primary);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.step-danger-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
}

.step-danger-badge.high-danger {
    color: var(--color-primary);
    background: rgba(255, 94, 98, 0.12);
    border: 1px solid rgba(255, 94, 98, 0.2);
}

.step-title-text {
    font-size: 1.45rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.8rem;
}

.step-description {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 2rem;
    text-align: justify;
}

.tactics-alert-box {
    background: rgba(255, 94, 98, 0.04);
    border-left: 3px solid var(--color-primary);
    border-radius: 0 12px 12px 0;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.alert-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.4rem;
}

.alert-tactics-text {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.defense-box {
    background: rgba(16, 185, 129, 0.04);
    border-left: 3px solid var(--color-emerald);
    border-radius: 0 12px 12px 0;
    padding: 1.25rem;
}

.defense-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.4rem;
}

.defense-text {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ==========================================================================
   3. CLINICAL CASE STUDY SANDBOX
   ========================================================================== */
.sandbox-tabs {
    display: flex;
    gap: 0.85rem;
    margin-bottom: 1.75rem;
}

.sandbox-tab-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    color: var(--text-muted);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.sandbox-tab-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.15);
}

.sandbox-tab-btn.active {
    color: #fff;
    background: rgba(0, 242, 254, 0.08);
    border-color: var(--color-cyan);
}

.case-viewport {
    min-height: 250px;
    position: relative;
    margin-bottom: 2rem;
}

.case-container {
    display: none;
    flex-direction: column;
    gap: 1.25rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.case-container.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* Chat bubble aesthetics */
.chat-bubble {
    max-width: 80%;
    padding: 1.1rem 1.4rem;
    border-radius: 16px;
    position: relative;
}

.chat-bubble.left {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 94, 98, 0.18);
    border-left-width: 4px;
    border-top-left-radius: 4px;
}

.chat-bubble.right {
    align-self: flex-end;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.18);
    border-right-width: 4px;
    border-top-right-radius: 4px;
    text-align: right;
}

.chat-sender {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chat-bubble.right .chat-sender {
    color: var(--color-emerald);
}

.chat-bubble.left .chat-sender {
    color: var(--color-primary);
}

.chat-content {
    font-size: 0.92rem;
    color: var(--text-main);
    line-height: 1.6;
    text-align: justify;
}

/* Highlighted poisonous words */
.toxic-trigger {
    display: inline;
    border-bottom: 2.5px dashed var(--color-primary);
    color: #ff9d9f;
    font-weight: 600;
    cursor: pointer;
    background: rgba(255, 94, 98, 0.06);
    padding: 0 0.2rem;
    transition: var(--transition-smooth);
}

.toxic-trigger:hover {
    background: rgba(255, 94, 98, 0.2);
    color: #fff;
}

/* Popup Overlay Diagnostics card */
.sandbox-pop-up {
    background: rgba(10, 11, 22, 0.95);
    border: 1px solid var(--border-hover);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    position: relative;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: slideInUp 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.pop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.pop-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #fff;
    flex-grow: 1;
    margin-left: 0.5rem;
}

.pop-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.pop-close:hover {
    color: #fff;
}

.pop-body {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.diagnostic-row {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.diagnostic-row strong {
    color: #fff;
    font-weight: 600;
}

.diagnostic-defense {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-top: 0.3rem;
}

.diagnostic-defense strong {
    color: var(--color-emerald);
}

.diagnostic-defense #pop-template {
    color: #fff;
    font-weight: 500;
}

/* ==========================================================================
   4. BOUNDARY HEALTH CHECKLIST & DIAGNOSTICS
   ========================================================================== */
.checklist-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 3rem;
    align-items: start;
}

.checklist-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Customized checkbox container */
.check-item-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 45px;
    min-height: 28px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    user-select: none;
    transition: var(--transition-smooth);
}

.check-item-container:hover {
    color: #fff;
}

/* Hide native checkbox */
.check-item-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Custom Checkmark Box */
.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 24px;
    width: 24px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 110, 110, 0.18);
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.check-item-container:hover input ~ .checkmark {
    border-color: rgba(255, 110, 110, 0.45);
}

/* Checked styling */
.check-item-container input:checked ~ .checkmark {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 10px var(--color-primary-glow);
}

/* Create checkmark tick inside box */
.checkmark::after {
    content: "";
    position: absolute;
    display: none;
}

.check-item-container input:checked ~ .checkmark::after {
    display: block;
}

.check-item-container .checkmark::after {
    left: 8px;
    top: 4px;
    width: 6px;
    height: 11px;
    border: solid #05060d;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.check-lbl {
    line-height: 1.45;
}

/* Checked row label coloring */
.check-item-container input:checked ~ .check-lbl {
    color: #ff9d9f;
}

/* Checklist diagnostics panel */
.checklist-sidebar {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 2.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.meter-box {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gauge-svg-container {
    position: relative;
    width: 160px;
    height: 160px;
}

.gauge-svg {
    width: 160px;
    height: 160px;
    transform: rotate(-90deg);
}

.g-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.03);
    stroke-width: 10;
}

.g-fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    stroke: var(--color-emerald);
    filter: drop-shadow(0 0 6px var(--color-emerald-glow));
    transition: stroke-dashoffset 0.8s cubic-bezier(0.19, 1, 0.22, 1), stroke 0.8s ease;
}

.gauge-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gauge-val {
    font-size: 1.85rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.gauge-lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.25rem;
    text-transform: uppercase;
}

.meter-feedback-card {
    width: 100%;
    text-align: center;
}

.meter-tag {
    display: inline-block;
    padding: 0.2rem 0.75rem;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--color-emerald);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
}

.meter-tag.danger-tag {
    background: rgba(255, 94, 98, 0.12);
    border-color: rgba(255, 94, 98, 0.25);
    color: var(--color-primary);
}

.meter-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Sound Controllers Overlay */
.sound-control-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.sound-toggle-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    color: var(--text-muted);
    font-family: var(--font-outfit);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.sound-toggle-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.sound-toggle-btn.muted .sound-icon {
    opacity: 0.4;
}

.sound-toggle-btn.muted .sound-lbl {
    text-decoration: line-through;
}

/* Footer Section */
.app-footer {
    text-align: center;
    margin-top: 3.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.app-footer p {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
}

.disclaimer {
    max-width: 600px;
    margin: 0 auto;
    font-style: italic;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 900px) {
    .hero-layout, .checklist-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .hero-visual {
        order: -1;
    }
    
    .checklist-sidebar {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
    }
    
    .meter-box, .meter-feedback-card {
        flex-grow: 1;
        max-width: 400px;
    }
}

@media (max-width: 680px) {
    .step-navigator {
        grid-template-columns: 1fr;
    }
    
    .step-tab {
        flex-direction: row;
        justify-content: flex-start;
        padding: 0.75rem 1.25rem;
        gap: 1rem;
    }
    
    .chat-bubble {
        max-width: 90%;
    }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
