/* ==========================================================================
   CSS Design System: NPD Spectrum Analyzer
   ========================================================================== */

:root {
    --bg-dark: #0b0914;
    --bg-card: rgba(19, 17, 36, 0.7);
    --border-color: rgba(147, 130, 255, 0.18);
    --border-hover: rgba(147, 130, 255, 0.4);
    
    /* Elegant Violet & Cyan HSL Palette */
    --color-primary: hsl(252, 100%, 75%);      /* Electric Violet */
    --color-primary-glow: hsla(252, 100%, 75%, 0.35);
    
    --color-cyan: #00f2fe;                      /* Cosmic Cyan */
    --color-cyan-glow: rgba(0, 242, 254, 0.35);
    
    --color-magenta: #fbc2eb;                   /* Pastel Rose */
    --color-grandiose: #ff5e62;                 /* Coral Red for Grandiose */
    --color-vulnerable: #00f2fe;                /* Cosmic Cyan for Vulnerable */
    
    --text-main: #f3f1f9;
    --text-muted: #a39eb9;
    --text-dim: #6c6685;
    
    --font-outfit: 'Outfit', 'Noto Sans SC', sans-serif;
    --transition-smooth: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(147, 130, 255, 0.25);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(147, 130, 255, 0.45);
}

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

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;
}

/* Space Background & Glowing Orbs */
.space-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

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

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

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

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

.stars-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 20px 30px, #fff, rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 150px 100px, rgba(255,255,255,0.7), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 300px 250px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 450px 80px, rgba(255,255,255,0.9), rgba(0,0,0,0));
    background-size: 550px 550px;
    opacity: 0.25;
}

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

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 2.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(147, 130, 255, 0.1);
    border: 1px solid rgba(147, 130, 255, 0.25);
    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.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 30%, #cdbdfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

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

/* Main Portal Card (Glassmorphism) */
.portal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    padding: 3rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 2rem;
}

.portal-card:hover {
    border-color: rgba(147, 130, 255, 0.25);
}

/* Stage Transitions */
.stage {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.stage.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   STAGE 1: Welcome Screen Styles
   ========================================================================== */
.welcome-visual {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.scanner-circle {
    position: relative;
    width: 140px;
    height: 140px;
    background: rgba(147, 130, 255, 0.05);
    border: 1px dashed rgba(147, 130, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prism-svg {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 0 10px rgba(161, 140, 209, 0.5));
    animation: rotatePrism 12s infinite linear;
}

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

.scanner-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-cyan), transparent);
    box-shadow: 0 0 10px var(--color-cyan);
    animation: scanAnimation 3.5s infinite ease-in-out;
}

@keyframes scanAnimation {
    0%, 100% { top: 10%; opacity: 0.2; }
    50% { top: 90%; opacity: 1; }
}

.intro-text {
    text-align: center;
    max-width: 720px;
    margin: 0 auto 2.5rem auto;
}

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

.intro-text p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    text-align: justify;
    text-justify: inter-word;
}

.test-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.meta-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.meta-icon {
    font-size: 1.5rem;
}

.meta-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

.welcome-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Buttons System */
.btn {
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.8rem 2rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #876df2 100%);
    color: #0b0914;
    box-shadow: 0 4px 15px rgba(135, 109, 242, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(135, 109, 242, 0.4);
}

.btn-glow {
    position: relative;
    overflow: hidden;
}

.btn-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: rotate(45deg);
    transition: 0.8s;
    opacity: 0;
}

.btn-glow:hover::after {
    left: 120%;
    opacity: 1;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-nav {
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
}

/* ==========================================================================
   STAGE 2: Quiz Engine
   ========================================================================== */
.progress-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.progress-bar-wrapper {
    flex-grow: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-cyan));
    border-radius: 10px;
    width: 0%;
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    min-width: 75px;
    text-align: right;
}

.question-container {
    text-align: center;
    margin-bottom: 3rem;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.question-dimension-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(0, 242, 254, 0.08);
    border: 1px solid rgba(0, 242, 254, 0.2);
    border-radius: 4px;
    color: var(--color-cyan);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.question-dimension-tag.grandiose {
    background: rgba(255, 94, 98, 0.08);
    border-color: rgba(255, 94, 98, 0.2);
    color: var(--color-grandiose);
}

.question-text {
    font-size: 1.45rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.5;
    max-width: 750px;
    word-break: break-all;
}

/* 5-Point Likert Options */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-width: 600px;
    margin: 0 auto 2.5rem auto;
}

.option-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    cursor: pointer;
    font-family: var(--font-outfit);
    color: var(--text-main);
    transition: var(--transition-smooth);
    text-align: left;
    outline: none;
}

.option-btn:hover {
    background: rgba(147, 130, 255, 0.06);
    border-color: var(--border-hover);
    transform: translateX(5px);
}

.option-score {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(147, 130, 255, 0.15);
    border: 1px solid rgba(147, 130, 255, 0.25);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    margin-right: 1.25rem;
    transition: var(--transition-smooth);
}

.option-btn:hover .option-score {
    background: var(--color-primary);
    color: #0b0914;
    box-shadow: 0 0 8px var(--color-primary-glow);
}

.option-label {
    font-size: 0.95rem;
    font-weight: 500;
}

.quiz-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 1.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.hint-text {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* ==========================================================================
   STAGE 3: Quantum Loader (Analyzing)
   ========================================================================== */
.loading-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 350px;
}

.quantum-loader {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 2.5rem;
}

.nucleus {
    position: absolute;
    top: 45px;
    left: 45px;
    width: 10px;
    height: 10px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 0 15px #fff;
}

.orbit {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid transparent;
}

.ring-1 {
    border-top-color: var(--color-primary);
    animation: rotateClockwise 2.5s infinite linear;
}

.ring-2 {
    border-right-color: var(--color-cyan);
    animation: rotateCounterClockwise 1.8s infinite linear;
    transform: scale(0.75);
}

.ring-3 {
    border-bottom-color: var(--color-magenta);
    animation: rotateClockwise 1.2s infinite linear;
    transform: scale(0.5);
}

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

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

.loading-wrapper h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    color: #fff;
}

.loading-tip {
    color: var(--text-muted);
    font-size: 0.9rem;
    min-height: 24px;
}

/* ==========================================================================
   STAGE 4: Result Screen Visual Systems
   ========================================================================== */
.result-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 3rem;
    align-items: start;
    margin-bottom: 2.5rem;
}

.result-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chart-box {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.spectrum-meter {
    position: relative;
    width: 200px;
    height: 200px;
    margin-bottom: 1.5rem;
}

.svg-ring-container {
    width: 200px;
    height: 200px;
    transform: rotate(-90deg);
}

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

.ring-active {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.ring-grandiose {
    stroke: var(--color-grandiose);
    filter: drop-shadow(0 0 4px rgba(255, 94, 98, 0.3));
}

.ring-vulnerable {
    stroke: var(--color-vulnerable);
    filter: drop-shadow(0 0 4px rgba(0, 242, 254, 0.3));
    stroke-width: 8;
}

.meter-labels {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.label-item {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 500;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.6rem;
}

.g-dot { background-color: var(--color-grandiose); box-shadow: 0 0 6px var(--color-grandiose); }
.v-dot { background-color: var(--color-vulnerable); box-shadow: 0 0 6px var(--color-vulnerable); }

.lbl {
    color: var(--text-muted);
    flex-grow: 1;
}

.val {
    font-weight: 700;
    font-size: 0.95rem;
}

.text-grandiose .val { color: var(--color-grandiose); }
.text-vulnerable .val { color: var(--color-vulnerable); }

.profile-card {
    background: linear-gradient(135deg, rgba(147, 130, 255, 0.05), rgba(0, 242, 254, 0.02));
    border: 1px solid rgba(147, 130, 255, 0.15);
    border-radius: 20px;
    padding: 1.5rem;
    text-align: center;
}

.profile-tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    background: rgba(147, 130, 255, 0.15);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
}

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

.profile-tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Results Content */
.result-content {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 1rem;
}

.result-section {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 1.5rem;
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    border-left: 3px solid var(--color-primary);
    padding-left: 0.75rem;
    margin-bottom: 1rem;
}

.section-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.section-title-wrapper .section-title {
    border-left: none;
    padding-left: 0;
    margin-bottom: 0;
}

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

.alert-box-development {
    border-color: rgba(147, 130, 255, 0.15);
    background: linear-gradient(180deg, rgba(147, 130, 255, 0.02) 0%, transparent 100%);
}

.diagnostic-paragraph {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.7;
    text-align: justify;
}

.guidelines-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.guidelines-list li {
    font-size: 0.9rem;
    color: var(--text-muted);
    position: relative;
    padding-left: 1.5rem;
}

.guidelines-list li::before {
    content: '✦';
    position: absolute;
    left: 0;
    color: var(--color-primary);
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 2rem;
    margin-top: 1.5rem;
}

/* ==========================================================================
   AMBIENT AUDIO SYSTEMS CONTROLLER
   ========================================================================== */
.sound-control-container {
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 10;
}

.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: 2.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: 868px) {
    .result-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .result-sidebar {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .chart-box {
        flex-grow: 1;
        max-width: 380px;
    }
    
    .profile-card {
        flex-grow: 1;
        max-width: 380px;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .result-content {
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 640px) {
    .portal-card {
        padding: 2rem 1.5rem;
    }
    
    .test-meta {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .main-title {
        font-size: 2rem;
    }
    
    .question-text {
        font-size: 1.25rem;
    }
    
    .welcome-actions, .result-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn {
        width: 100%;
    }
    
    .sound-control-container {
        position: static;
        display: flex;
        justify-content: center;
        margin-bottom: 1rem;
    }
}

/* CSS Keyframe Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
