/* ==========================================
   CONGOV - TELA DE CADASTRO INSTITUCIONAL
   Mobile First & Premium UI 
============================================= */

:root {
    --bg: #f8fafc; 
    --surface: #ffffff;
    --text-main: #1e293b; 
    --text-muted: #64748b;
    --border: #e2e8f0; 
    --danger: #ef4444; 
    --success: #10b981;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* Botão Voltar para Home Premium */
.back-to-home {
    position: absolute;
    top: 30px;
    left: 30px;
    z-index: 100;
}

.btn-home-floating {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.btn-home-floating:hover {
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    color: var(--primary-hover);
}

.btn-home-floating svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.btn-home-floating:hover svg {
    transform: translateX(-3px);
}

body { 
    color: var(--text-main); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    min-height: 100vh; 
    padding: 20px; 
    position: relative;
}

.auth-card { 
    width: 100%; 
    max-width: 700px; 
    background: var(--surface); 
    border-radius: 20px; 
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); 
    overflow: hidden; 
    padding: 40px; 
    position: relative; 
    z-index: 10;
}

.brand { text-align: center; margin-bottom: 25px; }
.brand img { max-height: 60px; object-fit: contain;}
.brand h1 { font-size: 2rem; font-weight: 900; color: var(--primary); letter-spacing: -0.5px;}

.header-titles { text-align: center; margin-bottom: 30px; }
.header-titles h2 { font-size: 1.5rem; font-weight: 800; color: #1e1b4b; margin-bottom: 8px; letter-spacing: -0.5px;}
.header-titles p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.5;}

.progress-container { width: 100%; height: 6px; background: #f1f5f9; border-radius: 3px; margin-bottom: 30px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); width: 50%; transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1); }

.step-wrapper { display: none; animation: fadeIn 0.4s ease; }
.step-wrapper.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.grid-3 { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 15px; }

.input-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px;}
.input-group label { font-size: 0.85rem; font-weight: 800; color: #1e293b; }
.input-group label span.req { color: var(--danger); font-weight: 900;}
.input-group label span.opt { color: var(--text-muted); font-weight: 600; font-size: 0.75rem; }
.input-group input { padding: 14px 16px; border: 1px solid #cbd5e1; border-radius: 12px; font-size: 16px; outline: none; transition: 0.2s; width: 100%; background: #f8fafc; color: var(--text-main);}
.input-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: #ffffff;}

.pwd-wrapper { position: relative; }
.toggle-pwd { position: absolute; right: 14px; top: 14px; background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 0; transition: 0.2s;}
.toggle-pwd:hover { color: var(--primary); }

.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 35px; padding-top: 25px; border-top: 1px dashed var(--border); }

.btn { padding: 15px 24px; border-radius: 12px; font-weight: 700; font-size: 0.95rem; cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; }
.btn-outline { background: transparent; color: var(--text-muted); border: 2px solid var(--border); }
.btn-outline:hover { color: var(--primary); background: #f8fafc; border-color: var(--primary); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 12px var(--primary-soft);}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 6px 15px var(--primary-soft);}
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; transform: none; box-shadow: none;}

.link-login { color: var(--primary); font-size: 0.9rem; font-weight: 700; text-decoration: none; transition: 0.2s;}
.link-login:hover { text-decoration: underline; color: var(--primary-hover);}

.valida-box { text-align: center; max-width: 450px; margin: 0 auto; }
.valida-box h3 { font-size: 1.5rem; font-weight: 800; color: #1e1b4b; margin-bottom: 10px; letter-spacing: -0.5px;}
.valida-box p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 25px; line-height: 1.6; }
.code-input { width: 100%; text-align: center; font-size: 2.5rem; font-weight: 800; letter-spacing: 12px; padding: 20px; border: 2px dashed #cbd5e1; border-radius: 16px; outline: none; color: var(--primary); margin-bottom: 25px; transition: 0.2s;}
.code-input:focus { border-color: var(--primary); background: var(--primary-soft); }
.code-input::placeholder { color: #cbd5e1; font-weight: 400; letter-spacing: normal; font-size: 1.5rem;}
.btn-full { width: 100%; }

.resend-box { margin-top: 25px; font-size: 0.9rem; color: var(--text-muted); font-weight: 500;}
.btn-resend { background: none; border: none; font-size: 0.95rem; font-weight: 700; color: var(--text-muted); text-decoration: underline; cursor: not-allowed; padding: 0; margin-left: 5px; transition: 0.2s;}
.btn-resend.active { color: var(--primary); cursor: pointer; }
.btn-resend.active:hover { color: var(--primary-hover); }

.toast-container { position: fixed; bottom: 30px; right: 30px; z-index: 9999; display: flex; flex-direction: column; gap: 15px; }
.toast { display: flex; align-items: flex-start; gap: 12px; min-width: 320px; max-width: 400px; background: white; border-radius: 12px; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1); padding: 18px 20px; transform: translateX(120%); transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); border-left: 4px solid var(--primary); }
.toast.show { transform: translateX(0); }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast-icon { display: flex; align-items: center; justify-content: center; border-radius: 50%; width: 28px; height: 28px; color: white; flex-shrink: 0;}
.toast.success .toast-icon { background: var(--success); }
.toast.error .toast-icon { background: var(--danger); }
.toast-content { flex: 1; }
.toast-title { font-weight: 800; color: #1e293b; font-size: 0.95rem; margin-bottom: 4px; }
.toast-message { color: #64748b; font-size: 0.85rem; line-height: 1.4; }
.toast-close { background: none; border: none; color: #94a3b8; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; margin-top: 4px;}
.toast-close:hover { color: #1e293b; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ==========================================
   MOBILE PREMIUM (Smart Responsiveness)
============================================= */
@media (max-width: 768px) {
    .back-to-home {
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: max-content;
    }
    .btn-home-floating {
        padding: 10px 18px;
        font-size: 0.75rem;
        background: white;
    }
    body { padding-top: 80px; align-items: flex-start; }

    .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 0px; }
    .card-footer { flex-direction: column-reverse; gap: 20px; }
    .btn { width: 100%; }
}

@media (max-width: 480px) {
    body { padding: 80px 15px 20px 15px; }
    .auth-card { padding: 30px 20px; border-radius: 24px; }
    .brand { margin-bottom: 20px; }
    .header-titles h2 { font-size: 1.35rem; }
    .toast-container { left: 15px; right: 15px; bottom: 15px; }
    .toast { min-width: auto; width: 100%; max-width: 100%; }
}