/* ==========================================================================
   STYLE SYSTEM: Environment Quiz (Secretaria de Meio Ambiente e Agricultura)
   Design: Modern, Serious, Minimalist, Touch-screen & Smart TV Ready
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* Brand Colors */
    --bg-primary: #F3F7F5;          /* Clean off-white eco background */
    --bg-card: #FFFFFF;             /* Pure white for containers */
    --color-primary: #0A5F38;       /* Deep Institutional Forest Green */
    --color-primary-light: #10B981; /* Fresh Emerald Green */
    --color-primary-dark: #074528;  /* Deep Emerald Shadow */
    --color-primary-rgb: 10, 95, 56;
    
    /* UI Accent Colors */
    --color-text: #1E293B;          /* Slate Dark Gray */
    --color-text-light: #64748B;    /* Muted Gray */
    --color-border: #E2E8F0;        /* Light Slate Gray */
    --color-card-border: #E6EDE9;   /* Very soft green-gray */
    --color-overlay: rgba(0, 0, 0, 0.4);
    
    /* Layout & Visuals */
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --border-radius-sm: 8px;
    --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    /* Premium Shadows */
    --shadow-subtle: 0 4px 6px -1px rgba(0, 0, 0, 0.03), 0 2px 4px -1px rgba(0, 0, 0, 0.01);
    --shadow-premium: 0 20px 40px -15px rgba(10, 95, 56, 0.06), 0 1px 3px rgba(0, 0, 0, 0.01);
    --shadow-hover: 0 30px 60px -15px rgba(10, 95, 56, 0.12), 0 8px 16px -4px rgba(10, 95, 56, 0.04);
}

/* ==========================================================================
   Base & Reset Styles
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* Disable touch highlight on mobile/TV */
}

html, body {
    height: 100%;
    background-color: var(--bg-primary);
    color: var(--color-text);
    font-family: var(--font-family);
    font-size: 16px;
    overflow-x: hidden;
}

/* TV & Large screen safe-margins (prevent overscan cropping) */
body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: 3vh 5vw; /* Generous TV-safe paddings */
    position: relative;
}

/* Background Leaf SVG Watermark for Minimalist Accent */
body::before {
    content: '';
    position: absolute;
    bottom: -10%;
    right: -5%;
    width: 40vw;
    height: 40vw;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%230A5F38" opacity="0.02"><path d="M17,8C8,10 5.9,16.17 3.82,21.34L5.71,22L7.58,17.5C8.58,18 9.58,18.5 10.58,19C11.58,19.5 12.58,20 13.58,20.5C14.58,21 15.58,21.5 16.58,22H18C18,17 19,13 17,8M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"/></svg>');
    background-repeat: no-repeat;
    background-size: contain;
    pointer-events: none;
    z-index: 0;
}

/* ==========================================================================
   Header Component
   ========================================================================== */
.app-header {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2vh;
    z-index: 10;
}

.logo-container {
    background-color: transparent;
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
}

.logo-img {
    height: clamp(80px, 12vh, 130px);
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.03));
}

/* ==========================================================================
   Main Content Container
   ========================================================================== */
.app-main {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    z-index: 10;
    margin: 1.5vh 0;
}

/* The Unified Card holding the Quiz state */
.quiz-card {
    background-color: var(--bg-card);
    width: 100%;
    max-width: 1000px;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--color-card-border);
    box-shadow: var(--shadow-premium);
    padding: clamp(2rem, 5vh, 4rem) clamp(2rem, 5vw, 4.5rem);
    display: flex;
    flex-direction: column;
    gap: 3vh;
    position: relative;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.4s ease;
}

/* Screen Transitions (Fade and Slide-up effect) */
.quiz-screen {
    display: flex;
    flex-direction: column;
    gap: 3.5vh;
    animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Question Screen Elements
   ========================================================================== */

/* Progress counter on top of the card */
.progress-bar-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: clamp(0.95rem, 1.5vw, 1.25rem);
    font-weight: 600;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: -1vh;
}

.badge-inst {
    background-color: rgba(10, 95, 56, 0.08);
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    font-size: clamp(0.85rem, 1.2vw, 1.05rem);
    font-weight: 700;
}

.question-text {
    font-size: clamp(1.8rem, 3.2vh, 2.5rem);
    font-weight: 800;
    color: var(--color-text);
    line-height: 1.35;
    text-align: center;
    margin: 1vh 0;
}

/* The vertical stack of Options */
.options-stack {
    display: flex;
    flex-direction: column;
    gap: 1.8vh;
    width: 100%;
}

/* Option Card: Huge touch targets ideal for Kiosk and TV screens */
.option-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 2vw;
    padding: clamp(1.2rem, 2.5vh, 2rem) clamp(1.5rem, 3vw, 2.5rem);
    background-color: #FFFFFF;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-subtle);
    position: relative;
    overflow: hidden;
}

/* Focus and Active States for Touch Feedback */
.option-button:hover,
.option-button:focus-visible {
    border-color: var(--color-primary-light);
    background-color: rgba(16, 185, 129, 0.03);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.option-button:active {
    transform: translateY(1px) scale(0.995);
    background-color: rgba(16, 185, 129, 0.06);
}

/* Option Selected Visual State */
.option-button.selected {
    border-color: var(--color-primary);
    background-color: rgba(10, 95, 56, 0.04);
    box-shadow: 0 10px 25px -10px rgba(10, 95, 56, 0.15);
}

/* Letter Circle Indicator (A, B, C, D) */
.option-letter {
    flex-shrink: 0;
    width: clamp(48px, 6vh, 60px);
    height: clamp(48px, 6vh, 60px);
    border-radius: 50%;
    background-color: var(--bg-primary);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: clamp(1.2rem, 1.8vw, 1.5rem);
    border: 2px solid transparent;
    transition: var(--transition-smooth);
}

/* Change letter circle state when option selected/hovered */
.option-button:hover .option-letter,
.option-button:focus-visible .option-letter {
    background-color: var(--color-primary-light);
    color: #FFFFFF;
}

.option-button.selected .option-letter {
    background-color: var(--color-primary);
    color: #FFFFFF;
}

/* The actual option text */
.option-content {
    font-size: clamp(1.2rem, 2.2vh, 1.55rem);
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.35;
}

.option-button.selected .option-content {
    color: var(--color-primary-dark);
}

/* ==========================================================================
   Result / Prize Screen Elements
   ========================================================================== */
.result-screen {
    text-align: center;
    align-items: center;
}

/* Celebratory icon/wrapper */
.result-illustration {
    width: clamp(100px, 15vh, 140px);
    height: clamp(100px, 15vh, 140px);
    background-color: rgba(10, 95, 56, 0.06);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    margin-bottom: 1vh;
    animation: popScale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes popScale {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.result-illustration svg {
    width: 50%;
    height: 50%;
}

.result-celebration {
    font-size: clamp(1.6rem, 2.8vh, 2.2rem);
    font-weight: 700;
    color: var(--color-text-light);
    line-height: 1.3;
}

.result-score {
    font-size: clamp(2.2rem, 4.5vh, 3.5rem);
    font-weight: 800;
    color: var(--color-primary);
    margin: 1vh 0;
}

.result-score span {
    color: var(--color-primary-light);
}

/* Premium Prize card display */
.prize-showcase {
    background: linear-gradient(135deg, #FFFFFF, var(--bg-primary));
    border: 3px dashed var(--color-primary-light);
    border-radius: var(--border-radius-md);
    padding: clamp(2rem, 3.5vh, 3rem) 2.5rem;
    width: 100%;
    max-width: 600px;
    margin: 1.5vh 0;
    box-shadow: var(--shadow-subtle);
    animation: pulseBorder 2s infinite ease-in-out;
}

@keyframes pulseBorder {
    0%, 100% {
        border-color: var(--color-primary-light);
        box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.05);
    }
    50% {
        border-color: var(--color-primary);
        box-shadow: 0 10px 20px -5px rgba(10, 95, 56, 0.12);
    }
}

.prize-label {
    font-size: clamp(1.1rem, 1.8vw, 1.3rem);
    font-weight: 700;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1vh;
}

.prize-title {
    font-size: clamp(2.2rem, 4vh, 3rem);
    font-weight: 850;
    color: var(--color-primary-dark);
    text-shadow: 0 2px 4px rgba(10, 95, 56, 0.05);
}

/* Elegant ecological note under the prize */
.eco-friendly-note {
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    font-weight: 500;
    color: var(--color-text-light);
    max-width: 500px;
    line-height: 1.5;
    margin-top: 1vh;
}

/* Huge, high-contrast, premium next button */
.next-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: clamp(1.2rem, 2.5vh, 1.8rem) clamp(3.5rem, 6vw, 5rem);
    font-size: clamp(1.3rem, 2vh, 1.6rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #FFFFFF;
    background-color: var(--color-primary);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(10, 95, 56, 0.25);
    transition: var(--transition-smooth);
    margin-top: 2vh;
}

.next-button:hover,
.next-button:focus-visible {
    background-color: var(--color-primary-dark);
    transform: scale(1.05);
    box-shadow: 0 15px 30px rgba(10, 95, 56, 0.35);
}

.next-button:active {
    transform: scale(0.98);
}

.next-button svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.next-button:hover svg {
    transform: translateX(5px);
}

/* ==========================================================================
   Utility Screens (Loading, Errors)
   ========================================================================== */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 4rem;
}

.loader-spinner {
    width: 70px;
    height: 70px;
    border: 6px solid rgba(10, 95, 56, 0.1);
    border-top: 6px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.55, 0.055, 0.675, 0.19) infinite;
}

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

.error-container {
    text-align: center;
    padding: 3rem;
    color: #D32F2F;
}

.error-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.error-message {
    font-size: 1.3rem;
    color: var(--color-text-light);
}

/* ==========================================================================
   Footer Component
   ========================================================================== */
.app-footer {
    text-align: center;
    font-size: clamp(0.85rem, 1.2vw, 1.05rem);
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 10;
    margin-top: 2vh;
}

/* ==========================================================================
   Responsive Breakpoints & Adjustments for TV / Kiosk / Mobile
   ========================================================================== */

/* Optimization for horizontal widescreen Smart TVs / Totems */
@media (min-width: 1400px) {
    html {
        font-size: 18px; /* Scales everything proportionally */
    }
}

@media (min-width: 2000px) {
    html {
        font-size: 24px; /* Ultra HD / 4K Scalability */
    }
}

/* Portrait orientation or narrow tablet screens */
@media (max-width: 768px) {
    body {
        padding: 2vh 4vw;
    }
    
    .quiz-card {
        padding: 2.5rem 2rem;
    }
    
    .option-button {
        gap: 4vw;
        padding: 1.2rem 1.5rem;
    }
}
