/* ==========================================================================
   Caçador de Geladeira - CSS v4 (Completo com Novos Níveis)
   Estrutura:
   1. Fontes e Estilos Base
   2. Estilos do SVG
   3. Estilos dos Alvos (Jogo) - Níveis 1, 2, 3, 4, 5, 6
   4. Feedback Visual (Pop-ups, Flash)
   5. Animações e Keyframes
   6. Layout das Telas (Menus, Jogo, Pausa)
   7. Estilos dos Modais (Info e Orçamento)
   8. Estilos da Rodada Bônus
   9. ESTILOS DA TELA DE RECOMENDAÇÃO
   ========================================================================== */

/* 1. Fontes e Estilos Base */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&display=swap');

body {
    font-family: 'Inter', system-ui, sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    overflow: hidden; 
}

/* 2. Estilos do SVG da Geladeira */
.fridge-diagram-3d { 
    width: 100%; 
    height: auto; 
    transform: none; 
    z-index: 10; 
}
.fridge-diagram-3d .fridge-face-side-right,
.fridge-diagram-3d .fridge-face-top { 
    fill: #E2E8F0; 
    stroke: #A0AEC0; 
    stroke-width: 0.5; 
}
.fridge-diagram-3d .fridge-face-front { 
    fill: #E2E8F0; 
    stroke: #A0AEC0; 
    stroke-width: 0.5; 
    transition: fill 0.1s ease-out; 
}
.fridge-diagram-3d .fridge-divider { 
    stroke: #718096; 
    stroke-width: 1; 
}
.format-divider-group { 
    opacity: 0; 
    transition: opacity 0.3s ease-in-out; 
}
.fridge-diagram-3d.format-duplex #divider-group-duplex { opacity: 1; }
.fridge-diagram-3d.format-inverse #divider-group-inverse { opacity: 1; }
.fridge-diagram-3d.format-side #divider-group-side { opacity: 1; }
.fridge-diagram-3d.format-french #divider-group-french { opacity: 1; }

.svg-preview {
    width: 100%;
    height: 100px; 
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    position: relative;
}
.svg-preview .fridge-diagram-3d { 
    height: 100%; 
    width: auto; 
}
#btn-duplex .fridge-face-front { fill: #a5f3fc; }
#btn-inverse .fridge-face-front { fill: #a7f3d0; }
#btn-side .fridge-face-front { fill: #bae6fd; }
#btn-french .fridge-face-front { fill: #c7d2fe; }

.svg-preview.small .fridge-diagram-3d { transform: scale(0.75); }
.svg-preview.medium .fridge-diagram-3d { transform: scale(1.0); }
.svg-preview.large .fridge-diagram-3d { transform: scale(1.2); }

.svg-preview.color-white .fridge-face-front { fill: #ffffff; }
.svg-preview.color-inox .fridge-face-front { fill: #9ca3af; }
.svg-preview.color-black .fridge-face-front { fill: #334155; }

#main-menu-svg-container {
    display: flex;
    align-items: center;
    justify-content: center;
}
#main-menu-svg-container .fridge-diagram-3d {
    height: 100%;
    width: auto;
    animation: pulse-gold 2.5s infinite ease-in-out;
}
#main-menu-svg-container .fridge-face-front {
    fill: #f59e0b;
}

/* 3. Estilos dos Alvos (Jogo) - Níveis 1-6 */
.fridge-target {
    position: absolute;
    width: 75px; 
    height: 85px;
    cursor: pointer;
    transition: transform 0.1s ease-out;
    animation: fadeIn 0.2s ease-out;
}
.fridge-target:active { transform: scale(0.9); }
.golden-target { animation: pulse-gold 1s infinite; }
.golden-target .fridge-face-front { fill: #f59e0b !important; }

.fridge-target.size-small { transform: scale(0.75); }
.fridge-target.size-medium { transform: scale(1.0); }
.fridge-target.size-large { transform: scale(1.2); }

.fridge-target.color-white .fridge-face-front { fill: #ffffff; }
.fridge-target.color-inox .fridge-face-front { fill: #9ca3af; }
.fridge-target.color-black .fridge-face-front { fill: #334155; }

.target-icon-overlay {
    position: absolute;
    font-size: 2rem;
    line-height: 1;
    opacity: 0.8;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5));
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}
.target-icon-overlay.wrong {
    font-size: 2.4rem;
    opacity: 0.5;
}
#hud-target-svg-container .target-icon-overlay {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    opacity: 0.9;
    z-index: 10;
}

.target-brand-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center; 
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    font-size: 0.5rem;
    color: white;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    letter-spacing: -2px;
    padding: 4px;
}

/* 4. Feedback Visual (Pop-ups, Flash) */
.feedback-pop {
    position: absolute;
    font-size: 2rem;
    font-weight: 900;
    pointer-events: none;
    animation: popOut 0.8s ease-out forwards;
}
.feedback-pop.correct { color: #22c55e; }
.feedback-pop.wrong { color: #ef4444; }

.feedback-pop.combo,
.feedback-pop.bonus {
    color: #f59e0b;
    animation: popOut 1s ease-out forwards;
}
.feedback-pop.combo { font-size: 2.2rem; }
.feedback-pop.bonus { font-size: 2.5rem; }

#timer-bar-fill {
    transition: width 0.1s linear;
}

#screen-flash.flash {
    animation: screenFlash 0.3s ease-out;
}

/* 5. Animações e Keyframes */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes popOut {
    0% { opacity: 1; transform: scale(0.5); }
    100% { opacity: 0; transform: scale(1.5) translateY(-30px); }
}
@keyframes pulse-gold {
    0%, 100% { transform: scale(1); filter: brightness(1.1); }
    50% { transform: scale(1.1); filter: brightness(1.5); }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-100%); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-100%); }
}
@keyframes screenFlash {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.7; }
}
@keyframes fall {
    from { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    to { transform: translateY(100vh) rotate(720deg); opacity: 1; }
}

/* 6. Layout das Telas */
.game-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-in-out;
    display: flex; 
    flex-direction: column;
    overflow: hidden;
}
.game-screen.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10; 
}
#screen-game.active { z-index: 5; }
#screen-pause.active { z-index: 20; }
#selection-modal-overlay.active { z-index: 30; }
#screen-bonus-game.active { z-index: 15; }
#screen-bonus-adjust.active { z-index: 16; }

#screen-select-tech, 
#screen-select-extra {
    overflow-y: auto;
    padding-bottom: 80px;
}

.priority-card,
.brand-card {
    background-color: #334155;
    border-radius: 0.5rem;
    border: 2px solid #475569;
    transition: all 0.2s ease;
    cursor: pointer;
}
.priority-card:hover:not(.disabled),
.brand-card:hover {
    border-color: #0ea5e9;
    transform: translateY(-2px);
}

.priority-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
}
.priority-card .icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}
.priority-card .name {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
}
.priority-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: #1e293b;
}
.priority-card.disabled .name {
    text-decoration: line-through;
}

.brand-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: 900;
    color: white;
}
.brand-card img {
    height: 40px;
    object-fit: contain;
}

#screen-pause {
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
#pause-button {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    color: #94a3b8;
    transition: all 0.2s ease;
}
#pause-button:hover { color: #f1f5f9; }

/* 7. Estilos dos Modais (Info e Orçamento) */
#selection-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}
#selection-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
#selection-info-modal {
    position: absolute;
    top: 5px;
    left: 0;
    right: 0;
    margin: 0 auto;
    max-width: 500px; 
    background-color: #1e293b;
    border-bottom: 1px solid #334155;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
}
#selection-modal-overlay.active #selection-info-modal {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    animation: slideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#selection-info-modal.closing {
    animation: slideUp 0.3s ease-out forwards;
}
#selection-info-modal h2 { color: white; }
#selection-info-modal p { color: #cbd5e1; }
#selection-info-price { font-weight: bold; color: #a5f3fc; }

/* 8. Estilos da Rodada Bônus */
.bonus-item {
    position: absolute;
    font-size: 1.5rem;
    font-weight: 700;
    color: #f59e0b;
    cursor: pointer;
    animation: fall 5s linear forwards;
    padding: 4px 8px;
    background-color: rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    border: 1px solid #f59e0b;
}
.bonus-item.coupon {
    color: #22c55e;
    background-color: rgba(34, 197, 94, 0.2);
    border: 1px solid #22c55e;
}

#budget-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 10px;
    background: #0f172a;
    border-radius: 5px;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
}
#budget-slider:hover { opacity: 1; }
#budget-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: #f59e0b;
    cursor: pointer;
    border-radius: 50%;
}
#budget-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #f59e0b;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

/* ==========================================================
   9. ESTILOS DA TELA DE RECOMENDAÇÃO
   ========================================================== */
.result-card {
    background-color: #1e293b;
    border: 2px solid #334155;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.highlight-badge {
    position: absolute;
    top: 0;
    left: 0;
    background: #22c55e;
    color: white;
    padding: 5px 15px;
    border-bottom-right-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    width: fit-content;
}

#recommendation-container .result-card:first-child .card-image img { padding-top: 15px; box-sizing: border-box; }

.card-image {
    background-color: #ffffff;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.card-image img {
    width: 100%;
    max-width: 150px;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.card-model {
    font-size: 1.3rem;
    font-weight: 900;
    color: #f1f5f9;
    margin: 0 0 10px 0;
}
.card-price {
    margin-bottom: 20px;
}
.card-price span {
    font-size: 1.5rem;
    font-weight: 700;
    color: #22c55e;
    display: block;
    line-height: 1.1;
}
.card-price label {
    font-size: 0.9rem;
    color: #94a3b8;
}
.card-section {
    font-size: 0.9rem;
    margin-bottom: 15px;
}
.card-section strong {
    color: #f1f5f9;
    margin-bottom: 8px;
    display: block;
}
.card-list {
    padding-left: 20px;
    margin: 0;
    color: #cbd5e1;
}
.card-list li { margin-bottom: 5px; }

.attention-section strong {
    color: #f87171;
}
.attention-list li {
    color: #cbd5e1;
    position: relative;
    padding-left: 20px;
}
.attention-list li::before {
    content: "⚠️";
    position: absolute;
    left: 0;
    top: 0;
}

.card-link {
    display: block;
    width: 100%;
    text-align: center;
    padding: 12px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid #0ea5e9;
    background-color: #0ea5e9;
    color: white;
    text-decoration: none;
    margin-top: auto;
    transition: all 0.2s ease;
}
.card-link:hover {
    background-color: #0284c7;
    border-color: #0284c7;
}

.info-trigger {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 28px;
    height: 28px;
    background-color: #334155;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s ease;
}
.info-trigger:hover {
    background-color: #0ea5e9;
    transform: scale(1.1);
}

@media (min-width: 640px) {
    .result-card {
        flex-direction: row;
    }
    .card-image {
        width: 200px;
    }
    .card-image img {
        max-width: 100%;
    }
}