:root {
    /* Paleta Claro - Premium */
    --primary: #004a99;
    --accent: #f9b233;
    --white: #ffffff;
    --bg: #f4f7f9;
    --card-bg: #ffffff;
    --text-main: #1a1a1a;
    --text-sub: #666666;
    --border: rgba(0, 0, 0, 0.08);
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
    /* Paleta Escuro - Deep Slate / Premium Night */
    --bg: #0f172a;
    /* Cinza azulado muito profundo (Slate 950) */
    --primary: #1e293b;
    /* Slate 800 */
    --card-bg: #1e293b;
    /* Slate 800 */
    --text-main: #f8fafc;
    /* Slate 50 */
    --text-sub: #94a3b8;
    /* Slate 400 */
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --accent: #ffb833;
    /* Amarelo um pouco mais vibrante para contraste */
}

* {
    box-sizing: border-box;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    transition: background-color var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

#offline-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 100001;
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.5) rotate(-45deg);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    border: 2px solid white;
}

#offline-indicator.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1) rotate(0deg);
}

/* Aplica o fundo no HTML também para telas grandes */
html {
    background: var(--bg);
    width: 100vw;
    height: 100dvh;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    /* Distribuição mais controlada para evitar quebras em telas muito altas */
    justify-content: flex-start;
    align-items: center;
    overflow-y: auto;
    overflow-x: hidden;
    /* Adicione para evitar que a tela balance para os lados */
    padding-bottom: env(safe-area-inset-bottom, 15px);
}

body::-webkit-scrollbar {
    display: none;
}

/* --- LOADER --- */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background: #004a99;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.logo-container img {
    width: 90px;
    height: 90px;
    border-radius: 22px;
    object-fit: cover;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    animation: logoFloat 2.5s ease-in-out infinite;
}

.loading-text {
    color: white;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 3px;
    margin: 0;
    opacity: 0.8;
}

.loading-bar-container {
    width: 160px;
    height: 5px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.loading-bar-fill {
    width: 45%;
    height: 100%;
    background: #f9b233;
    border-radius: 10px;
    animation: progressMove 1.5s infinite ease-in-out;
}

.loader-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes progressMove {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(250%);
    }
}

/* --- BOTÃO MENU (Canto Esquerdo) --- */
.btn-nav {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    backdrop-filter: blur(5px);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* --- ÍCONE DO APP (Canto Direito) --- */
.icon-fixo {
    position: fixed;
    top: 15px;
    right: 15px;
    width: clamp(40px, 10vw, 45px);
    z-index: 1001;
    border-radius: 12px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

/* --- HERO (Banner Superior) --- */
.hero {
    position: relative;
    width: 100%;
    background: var(--primary);
    padding: clamp(30px, 6vh, 45px) 20px clamp(25px, 5vh, 40px) 20px;
    text-align: center;
    color: white;
    border-bottom-left-radius: clamp(25px, 8vw, 35px);
    border-bottom-right-radius: clamp(25px, 8vw, 35px);
    flex-shrink: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero h1 {
    margin: 0;
    font-size: clamp(55px, 16vw, 75px);
    /* Aumentado para não ficar muito pequeno, mantendo a harmonia */
    font-weight: 900;
    line-height: 0.85;
    letter-spacing: 1.5px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    background: linear-gradient(90deg, #fff, #a5c9ff, #fff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: apoioPulse 3s infinite ease-in-out, APOIO_SHIMMER 3s linear infinite;
}

@keyframes apoioPulse {

    0%,
    100% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.05);
        filter: brightness(1.2);
    }
}

@keyframes APOIO_SHIMMER {
    to {
        background-position: 200% center;
    }
}

.hero-subtitle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.hero p {
    margin: 0;
    font-size: clamp(12px, 3.5vw, 16px);
    opacity: 0.95;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
}

/* --- BADGE AL1 --- */
.badge-al1 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f9b233 0%, #ffde9c 50%, #f9b233 100%);
    color: #004a99;
    padding: 1px 10px;
    border-radius: 4px;
    font-weight: 900;
    font-size: 9px;
    box-shadow: 0 2px 8px rgba(249, 178, 51, 0.3);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    text-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    height: 16px;
    margin-left: -2px;
    /* Aproxima do texto */
}

.badge-al1::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    animation: shine-effect 2.5s infinite linear;
}

@keyframes shine-effect {
    0% {
        left: -150%;
    }

    30%,
    100% {
        left: 150%;
    }
}

/* --- MENUS E BOTÕES (NOVO LAYOUT UNIFORME) --- */
.menu-container {
    width: 92%;
    max-width: 500px;
    margin: clamp(5px, 2vh, 15px) auto;
    z-index: 10;
    /* Remove o flex: 1 para não "sugar" todo o espaço e causar buracos */
    display: flex;
    flex-direction: column;
}

.buttons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.menu-card {
    background: var(--card-bg);
    padding: 12px 4px;
    border-radius: 18px;
    text-decoration: none;
    color: var(--text-main);
    /* Sombra multi-camada para efeito premium de profundidade */
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 2px 4px -1px rgba(0, 0, 0, 0.03),
        0 10px 15px -3px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
}

.menu-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.menu-card:active {
    transform: scale(0.92) translateY(2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.menu-card i {
    font-size: 32px;
    /* Ícone Grande */
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.menu-card span {
    font-size: 8.5px;
    /* Nome Pequeno */
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    text-align: center;
    opacity: 0.8;
}

/* Botões simples agora todos iguais no grid de 3 */
.menu-card:nth-child(5) {
    grid-column: span 1;
    aspect-ratio: 1 / 0.95;
    flex-direction: column;
}

/* --- BANNER INFORMATIVO --- */
#banner-container {
    width: 90%;
    max-width: 450px;
    aspect-ratio: 16 / 9;
    /* 1080x1920 horizontal */
    max-height: 22vh;
    /* Restaurado para proporção original */
    border-radius: 20px;
    overflow: hidden;
    background: #ffffff;
    position: relative;
    margin: -15px auto 0 auto;
    /* Reduzido de -35px para descer um pouco o banner */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 11;
    flex-shrink: 0;
}

/* Container para mobile e PC facilitado */
.main-content-desktop {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    opacity: 0;
    /* Começa invisível para evitar quebra ao carregar */
    transition: opacity 0.4s ease-out;
}

.main-content-desktop.show {
    opacity: 1;
    /* Garante que o conteúdo principal empurre o rodapé se necessário, mas sem esticar */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#banner-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--accent), #ffcf7a);
    width: 0%;
    z-index: 10;
    border-radius: 0 5px 5px 0;
}

#banner-content {
    width: 100%;
    height: 100%;
    transition: opacity 0.5s ease-in-out;
    background: #004a99;
}

#banner-content img,
#banner-content video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.fade-out {
    opacity: 0 !important;
}

.pan-diagonal {
    transform: scale(1.1);
    animation: panDiagonalLento 10s ease-in-out infinite alternate;
}

@keyframes panDiagonalLento {
    0% {
        transform: scale(1.1) translate(0%, 0%);
    }

    100% {
        transform: scale(1.1) translate(-3%, -3%);
    }
}

.banner-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #004a99 0%, #003366 100%);
    color: white;
    text-align: center;
}

.banner-error small {
    font-size: 9px;
    opacity: 0.7;
    font-weight: 400;
    line-height: 1.1;
    display: block;
    margin-top: 2px;
    text-transform: none;
}

/* --- RODAPÉ --- */
.footer-logo {
    width: 100%;
    padding: 10px 0;
    margin-top: 15px;
    /* Trocado auto por 15px para juntar com os botões */
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
}

.footer-logo img {
    width: clamp(80px, 20vw, 100px);
    border-radius: 12px;
    margin-bottom: 5px;
}

footer {
    font-size: clamp(9px, 2.5vw, 11px);
    color: #999;
    text-align: center;
    padding: 0 20px;
}

.version-card {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(0, 74, 153, 0.05);
    border: 1px solid rgba(0, 74, 153, 0.1);
    border-radius: 100px;
}

.version-label {
    font-size: 9px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

#app-version-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    font-weight: bold;
    color: var(--accent);
}

/* --- MODAIS GERAIS (Ocultos por padrão) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    padding: 20px;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 20px;
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    color: var(--primary);
    margin-top: 0;
    margin-bottom: 20px;
}

.main-button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 25px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 74, 153, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.main-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 74, 153, 0.3);
    filter: brightness(1.1);
}

.main-button:active {
    transform: translateY(1px) scale(0.98);
}

.danger-button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 14px 25px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
    justify-content: center;
}

.danger-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.3);
    filter: brightness(1.1);
}

.danger-button:active {
    transform: translateY(1px) scale(0.98);
}

.menu-opt {
    width: 100%;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #f9f9f9;
    color: #444;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.menu-opt i {
    color: var(--primary);
    width: 20px;
}

.menu-opt.install-ready {
    background: #fff4e0;
    border-color: var(--accent);
}

/* --- NOVO MENU LATERAL (SIDE MENU PREMIUM 2.0) --- */
.side-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    visibility: hidden;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.4s ease, visibility 0.4s;
}

.side-menu-overlay.active {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
}

.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100%;
    background: rgba(var(--card-bg-rgb, 255, 255, 255), 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    z-index: 10001;
    transform: translateX(-105%);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.dark-mode .side-menu {
    background: rgba(30, 30, 35, 0.8);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.side-menu.active {
    transform: translateX(0);
}

.side-menu-header {
    background: linear-gradient(135deg, var(--primary) 0%, #0066cc 100%);
    padding: 50px 25px 30px 25px;
    color: white;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-bottom-right-radius: 40px;
    box-shadow: 0 10px 30px rgba(0, 74, 153, 0.3);
    position: relative;
    overflow: hidden;
}

.side-menu-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    filter: blur(30px);
}

.user-id-container {
    display: flex;
    align-items: center;
    gap: 18px;
    animation: slideRightMenu 0.5s ease backwards 0.2s;
}

.user-avatar {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

.user-avatar::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 15px;
    height: 15px;
    background: #10b981;
    border: 3px solid #004a99;
    border-radius: 50%;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info .filial-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.8;
    font-weight: 600;
}

.user-info .filial-num {
    font-size: 20px;
    font-weight: 900;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.side-menu-content {
    padding: 25px 15px;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

.side-menu-content::-webkit-scrollbar {
    width: 4px;
}

.side-menu-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.side-menu-content h4 {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-sub);
    letter-spacing: 2px;
    margin: 25px 0 15px 15px;
    font-weight: 800;
    opacity: 0.6;
}

.side-menu .menu-opt {
    margin: 5px 10px;
    border-radius: 15px;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 12px 18px;
    animation: slideRightMenu 0.4s ease backwards;
}

.side-menu .menu-opt:hover {
    background: rgba(0, 74, 153, 0.08);
    transform: translateX(8px);
    border-color: rgba(0, 74, 153, 0.1);
}

.dark-mode .side-menu .menu-opt:hover {
    background: rgba(255, 255, 255, 0.05);
}

.side-menu .menu-opt i {
    width: 30px;
    font-size: 18px;
}

/* Staggered Animation Delays */
.side-menu .menu-opt:nth-child(1) {
    animation-delay: 0.1s;
}

.side-menu .menu-opt:nth-child(2) {
    animation-delay: 0.15s;
}

.side-menu .menu-opt:nth-child(3) {
    animation-delay: 0.2s;
}

.side-menu .menu-opt:nth-child(4) {
    animation-delay: 0.25s;
}

.side-menu .menu-opt:nth-child(5) {
    animation-delay: 0.3s;
}

.side-menu .menu-opt:nth-child(6) {
    animation-delay: 0.35s;
}

@keyframes slideRightMenu {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.side-menu-footer {
    padding: 25px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.side-menu-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* --- EFEITOS DE TRANSIÇÃO (Centralizado) --- */

/* 1. Transição Profissional (Geral) */
#transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
    background: var(--primary);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s cubic-bezier(0.23, 1, 0.32, 1),
        visibility 0.6s cubic-bezier(0.23, 1, 0.32, 1),
        backdrop-filter 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    backdrop-filter: blur(0px);
}

body.page-exit #transition-overlay {
    opacity: 1;
    visibility: visible;
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

/* Efeito de saída suave na página */
.main-content-desktop,
body>div:not(#transition-overlay, #water-fill-container, #loading-screen, .btn-nav, .icon-fixo) {
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1),
        opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1),
        filter 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

body.page-exit .main-content-desktop,
body.page-exit body>div:not(#transition-overlay, #water-fill-container, #loading-screen, .btn-nav, .icon-fixo) {
    transform: scale(0.96) translateY(-15px);
    opacity: 0 !important;
    filter: blur(6px);
}

/* 2. Transição Líquida (Exclusiva Hidrômetro) */
#water-fill-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    pointer-events: none;
    overflow: hidden;
    background: transparent;
    filter: url('#liquid-gooey');
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

body.start-water-fill #water-fill-container,
body.water-drain #water-fill-container {
    opacity: 1;
    visibility: visible;
}

.water-layer {
    position: absolute;
    bottom: 0;
    left: -10%;
    width: 120%;
    height: 110%;
    background: var(--primary);
    transform: translateY(105%);
    border-radius: 45% 45% 0 0;
}

body.start-water-fill .water-layer {
    animation: curtainRise 2s cubic-bezier(0.45, 0, 0.55, 1) forwards,
        curtainWave 0.5s infinite alternate ease-in-out;
}

@keyframes curtainRise {
    0% {
        transform: translateY(105%);
    }

    100% {
        transform: translateY(0%);
    }
}

@keyframes curtainWave {
    0% {
        border-radius: 35% 65% 0 0 / 10% 15% 0 0;
    }

    100% {
        border-radius: 65% 35% 0 0 / 15% 10% 0 0;
    }
}

@keyframes dropExpand {
    0% {
        transform: scale(0);
        border-radius: 50%;
    }

    40% {
        transform: scale(15);
        border-radius: 45%;
    }

    100% {
        transform: scale(100);
        border-radius: 0;
    }
}

.bubble {
    position: absolute;
    bottom: -50px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    pointer-events: none;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.8);
    z-index: 15;
}

@keyframes bubbleFloat {
    0% {
        transform: translateY(0) scale(1) translateX(0);
        opacity: 0;
    }

    15% {
        opacity: 0.8;
    }

    50% {
        transform: translateY(-50vh) scale(1.2) translateX(30px);
    }

    100% {
        transform: translateY(-120vh) scale(1.5) translateX(-20px);
        opacity: 0;
    }
}

.bubble:nth-child(1) {
    width: 40px;
    height: 40px;
    left: 15%;
    animation: bubbleFloat 4s infinite ease-in 0.5s;
}

.bubble:nth-child(2) {
    width: 20px;
    height: 20px;
    left: 35%;
    animation: bubbleFloat 3s infinite ease-in 1.2s;
}

.bubble:nth-child(3) {
    width: 30px;
    height: 30px;
    left: 55%;
    animation: bubbleFloat 5s infinite ease-in 0.8s;
}

.bubble:nth-child(4) {
    width: 15px;
    height: 15px;
    left: 75%;
    animation: bubbleFloat 4s infinite ease-in 2s;
}

.bubble:nth-child(5) {
    width: 50px;
    height: 50px;
    left: 85%;
    animation: bubbleFloat 6s infinite ease-in 0.2s;
}

/* Estados de Ativação do Hidrômetro */
body.start-water-fill #water-fill-container {
    opacity: 1;
    visibility: visible;
}

/* Estado de drenagem para saída do Hidrômetro */
body.water-drain #water-fill-container {
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.45, 0, 0.55, 1);
}

#toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: auto;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.toast {
    background: rgba(0, 74, 153, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
    margin-bottom: 8px;
    opacity: 0;
    transition: all 0.3s ease;
    transform: translateY(20px);
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid var(--accent);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

body.dark-mode {
    --bg: #121212;
    --primary: #0a192f;
    color: #e0e0e0;
}

body.dark-mode .main-button,
body.dark-mode .sec-button,
body.dark-mode .modal-content {
    background: #1e1e1e;
    color: #fff;
    border-color: #333;
}

body.dark-mode .hero-header h1 {
    color: #ffffff !important;
}

body.dark-mode .hero-header p {
    color: rgba(255, 255, 255, 0.9) !important;
}

body.dark-mode .main-button p,
body.dark-mode footer {
    color: #bbb;
}


/* ====================================================
   LAYOUT EXCLUSIVO PARA DESKTOP (PC) / TABLETS
   ==================================================== */
@media (min-width: 1024px) {
    body {
        display: grid;
        grid-template-columns: 450px 1fr;
        grid-template-areas: "left right";
        height: 100vh;
        overflow: hidden;
    }

    .icon-fixo {
        top: 30px;
        right: 30px;
        width: 65px;
    }

    .btn-settings {
        top: 40px;
        right: 40px;
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .hero {
        grid-area: left;
        height: 101vh;
        /* Pequeno excesso para cobrir bordas */
        border-radius: 0 50px 50px 0;
        padding: 50px;
        margin: -1vh 0;
    }

    .hero h1 {
        font-size: 56px;
    }

    .hero p {
        font-size: 14px;
        letter-spacing: 6px;
    }

    .main-content-desktop {
        grid-area: right;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 40px;
        gap: 30px;
        overflow-y: auto;
        height: 100vh;
        /* Garante que preencha a altura no desktop */
    }

    #banner-container {
        width: 100%;
        max-width: 800px;
        aspect-ratio: 16 / 6;
        margin: 0;
        border-radius: 30px;
    }

    .menu-container {
        width: 100%;
        max-width: 800px;
        margin: 0;
    }

    .buttons-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .menu-card {
        aspect-ratio: 1 / 0.8;
    }

    .menu-card:nth-child(5) {
        grid-column: span 1;
        aspect-ratio: 1 / 0.8;
    }

    .footer-logo {
        position: absolute;
        bottom: 20px;
        right: 40px;
        width: auto;
        flex-direction: row;
        gap: 15px;
    }
}

@keyframes modalPop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* --- OVERLAY PARA BANNERS --- */
.banner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99998;
    display: none;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

body.modal-open {
    overflow: hidden;
}

/* Dark Mode para Banners centrais */
body.dark-mode #update-banner,
body.dark-mode #success-banner {
    background: #1e293b !important;
    color: #f8fafc !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8) !important;
}

body.dark-mode #update-banner p,
body.dark-mode #success-banner p {
    color: #94a3b8 !important;
}

body.dark-mode #update-changes-text,
body.dark-mode #current-version-text {
    background: #0f172a !important;
    color: #f8fafc !important;
    border-color: var(--primary) !important;
}

body.dark-mode .modal-content {
    background: #1e293b !important;
    color: #f8fafc !important;
}

body.dark-mode .menu-opt {
    background: #0f172a !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    color: #f8fafc !important;
}

/* --- CABEÇALHO HERO PREMIUM --- */
.hero-header {
    width: 100%;
    background: var(--primary);
    padding: clamp(20px, 5vh, 40px) 20px;
    border-bottom-left-radius: 40px;
    border-bottom-right-radius: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 25px;
    position: relative;
    color: white;
}

.btn-back-hero {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.2s;
}

.btn-back-hero:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.3);
}

.header-content {
    text-align: center;
    flex: 1;
}

.header-content h1 {
    margin: 0;
    font-size: clamp(16px, 4.5vw, 20px);
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-content p {
    margin: 2px 0 0 0;
    font-size: 9px;
    opacity: 0.8;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.header-logo {
    width: 45px;
    height: 45px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* --- TRANSIÇÃO DE SAÍDA --- */
.page-exit {
    opacity: 0 !important;
    transform: translateY(20px) !important;
    transition: all 0.45s ease-in-out !important;
    pointer-events: none !important;
}