/* ========== RESET & BASE ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bosch-blue: #003E64;
    --bosch-blue-light: #005691;
    --bosch-red: #ED0007;
    --bosch-red-dark: #C00006;
    --bosch-dark: #222222;
    --bosch-gray: #727273;
    --bosch-gray-light: #979899;
    --bosch-border: #CACACA;
    --bosch-bg: #F4F4F4;
    --bosch-white: #FFFFFF;
    --success: #0F9D58;
    --success-light: #D4EDDA;
    --success-dark: #0B7A42;
    --error: #DB4437;
    --error-light: #FDDEDE;
    --error-dark: #B8352A;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,62,100,0.18);
    --radius: 14px;
    --radius-sm: 10px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bosch-blue);
    background-image:
        radial-gradient(ellipse at 30% 0%, rgba(0,86,145,0.4) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 100%, rgba(0,30,50,0.6) 0%, transparent 60%);
    min-height: 100vh;
    color: var(--bosch-dark);
    overflow-x: hidden;
}

/* ========== PAGE SYSTEM ========== */
.page {
    display: none;
    min-height: 100vh;
    padding: 16px;
    align-items: center;
    justify-content: center;
    animation: fadeInUp 0.45s ease;
}

.page.active {
    display: flex;
}

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

/* ========== CARDS ========== */
.card {
    background: var(--bosch-white);
    border-radius: var(--radius);
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

/* ========== WELCOME CARD ========== */
.card-hero {
    background: linear-gradient(135deg, var(--bosch-blue) 0%, var(--bosch-blue-light) 100%);
    padding: 36px 24px 28px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.06) 0%, transparent 50%);
    background-size: 100% 100%;
}

.bosch-logo {
    position: relative;
    z-index: 1;
}

.bosch-logo-img {
    height: 50px;
    width: auto;
    filter: brightness(0) invert(1);
}

.bosch-logo-img-sm {
    height: 28px;
    width: auto;
    filter: brightness(0) invert(1);
}

.bosch-logo-img-loading {
    height: 44px;
    width: auto;
    margin-bottom: 12px;
}

.card-body {
    padding: 28px 28px 32px;
    text-align: center;
}

.badge {
    display: inline-block;
    background: var(--bosch-red);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 14px;
}

.welcome-card h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--bosch-dark);
    line-height: 1.3;
    margin-bottom: 12px;
}

.welcome-card h1 strong {
    color: var(--bosch-blue);
    font-weight: 900;
}

.welcome-text {
    color: var(--bosch-gray);
    font-size: 14px;
    line-height: 1.65;
    margin-bottom: 20px;
}

/* Scarcity bar */
.scarcity-bar {
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    border: 1px solid #F5C842;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.scarcity-icon {
    width: 24px;
    height: 24px;
    background: var(--bosch-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.scarcity-icon svg {
    stroke: white;
}

.scarcity-text {
    font-size: 12px;
    font-weight: 600;
    color: #92400E;
    flex: 1;
}

.scarcity-text strong {
    color: var(--bosch-red);
    font-weight: 800;
}

.scarcity-progress {
    width: 100%;
    height: 5px;
    background: rgba(146, 64, 14, 0.15);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 2px;
}

.scarcity-fill {
    height: 100%;
    width: 84%;
    background: linear-gradient(90deg, var(--bosch-red), #FF4444);
    border-radius: 3px;
    animation: scarcityPulse 2s ease-in-out infinite;
}

@keyframes scarcityPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.reward-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #EBF5FB, #D6EAF8);
    border: 1px solid rgba(0,62,100,0.12);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 24px;
    text-align: left;
}

.reward-img-wrap {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0,62,100,0.08);
}

.reward-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reward-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.reward-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--bosch-blue);
}

.reward-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--bosch-dark);
}

.reward-detail {
    font-size: 12px;
    color: var(--bosch-gray);
}

.disclaimer {
    font-size: 11px;
    color: var(--bosch-gray-light);
    margin-top: 12px;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-primary {
    background: var(--bosch-red);
    color: white;
    box-shadow: 0 4px 14px rgba(237,0,7,0.25);
}

.btn-primary:hover {
    background: var(--bosch-red-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(237,0,7,0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-cta {
    background: var(--bosch-red);
    color: white;
    box-shadow: 0 4px 14px rgba(237,0,7,0.3);
}

.btn-cta:hover {
    background: var(--bosch-red-dark);
    transform: translateY(-1px);
}

.btn-large {
    padding: 16px 28px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.btn-arrow {
    width: 20px;
    height: 20px;
}

/* ========== QUIZ PAGE ========== */
.quiz-card {
    padding: 0;
}

.quiz-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--bosch-blue), var(--bosch-blue-light));
}

.progress-container {
    flex: 1;
}

.progress-text {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    margin-bottom: 6px;
}

.progress-bar {
    height: 5px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--bosch-red);
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}

/* Question icon area with image */
.question-icon-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.q-image-wrap {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
}

.q-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.q-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(to top, rgba(0,62,100,0.85) 0%, transparent 100%);
    display: flex;
    justify-content: flex-start;
}

.q-icon-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 24px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.q-icon-badge svg {
    flex-shrink: 0;
    stroke: white;
}

.question-area {
    padding: 16px 24px;
}

.question-text {
    font-size: 17px;
    font-weight: 700;
    color: var(--bosch-dark);
    line-height: 1.45;
    margin-bottom: 16px;
}

/* ========== OPTIONS ========== */
.options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px;
    background: var(--bosch-white);
    border: 2px solid #E0E4E8;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 14px;
    color: var(--bosch-dark);
    text-align: left;
}

.option-btn:hover:not(.disabled) {
    border-color: var(--bosch-blue);
    background: #EBF5FB;
    transform: translateX(3px);
}

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bosch-bg);
    border: 2px solid #D0D4D8;
    font-weight: 700;
    font-size: 13px;
    color: var(--bosch-gray);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.option-text {
    font-weight: 500;
    line-height: 1.3;
}

/* Correct answer */
.option-btn.correct {
    border-color: var(--success);
    background: var(--success-light);
    animation: correctPulse 0.5s ease;
}

.option-btn.correct .option-letter {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.015); }
    100% { transform: scale(1); }
}

/* Wrong answer */
.option-btn.wrong {
    border-color: var(--error);
    background: var(--error-light);
    animation: wrongShake 0.5s ease;
}

.option-btn.wrong .option-letter {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-8px); }
    30% { transform: translateX(8px); }
    45% { transform: translateX(-5px); }
    60% { transform: translateX(5px); }
    75% { transform: translateX(-2px); }
    90% { transform: translateX(2px); }
}

.option-btn.disabled {
    cursor: default;
    opacity: 0.55;
}

.option-btn.correct.disabled,
.option-btn.wrong.disabled {
    opacity: 1;
}

.quiz-footer {
    padding: 0 24px 24px;
}

/* ========== LOADING PAGE ========== */
.loading-card {
    text-align: center;
    padding: 40px 28px 44px;
}

.loading-spinner {
    position: relative;
    width: 130px;
    height: 130px;
    margin: 24px auto;
}

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

.spinner-animated {
    transition: stroke-dashoffset 0.3s ease;
}

.spinner-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: 900;
    color: var(--bosch-red);
}

.loading-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--bosch-dark);
    margin-bottom: 6px;
}

.loading-subtitle {
    font-size: 13px;
    color: var(--bosch-gray);
    margin-bottom: 28px;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    max-width: 240px;
    margin: 0 auto;
}

.loading-step {
    font-size: 13px;
    color: var(--bosch-gray);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.step-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #D0D4D8;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.loading-step.done {
    color: var(--success);
    font-weight: 600;
}

.loading-step.done .step-dot {
    background: var(--success);
    border-color: var(--success);
    position: relative;
}

.loading-step.done .step-dot::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 3px;
    width: 8px;
    height: 5px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(-45deg);
}

/* ========== RESULT PAGE ========== */
#page-result {
    position: relative;
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.result-card {
    text-align: center;
    z-index: 5;
    position: relative;
    padding: 0;
}

.result-hero {
    background: linear-gradient(135deg, var(--bosch-blue) 0%, var(--bosch-blue-light) 100%);
    padding: 32px 24px 24px;
    position: relative;
    overflow: hidden;
}

.result-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(255,255,255,0.08) 0%, transparent 60%);
}

.celebration-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    color: #FDE68A;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 18px;
    border-radius: 20px;
    margin-bottom: 10px;
    animation: celebrationBounce 1s ease infinite;
    border: 1px solid rgba(253,230,138,0.3);
}

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

.result-title {
    font-size: 28px;
    font-weight: 900;
    color: white;
    position: relative;
}

.result-text {
    font-size: 14px;
    color: var(--bosch-gray);
    line-height: 1.6;
    padding: 20px 24px 0;
    margin-bottom: 20px;
}

/* Kit Preview */
.kit-preview {
    margin: 0 20px 16px;
    background: var(--bosch-white);
    border: 2px solid #E0E4E8;
    border-radius: var(--radius-sm);
    padding: 16px;
    position: relative;
    text-align: center;
}

.kit-badge {
    position: absolute;
    top: -10px;
    right: 14px;
    background: var(--bosch-red);
    color: white;
    font-size: 9px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 10px;
    letter-spacing: 1px;
}

.kit-image {
    width: 100%;
    max-width: 280px;
    height: auto;
    border-radius: 6px;
    margin-bottom: 12px;
}

.kit-details {
    text-align: center;
}

.kit-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--bosch-dark);
    margin-bottom: 2px;
}

.kit-desc {
    font-size: 12px;
    color: var(--bosch-gray);
    margin-bottom: 8px;
}

.kit-price {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.price-old {
    font-size: 13px;
    color: var(--bosch-gray-light);
    text-decoration: line-through;
}

.price-new {
    font-size: 15px;
    font-weight: 800;
    color: var(--success);
}

/* Urgency Bar */
.urgency-bar {
    margin: 0 20px 16px;
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    border: 1px solid #F5C842;
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}

.urgency-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 4px;
}

.urgency-label {
    font-size: 11px;
    font-weight: 700;
    color: #92400E;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.urgency-timer {
    display: block;
    font-size: 32px;
    font-weight: 900;
    color: var(--bosch-red);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    margin-bottom: 8px;
}

.urgency-progress {
    height: 4px;
    background: rgba(146, 64, 14, 0.15);
    border-radius: 2px;
    overflow: hidden;
}

.urgency-fill {
    height: 100%;
    background: var(--bosch-red);
    border-radius: 2px;
    transition: width 1s linear;
    width: 100%;
}

/* Pulse button */
.pulse-btn {
    margin: 0 20px 16px;
    width: calc(100% - 40px);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(237,0,7,0.3); }
    50% { box-shadow: 0 4px 28px rgba(237,0,7,0.55); }
}

/* Trust Badges */
.trust-badges {
    display: flex;
    justify-content: center;
    gap: 14px;
    padding: 0 20px 24px;
    flex-wrap: wrap;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--bosch-gray);
    font-weight: 600;
}

.trust-item svg {
    color: var(--bosch-blue);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 480px) {
    .card {
        border-radius: 12px;
    }

    .card-body {
        padding: 24px 20px 28px;
    }

    .welcome-card h1 {
        font-size: 22px;
    }

    .q-image-wrap {
        height: 130px;
    }

    .question-text {
        font-size: 15px;
    }

    .option-btn {
        padding: 12px;
        font-size: 13px;
    }

    .result-title {
        font-size: 24px;
    }

    .trust-badges {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

    .kit-image {
        max-width: 220px;
    }
}
