/* Ajuste de z-index para modais principais e preview */
#modalGaleria {
    z-index: 1200 !important;
}
#modalNovoBalaustre, #modalAnexos, #modalPerfil, #cmdOverlay, #hiramPanel {
    z-index: 1100 !important;
}
/* =========================================================
   GLMM · STYLE.CSS — LOGIN PAGE
   Padrão: Midnight Opulence · Grid 4pts · UX Senior
   ========================================================= */

/* RESET GERAL */
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #050914;
    font-family: 'Inter', sans-serif;
    color: #ffffff;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* =========================================================
   1. FUNDO, GRAIN TEXTURE E OVERLAY
   ========================================================= */
.global-bg {
    position: fixed; inset: 0;
    background-image: url('fundo.png');
    background-size: cover;
    background-position: center;
    transform: scale(1.05);
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

/* Grain overlay para textura premium */
.global-overlay {
    position: fixed; inset: 0;
    background:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E"),
        linear-gradient(135deg, rgba(8, 12, 22, 0.88) 0%, rgba(4, 6, 10, 0.96) 100%);
    z-index: 2;
}

/* =========================================================
   2. ESTRUTURA PRINCIPAL
   ========================================================= */
.app-container {
    position: relative; z-index: 3;
    display: flex;
    width: 100%;
    min-height: 100dvh;
}

/* =========================================================
   3. LADO ESQUERDO — HERO
   ========================================================= */
.hero-section {
    flex: 1.2;
    display: flex; flex-direction: column; justify-content: center;
    padding: 10% 8%;
    position: relative;
    animation: heroFadeIn 0.8s ease-out both;
    animation-delay: 0.1s;
}

@keyframes heroFadeIn {
    from { opacity: 0; transform: translateX(-24px); }
    to   { opacity: 1; transform: translateX(0); }
}

.top-brand {
    position: absolute; top: 48px; left: 8%;
    display: flex; align-items: center; gap: 16px;
}

.mini-logo {
    width: 44px; height: 44px;
    border-radius: 50%; object-fit: cover;
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.1);
}

.brand-name {
    font-family: 'Poppins', serif;
    font-size: 1.5rem; font-weight: 500; letter-spacing: 2px;
}

.brand-tag {
    background: rgba(184, 144, 71, 0.12);
    border: 1px solid rgba(184, 144, 71, 0.25);
    color: #D4AF37;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 2px;
    padding: 8px 16px; border-radius: 24px;
    width: fit-content; margin-bottom: 24px;
    text-transform: uppercase;
}

.hero-content h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 3.5rem; font-weight: 700;
    line-height: 1.08; margin-bottom: 24px; letter-spacing: -1.5px;
}

.hero-content p {
    font-size: 1rem; color: #94a3b8;
    max-width: 440px; line-height: 1.75; font-weight: 300;
}

/* =========================================================
   4. LADO DIREITO — LOGIN + GLASSMORPHISM REFINADO
   ========================================================= */
.login-section {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    position: relative; padding: 40px;
    animation: loginFadeIn 0.8s ease-out both;
    animation-delay: 0.2s;
}

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

/* Frosted Glass Premium */
.glass-card {
    background: linear-gradient(145deg, rgba(20, 26, 43, 0.6) 0%, rgba(8, 12, 22, 0.8) 100%);
    backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.15); /* Efeito de luz no topo do vidro */
    border-radius: 24px;
    width: 100%; max-width: 420px;
    padding: 48px 40px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glass-card h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.6rem; font-weight: 300;
    margin-bottom: 25px; color: #ffffff;
    letter-spacing: -0.5px;
}

/* =========================================================
   5. CAMPOS — FORMULÁRIO COM FLOATING LABELS E CORREÇÃO DE AUTOFILL
   ========================================================= */
.input-glass-group {
    position: relative;
    margin-bottom: 24px;
    animation: fieldSlideUp 0.5s ease-out both;
}

.input-glass-group:nth-child(1) { animation-delay: 0.35s; }
.input-glass-group:nth-child(2) { animation-delay: 0.45s; }

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

.input-icon {
    position: absolute; left: 16px; top: 18px;
    color: #64748b; font-size: 20px; pointer-events: none;
    transition: color 0.3s ease, transform 0.3s ease;
    z-index: 2;
}

.toggle-icon {
    position: absolute; right: 16px; top: 18px;
    color: #64748b; font-size: 20px; cursor: pointer; transition: color 0.3s;
    z-index: 2;
}

.toggle-icon:hover { color: #ffffff; }

/* Input base */
.input-glass {
    width: 100%; height: 56px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 22px 48px 6px 48px; /* Espaço pro label flutuar */
    font-size: 1rem; color: #ffffff; font-weight: 500;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* O Segredo do Floating Label */
.floating-label {
    position: absolute;
    left: 48px; top: 18px;
    color: #64748b; font-size: 1rem;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left top;
}

/* Quando foca OU quando tem texto digitado OU quando o navegador faz AUTOFILL */
.input-glass:focus ~ .floating-label,
.input-glass:not(:placeholder-shown) ~ .floating-label,
.input-glass:-webkit-autofill ~ .floating-label {
    transform: translateY(-10px) scale(0.75);
    color: #D4AF37;
    font-weight: 600;
}

.input-glass:focus {
    border-color: #D4AF37;
    background: rgba(212, 175, 55, 0.03);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
    outline: none;
}
.input-glass:focus ~ .input-icon { color: #D4AF37; }

/* HACK PARA AUTOFILL DO CHROME/SAFARI (Matar o fundo branco/amarelo) */
.input-glass:-webkit-autofill,
.input-glass:-webkit-autofill:hover, 
.input-glass:-webkit-autofill:focus, 
.input-glass:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 50px #0a0f19 inset !important; /* Preenche internamente com a cor do tema esmeralda/escuro */
    -webkit-text-fill-color: #ffffff !important; /* Força a cor do texto digitado para branco */
    transition: background-color 5000s ease-in-out 0s; /* Hack para evitar o fundo de piscar branco no carregamento */
    caret-color: #ffffff; /* Cor do cursor de digitação */
}

/* =========================================================
   6. OPÇÕES DO FORMULÁRIO
   ========================================================= */
.form-options {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 28px;
    font-size: 0.84rem; color: #94a3b8;
    animation: fieldSlideUp 0.5s ease-out both;
    animation-delay: 0.55s;
}

.forgot-link {
    color: #D4AF37; text-decoration: none;
    transition: opacity 0.2s;
    font-weight: 500;
}
.forgot-link:hover { opacity: 0.75; }

.checkbox-container {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.checkbox-container input { display: none; }

.checkmark {
    width: 16px; height: 16px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    display: inline-block; position: relative;
    transition: all 0.2s ease;
    background: transparent;
}

.checkbox-container input:checked + .checkmark {
    background: #D4AF37; border-color: #D4AF37;
}
.checkbox-container input:checked + .checkmark::after {
    content: '';
    position: absolute; left: 4px; top: 1px;
    width: 4px; height: 8px;
    border: solid #000; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* =========================================================
   7. BOTÃO PRIMÁRIO — COM SPINNER
   ========================================================= */
.btn-gold {
    width: 100%; height: 56px;
    background: linear-gradient(135deg, #D4AF37 0%, #B6952F 50%, #E8C847 100%);
    background-size: 200% auto;
    color: #050914; border: none; border-radius: 12px;
    font-size: 1rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px;
    font-family: 'Inter', sans-serif;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(212, 175, 55, 0.25);
    animation: fieldSlideUp 0.5s ease-out both;
    animation-delay: 0.65s;
    position: relative; overflow: hidden;
}

/* Shimmer no hover */
.btn-gold::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}
.btn-gold:hover::after { transform: translateX(100%); }

.btn-gold:hover {
    background-position: right center;
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(212, 175, 55, 0.4);
}

.btn-gold:active { transform: translateY(0); box-shadow: 0 4px 16px rgba(212, 175, 55, 0.2); }

.btn-gold:disabled {
    opacity: 0.65; transform: none;
    cursor: not-allowed; box-shadow: none;
}

/* Animação do Spinner */
.btn-spinner {
    font-size: 20px !important;
    animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* =========================================================
   8. CAIXA DE ERRO (com animação de shake)
   ========================================================= */
.error-box {
    margin-top: 16px; padding: 12px 16px;
    border-radius: 8px;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: #f87171;
    font-size: 0.84rem; text-align: center;
    display: none;
    animation: shakeError 0.4s ease;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

/* =========================================================
   9. RODAPÉ
   ========================================================= */
.glass-footer {
    position: absolute; bottom: 40px;
    text-align: center; color: #475569; font-size: 0.75rem;
    animation: fieldSlideUp 0.5s ease-out both;
    animation-delay: 0.8s;
}

.sub-footer { margin-top: 4px; opacity: 0.6; }

/* =========================================================
   10. RESPONSIVIDADE MOBILE (OTIMIZAÇÃO SEVERA)
   ========================================================= */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
        height: auto;
        padding-bottom: 48px;
    }

    .hero-section {
        flex: none;
        padding: 40px 24px 20px;
        text-align: center;
        align-items: center;
        animation: heroFadeIn 0.6s ease-out both;
    }

    .top-brand {
        position: relative;
        top: 0; left: 0;
        margin-bottom: 24px;
        justify-content: center;
    }

    .brand-tag { margin: 0 auto 20px auto; }

    .hero-content h1 {
        font-size: 1.6rem;
        margin-bottom: 16px;
        letter-spacing: -1px;
    }

    .hero-content p {
        font-size: 0.9rem;
        margin: 0 auto;
    }

    .login-section {
        flex: none;
        padding: 16px 20px;
        width: 100%;
    }

    .glass-card {
        padding: 36px 28px;
        margin-bottom: 20px;
    }

    .glass-footer {
        position: relative;
        bottom: auto;
        margin-top: 24px;
    }
}

/* Atualize a classe .mini-logo */
.mini-logo {
    width: 24px; height: 24px; /* PROPORÇÃO REDUZIDA para refinamento visual e foco */
    border-radius: 50%; object-fit: cover;
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.1);
}

/* Atualize as cores dos ícones e labels para melhor contraste (WCAG) */
.input-icon {
    position: absolute; left: 16px; top: 18px;
    color: #94a3b8; /* Contraste corrigido */
    font-size: 20px; pointer-events: none;
    transition: color 0.3s ease, transform 0.3s ease;
    z-index: 2;
}

/* Transforme o .toggle-icon em um botão sem estilo base, mas com boa área de toque */
.toggle-icon {
    position: absolute; right: 8px; top: 8px;
    background: transparent; border: none;
    padding: 10px; /* Aumenta a área de toque para mobile */
    color: #94a3b8; font-size: 20px; 
    cursor: pointer; transition: color 0.3s;
    z-index: 2; display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
}

.toggle-icon:hover, .toggle-icon:focus-visible { 
    color: #ffffff; 
    outline: 2px solid rgba(212, 175, 55, 0.5); /* Foco para teclado */
}

/* Corrigir Contraste do Label */
.floating-label {
    position: absolute;
    left: 48px; top: 18px;
    color: #94a3b8; /* Contraste corrigido */
    font-size: 1rem;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left top;
}

/* ACESSIBILIDADE DO CHECKBOX (O segredo para não reprovar) */
.checkbox-container input { 
    /* Nunca use display: none em formulários. Oculte visualmente: */
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
    margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* Focus Ring no Checkbox para quem navega por TAB */
.checkbox-container input:focus-visible + .checkmark {
    outline: 2px solid #D4AF37;
    outline-offset: 4px;
}

/* Focus Ring nos links e botão de submit */
.forgot-link:focus-visible {
    outline: 2px solid #D4AF37; outline-offset: 4px; border-radius: 4px;
}

.btn-gold:focus-visible {
    outline: 3px solid #ffffff; outline-offset: 4px;
}

/* =========================================================
   MODAL DE RECUPERAÇÃO DE SENHA (INDEX)
   Padrão: Midnight Opulence · Glassmorphism
   ========================================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 9, 20, 0.85); /* Fundo escuro com alta opacidade */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeInOverlay 0.3s ease-out forwards;
}

.modal-glass {
    background: rgba(16, 22, 36, 0.7); /* Tom Midnight profundo translúcido */
    border: 1px solid rgba(212, 175, 55, 0.15); /* Borda sutil em gold */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 40px 32px 32px 32px;
    width: 100%;
    max-width: 420px;
    position: relative;
    text-align: center;
    animation: slideUpModal 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.btn-close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.btn-close-modal:hover,
.btn-close-modal:focus-visible {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

/* =========================================================
   ANIMAÇÕES CIRÚRGICAS DA MODAL
   ========================================================= */

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUpModal {
    from { 
        opacity: 0; 
        transform: translateY(20px) scale(0.98); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

/* =========================================================
   TEXTO DE ESQUECI MINHA SENHA - PREMIUM EDITION (LAPIDADO)
   Padrão: Midnight Opulence · Ouro Polido e Reflexo Físico
   ========================================================= */

.forgot-link {
    position: relative;
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    letter-spacing: 0.3px;
    padding-bottom: 2px;
    
    /* Paleta de ouro realista: base escura -> ouro puro -> feixe de luz branco -> ouro puro */
    background: linear-gradient(
        110deg,
        #A67C00 0%,
        #D4AF37 30%,
        #FFF9E6 50%, /* Feixe de luz incandescente */
        #D4AF37 70%,
        #A67C00 100%
    );
    background-size: 250% auto;
    
    /* O texto recorta o fundo, revelando o gradiente */
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    
    /* Animação lenta e elegante em estado de repouso */
    animation: premiumGoldShine 6s linear infinite;
    
    /* Transição suave para o hover */
    transition: filter 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    
    /* Sombra projetada leve usando drop-shadow (melhor que text-shadow para background-clip) */
    filter: drop-shadow(0 2px 4px rgba(212, 175, 55, 0.15));
}

/* A linha de sublinhado que aparece no hover (Efeito luxuoso de expansão) */
.forgot-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    /* Linha que se dissolve nas pontas */
    background: linear-gradient(90deg, transparent, #D4AF37, transparent);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0.8;
}

/* =========================================================
   INTERAÇÃO (HOVER / FOCUS)
   ========================================================= */

.forgot-link:hover,
.forgot-link:focus-visible {
    /* Acelera a passagem da luz e aumenta a projeção do brilho */
    animation: premiumGoldShine 2s linear infinite;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.6));
    outline: none;
}

/* Expande a linha do centro para as bordas */
.forgot-link:hover::after,
.forgot-link:focus-visible::after {
    transform: scaleX(1);
}

/* =========================================================
   MOTOR DA ANIMAÇÃO DO FEIXE DE LUZ
   ========================================================= */

@keyframes premiumGoldShine {
    to {
        /* Move o gradiente horizontalmente para criar a ilusão de reflexo */
        background-position: -250% center;
    }
}

@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}