/* index.css — Modern Premium Glassmorphic Theme for 'I'm AI Ready' Chatbot */

/* ── Reset & Base Variables ────────────────────────────────────────────── */
:root {
    --bg-dark: #f8f9fc;
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-glass: rgba(255, 255, 255, 0.95);
    --border-glass: rgba(41, 7, 202, 0.08);
    --border-active: rgba(41, 7, 202, 0.25);
    
    /* Branded Level Palette from Blueprint */
    --clr-gray: #71717a;
    --clr-blue: #2563eb;
    --clr-teal: #2907CA;
    --clr-green: #16803d;
    --clr-amber: #b45309;
    --clr-purple: #8D00FF;
    
    /* Functional Theme Colors */
    --primary: var(--clr-teal);
    --primary-glow: rgba(41, 7, 202, 0.08);
    --text-main: #2d3748;
    --text-muted: #6b7280;
    --text-dark: #111827;
    
    /* Fonts */
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Fraunces', Georgia, serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Animations */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

body, html {
    width: 100%;
    height: 100%;
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
}

/* ── Fullscreen Layout ────────────────────────────────────────────────── */
.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 50% 50%, #fcfcff 0%, #eef1f9 100%);
}

/* Ambient Glowing Blobs */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.2;
}
.glow-1 {
    width: 450px;
    height: 450px;
    background: var(--clr-teal);
    top: -10%;
    right: -10%;
    animation: pulse-glow 15s infinite alternate;
}
.glow-2 {
    width: 500px;
    height: 500px;
    background: var(--clr-purple);
    bottom: -15%;
    left: -10%;
    animation: pulse-glow 20s infinite alternate-reverse;
    opacity: 0.15;
}

@keyframes pulse-glow {
    0% { transform: translate(0, 0) scale(1); opacity: 0.25; }
    50% { transform: translate(40px, -30px) scale(1.15); opacity: 0.35; }
    100% { transform: translate(-20px, 40px) scale(0.9); opacity: 0.2; }
}

/* ── Chatbot Window Shell ─────────────────────────────────────────────── */
.chat-window {
    position: relative;
    width: 100%;
    max-width: 720px;
    height: 100vh;
    max-height: 900px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

@media (max-width: 768px) {
    .chat-window {
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
}

/* ── Glassmorphic Header ─────────────────────────────────────────────── */
.chat-header {
    padding: 18px 24px;
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(12px);
    z-index: 20;
}

.header-branding {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--clr-teal) 0%, var(--clr-blue) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: 0 4px 15px rgba(41, 7, 202, 0.4);
    letter-spacing: -0.5px;
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--clr-teal) 0%, var(--clr-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Settings Toggle button */
.settings-toggle-btn {
    position: relative;
    background: rgba(41, 7, 202, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.settings-toggle-btn:hover {
    color: #fff;
    background: rgba(41, 7, 202, 0.08);
}

.settings-status-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--clr-gray);
    border: 1.5px solid #000;
    transition: var(--transition-smooth);
}

.settings-status-indicator.connected {
    background-color: #4caf50;
    box-shadow: 0 0 6px #4caf50;
}

/* Persistent Language Selector Toggle */
.lang-toggle-container {
    display: flex;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-glass);
    padding: 2px;
    border-radius: 10px;
}

.lang-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.lang-btn.active {
    background: var(--clr-teal);
    color: #fff;
    box-shadow: 0 2px 8px rgba(41, 7, 202, 0.35);
}

/* Global Progress Badge */
.progress-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

#progress-text {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--clr-teal);
    font-weight: 700;
}

.progress-mini-bar {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.progress-mini-fill {
    height: 100%;
    width: 0%;
    background: var(--clr-teal);
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* Status Alert Banner bar */
.status-banner {
    display: none;
    padding: 8px 20px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    border-bottom: 1px solid var(--border-glass);
    transition: var(--transition-smooth);
}

.status-banner.info-mode {
    background-color: rgba(59, 140, 212, 0.12);
    color: #90caf9;
    border-color: rgba(59, 140, 212, 0.15);
}

.status-banner.live-mode {
    background-color: rgba(41, 7, 202, 0.12);
    color: #80cbc4;
    border-color: rgba(41, 7, 202, 0.15);
}

/* ── Chat Messages Stream ────────────────────────────────────────────── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

/* Message Bubble Shells */
.msg-wrapper {
    display: flex;
    gap: 12px;
    max-width: 85%;
    align-self: flex-start;
    animation: bubble-slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.msg-wrapper.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.92rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.bot .bubble {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    border-top-left-radius: 4px;
}

.user .bubble {
    background: linear-gradient(135deg, var(--clr-teal) 0%, var(--clr-purple) 100%);
    border: 1.5px solid var(--clr-teal);
    color: #ffffff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

@keyframes bubble-slide-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Inline S01 Archetype Teaser Cards ────────────────────────────────── */
.teaser-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 14px;
    width: 100%;
}

@media (max-width: 520px) {
    .teaser-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.teaser-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-glass);
    padding: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    text-align: center;
    transition: var(--transition-smooth);
}

.teaser-card:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.12);
}

.teaser-badge {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-bottom: 6px;
}

.teaser-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.teaser-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.start-btn {
    margin-top: 16px;
    background: linear-gradient(135deg, var(--clr-teal) 0%, #00897b 100%);
    color: #fff;
    border: none;
    outline: none;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-bounce);
    box-shadow: 0 4px 15px rgba(41, 7, 202, 0.35);
}

.start-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(41, 7, 202, 0.5);
}

/* ── Inline Section Quiz Card Block (Option 2) ───────────────────────── */
.section-quiz-card {
    background: #ffffff;
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 20px;
    margin-top: 14px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.section-quiz-card.completed {
    border-color: rgba(41, 7, 202, 0.3);
    background: rgba(41, 7, 202, 0.02);
}

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

.quiz-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: 0.2px;
}

.quiz-card-subtitle {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--clr-teal);
    font-weight: 700;
}

/* Single Question Row */
.quiz-question-node {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-question-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.4;
}

/* 5-Choice Likert Rating Node Row */
.rating-node-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: rgba(41, 7, 202, 0.02);
    border: 1px solid rgba(41, 7, 202, 0.05);
    border-radius: 12px;
    padding: 8px 12px;
    transition: var(--transition-smooth);
}

.rating-node-row:hover {
    border-color: rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.03);
}

.rating-edge-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    width: 80px;
    text-align: center;
}

.rating-edge-label.left {
    text-align: left;
}

.rating-edge-label.right {
    text-align: right;
}

/* Choices Circles Wrapper */
.rating-choices {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

/* Individual Rating Choice circle */
.rating-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid rgba(41, 7, 202, 0.15);
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-bounce);
}

.rating-circle:hover {
    border-color: var(--clr-teal);
    color: #fff;
    box-shadow: 0 0 10px rgba(41, 7, 202, 0.4);
    transform: scale(1.1);
}

.rating-circle.selected {
    background: var(--clr-teal);
    border-color: var(--clr-teal);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(41, 7, 202, 0.65);
    transform: scale(1.15);
}

/* Next Section Action Trigger button */
.next-section-btn {
    width: 100%;
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    padding: 12px;
    border-radius: 12px;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: not-allowed;
    transition: var(--transition-bounce);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.next-section-btn.enabled {
    background: linear-gradient(135deg, var(--clr-teal) 0%, #00897b 100%);
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(41, 7, 202, 0.3);
}

.next-section-btn.enabled:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 18px rgba(41, 7, 202, 0.45);
}

/* ── S09 Computation Loader Bubble ────────────────────────────────────── */
.typing-indicator-wrapper {
    display: flex;
    gap: 12px;
    padding: 0 24px;
    margin-bottom: 20px;
    align-self: flex-start;
}

.typing-bubble {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-top-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 18px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--clr-teal);
    border-radius: 50%;
    opacity: 0.4;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-4px); opacity: 1; }
}

.pulse-loader-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-left: 10px;
    animation: loader-pulse-text 1.5s infinite alternate;
}

@keyframes loader-pulse-text {
    0% { opacity: 0.6; }
    100% { opacity: 1; color: var(--clr-teal); }
}

/* ── S10 Rich Results Card Node ───────────────────────────────────────── */
.results-card {
    background: #ffffff;
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 24px;
    margin-top: 14px;
    width: 100%;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: results-card-reveal 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes results-card-reveal {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Results Card Header (Score & Badge) */
.results-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.archetype-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.archetype-tag {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--clr-teal);
}

.archetype-title-en {
    font-family: var(--font-sans);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.archetype-title-bm {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1rem;
    color: var(--text-muted);
}

.archetype-tagline {
    font-size: 0.8rem;
    color: var(--text-main);
    font-weight: 500;
    line-height: 1.4;
    border-left: 2px solid var(--primary);
    padding-left: 10px;
    margin-top: 4px;
}

/* Score Circle Meter gauge */
.score-circle-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.score-circle-svg {
    transform: rotate(-90deg);
}

.score-circle-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.05);
    stroke-width: 8;
}

.score-circle-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 251.2;
    stroke-dashoffset: 251.2; /* Will be animated in JS */
    transition: stroke-dashoffset 1.5s ease-out;
}

.score-circle-text {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1;
    font-family: var(--font-sans);
}

.score-label {
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Interactive Radar Chart Container */
.radar-chart-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(41, 7, 202, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 16px;
}

.radar-chart-canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Strength & Focus areas block */
.strengths-weaknesses-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (max-width: 520px) {
    .strengths-weaknesses-container {
        grid-template-columns: 1fr;
    }
}

.sw-badge-card {
    padding: 12px 16px;
    border-radius: 14px;
    border: 1.5px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sw-badge-card.strength {
    background: rgba(59, 109, 17, 0.08);
    border-color: rgba(59, 109, 17, 0.25);
}

.sw-badge-card.focus {
    background: rgba(186, 117, 23, 0.08);
    border-color: rgba(186, 117, 23, 0.25);
}

.sw-badge-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.strength .sw-badge-label { color: #81c784; }
.focus .sw-badge-label { color: #ffb74d; }

.sw-badge-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-dark);
}

.sw-badge-score {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Benchmark Block */
.benchmark-block {
    text-align: center;
    background: rgba(41, 7, 202, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.benchmark-highlight {
    color: var(--clr-teal);
    font-weight: 700;
}

/* ── S11 Official Declaration Screen Certificate Node ────────────────── */
.declaration-pledge-card {
    background: #08080c;
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 28px 24px;
    width: 100%;
    margin-top: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    text-align: center;
    color: #ffffff;
    animation: results-card-reveal 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.badge-card-serial {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    color: #4dc3ff;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

/* Glowing Circular Badge Container */
.cert-badge-circle {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    border: 5px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #12121a 0%, #0a0a0f 100%);
    margin: 15px 0;
    padding: 16px;
    position: relative;
    box-sizing: border-box;
    transition: var(--transition-bounce);
    animation: badge-pulse-animation 3s infinite alternate;
}

@keyframes badge-pulse-animation {
    0% { transform: scale(1); }
    100% { transform: scale(1.03); }
}

.badge-archetype-name {
    font-family: var(--font-sans);
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    text-align: center;
    text-transform: uppercase;
    line-height: 1.2;
}

.badge-archetype-level {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
    margin-bottom: 6px;
}

.badge-user-divider {
    width: 65%;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 2px 0;
}

.badge-user-name {
    font-family: var(--font-sans);
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 3px 0;
    letter-spacing: -0.2px;
}

.badge-hashtags {
    font-family: var(--font-sans);
    font-size: 0.58rem;
    font-weight: 700;
    color: #3b8bd4;
    margin-top: 6px;
    letter-spacing: 0.5px;
}

.badge-logo-container {
    margin-top: 8px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-rd-logo {
    height: 100%;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: 0.85;
}

.badge-welcome-msg {
    font-family: var(--font-sans);
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    margin: 10px 0 2px 0;
    letter-spacing: -0.3px;
}

.welcome-user-highlight {
    font-weight: 800;
    font-style: italic;
}

.cert-pledge-text {
    font-family: var(--font-serif);
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 400;
    font-style: italic;
    max-width: 92%;
    margin-bottom: 8px;
}

/* Sub Card: I Declare As A Role Card */
.declare-role-subcard {
    background: rgba(41, 7, 202, 0.03);
    border: 1px solid var(--border-glass);
    border-left: 3.5px solid var(--primary);
    border-radius: 14px;
    padding: 14px 20px;
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subcard-role-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.subcard-role-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

.subcard-role-tagline {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--clr-teal);
    text-transform: uppercase;
}

/* Download Canvas share-card action trigger */
.cert-download-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--clr-teal) 0%, #00897b 100%);
    color: #ffffff;
    border: none;
    outline: none;
    padding: 14px;
    border-radius: 14px;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-bounce);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(41, 7, 202, 0.35);
}

.cert-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(41, 7, 202, 0.5);
}

/* Completion badge — results card header (replaces score circle) */
.archetype-badge-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.2));
}

/* Completion badge — declaration card centerpiece */
.cert-badge-wrapper {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 8px 0 2px;
    flex-shrink: 0;
}

.cert-badge-img {
    width: 220px;
    height: 220px;
    object-fit: contain;
    animation: badge-pulse-animation 3s infinite alternate;
    filter: drop-shadow(0 0 22px var(--primary));
}

/* User name overlaid inside the badge's name slot (~57.3% from top on 721px source) */
.cert-badge-name {
    position: absolute;
    top: 57.3%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 58%;
    color: #1a237e;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.72rem;
    text-align: center;
    line-height: 1.25;
    word-break: break-word;
    pointer-events: none;
}

/* Action button row (download + dashboard) */
.cert-action-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* Return to Rakyat Digital Dashboard button */
.cert-dashboard-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-bounce);
    box-sizing: border-box;
}

.cert-dashboard-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

/* ── Hidden Share Card Target ────────────────────────────────────────── */
#canvas-share-target {
    display: none;
}

/* ── Input Footer Bar (Aesthetic Display) ──────────────────────────────── */
.chat-footer {
    padding: 16px 24px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid var(--border-glass);
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 4px 6px 4px 14px;
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.88rem;
}

.input-wrapper input::placeholder {
    color: rgba(0, 0, 0, 0.35);
    font-weight: 500;
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: not-allowed;
    transition: var(--transition-smooth);
}

.send-btn.active {
    background: var(--clr-teal);
    border-color: var(--clr-teal);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(41, 7, 202, 0.4);
}

.send-btn.active:hover {
    transform: scale(1.05);
}

.footer-metadata {
    margin-top: 10px;
    text-align: center;
}

#gov-aligned {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.15);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── API settings configuration modals ──────────────────────────────── */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fade-in 0.3s ease;
}

.settings-modal {
    background: #ffffff;
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    overflow: hidden;
    animation: modal-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15) forwards;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modal-pop {
    from { transform: scale(0.9) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
}

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

.close-modal-btn:hover {
    color: #fff;
}

.modal-body {
    padding: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--clr-teal);
    letter-spacing: 0.5px;
}

.form-group input {
    background: rgba(0,0,0,0.03);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-dark);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    outline: none;
}

.form-group input:focus {
    border-color: var(--clr-teal);
    box-shadow: 0 0 10px rgba(41, 7, 202, 0.25);
}

.help-text {
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.modal-footer {
    padding: 14px 20px;
    background: rgba(0,0,0,0.25);
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-btn {
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: var(--transition-smooth);
}

.modal-btn.secondary {
    background: transparent;
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
}

.modal-btn.secondary:hover {
    color: #fff;
    background: rgba(255,255,255,0.02);
}

.modal-btn.primary {
    background: var(--clr-teal);
    border: none;
    color: #fff;
}

.modal-btn.primary:hover {
    background: #00897b;
    box-shadow: 0 4px 12px rgba(41, 7, 202, 0.3);
}

/* ==========================================================================
   19. Conversational Demographic Onboarding Card Styling (S02 / S02B)
   ========================================================================== */
.onboarding-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    margin: 16px 0 16px 44px; /* Align with bot bubble offset */
    max-width: 500px;
    width: calc(100% - 60px);
    animation: slideInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.onboarding-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 14px;
    margin-bottom: 20px;
}

.onboarding-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
    background: none;
    -webkit-text-fill-color: initial;
}

.onboarding-step-indicator {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--clr-teal);
    background: rgba(41, 7, 202, 0.05);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(41, 7, 202, 0.2);
}

.onboarding-slide {
    display: none;
}

.onboarding-slide.active {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.onboarding-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.onboarding-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.onboarding-input {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text-dark);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    transition: all 0.3s ease;
}

.onboarding-input:focus {
    outline: none;
    border-color: var(--clr-teal);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(41, 7, 202, 0.2);
}

.onboarding-select {
    background: #ffffff;
    color: var(--text-dark);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    padding-right: 40px;
}

.onboarding-select option {
    background: #0f0f15;
    color: #ffffff;
}

.onboarding-radio-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.onboarding-radio-group label {
    flex: 1;
    min-width: 90px;
    background: rgba(0, 0, 0, 0.015);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    padding: 11px;
    font-size: 0.8rem;
    text-align: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.onboarding-radio-group input[type="radio"] {
    display: none;
}

.onboarding-radio-group input[type="radio"]:checked + label {
    background: rgba(41, 7, 202, 0.08);
    border-color: var(--clr-teal);
    color: var(--clr-teal);
    box-shadow: 0 0 12px rgba(41, 7, 202, 0.15);
}

.onboarding-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
}

.onboarding-btn {
    border: none;
    border-radius: 10px;
    padding: 12px 22px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.onboarding-btn.primary {
    background: linear-gradient(135deg, var(--clr-teal) 0%, #00877d 100%);
    color: #ffffff;
    margin-left: auto; /* Push next to right if no back btn */
}

.onboarding-btn.primary:hover {
    box-shadow: 0 0 15px rgba(41, 7, 202, 0.35);
    transform: translateY(-1px);
}

.onboarding-btn.secondary {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-muted);
}

.onboarding-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.onboarding-validation-error {
    color: #ff5a5a;
    font-size: 0.78rem;
    font-weight: 500;
    display: none;
    margin-top: 8px;
    align-items: center;
    gap: 6px;
}

.onboarding-card.sealed {
    opacity: 0.7;
    pointer-events: none;
}

.onboarding-card.sealed input,
.onboarding-card.sealed select,
.onboarding-card.sealed button {
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.01);
    border-color: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.3);
}

.onboarding-card.sealed .onboarding-step-indicator {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.3);
}

/* ── Mobile optimisation (≤ 480px) ───────────────────────────────────── */
@media (max-width: 480px) {
    /* Header: compact and prevent overflow */
    .chat-header {
        padding: 10px 12px;
        gap: 8px;
    }

    .header-branding {
        gap: 8px;
        min-width: 0;
        flex: 1 1 0;
        overflow: hidden;
    }

    /* Scale logo down */
    .brand-logo {
        height: 28px !important;
        width: auto !important;
    }

    .brand-text {
        min-width: 0;
    }

    .brand-text h1 {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Hide subtitle — too long, wraps badly on narrow screens */
    #header-subtitle {
        display: none;
    }

    .header-controls {
        gap: 6px;
        flex-shrink: 0;
    }

    .progress-mini-bar {
        width: 52px;
    }

    #progress-text {
        font-size: 0.65rem;
    }

    /* Lang toggle: tighter */
    .lang-toggle-container {
        padding: 2px;
    }

    /* Rating row: shrink edge labels so circles fit */
    .rating-node-row {
        padding: 6px 8px;
    }

    .rating-edge-label {
        width: 52px;
        font-size: 0.62rem;
        letter-spacing: 0;
        word-break: break-word;
    }

    .rating-choices {
        gap: 5px;
    }

    .rating-circle {
        width: 28px;
        height: 28px;
        font-size: 0.78rem;
    }

    /* Chat input bar: prevent overflow */
    .chat-input-area {
        padding: 10px 12px;
    }

    .chat-input-wrapper {
        gap: 8px;
    }
}

/* ── Toast Notification ────────────────────────────────────────────────── */
.toast-notification {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: rgba(20, 20, 30, 0.92);
    color: #fff;
    padding: 12px 22px;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.1px;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 9999;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}
.toast-notification.toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

