/* ==========================================================================
   TELA E MODAL DE AUTENTICAÇÃO (LOGIN / CADASTRO / RESET)
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, #f8fafc 0%, #e2e8f0 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background-color: #ffffff;
    width: 100%;
    max-width: 440px;
    border-radius: 16px;
    box-shadow: 0 12px 40px -6px rgba(11, 57, 106, 0.16), 0 0 0 1px rgba(11, 57, 106, 0.05);
    padding: 36px 36px;
    animation: fadeInScale 0.25s ease-out;
    margin: auto;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ==========================================================================
   BLOCO DE MARCA INSTITUCIONAL 
   ========================================================================== */
.modal-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1.5px solid #e2e8f0;
}

.modal-logo-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
    background: transparent;
}

.modal-brand .login-logo {
    width: 100%;
    max-width: 340px;
    height: auto;
    max-height: 135px;
    object-fit: contain;
    display: block;
}

.login-secretaria-title {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
    display: block;
    text-align: center;
}

.login-system-title {
    font-size: 24px;
    font-weight: 800;
    color: #0b396a;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
}

.login-system-badge {
    font-size: 11px;
    font-weight: 700;
    background-color: #1f7a3f;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* CONTROLE DE ABAS (ENTRAR / CADASTRAR) */
.tab-header {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 24px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    padding: 12px 10px;
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: #0b396a;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #0b396a;
}

.tab-btn.active {
    color: #0b396a;
    border-bottom-color: #0b396a;
}

/* ALERTAS E NOTIFICAÇÕES DE LOGIN */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
    line-height: 1.4;
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* CAMPOS DE FORMULÁRIO E INPUTS */
.modal-content .form-group {
    margin-bottom: 18px;
}

.modal-content label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.modal-content input[type="email"],
.modal-content input[type="password"],
.modal-content input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background-color: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.modal-content input:focus {
    outline: none;
    border-color: #0b396a;
    box-shadow: 0 0 0 3px rgba(11, 57, 106, 0.12);
}

/* ESTILIZAÇÃO DO SELECT DE ESCOLA / INSTITUIÇÃO */
.modal-content select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    color: #1e293b;
    background-color: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%230b396a' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 38px;
    cursor: pointer;
}

.modal-content select:focus {
    outline: none;
    border-color: #0b396a;
    box-shadow: 0 0 0 3px rgba(11, 57, 106, 0.12);
}

/* SELEÇÃO MÚLTIPLA DE ESCOLAS NO CADASTRO */
.escola-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.escola-input-group select {
    flex: 1;
}

.btn-add-escola {
    background-color: #0b396a;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-add-escola:hover {
    background-color: #08284d;
}

.btn-add-escola:active {
    transform: scale(0.98);
}

.container-escolas-selecionadas {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    min-height: 28px;
}

.badge-escola {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    padding: 5px 10px;
    border-radius: 16px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    animation: fadeInBadge 0.2s ease;
}

@keyframes fadeInBadge {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.badge-escola-remove {
    background: transparent;
    border: none;
    color: #0369a1;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    padding: 0 3px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
}

.badge-escola-remove:hover {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.15);
}

.form-hint {
    display: block;
    font-size: 11.5px;
    color: #64748b;
    margin-top: 6px;
    line-height: 1.35;
}

/* CONTAINER DE SENHA COM ÍCONE DENTRO DO INPUT */
.password-field {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-field input {
    padding-right: 44px !important;
}

.btn-toggle-pass {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    outline: none;
    transition: background-color 0.2s ease;
}

.btn-toggle-pass:hover {
    background-color: #f1f5f9;
}

.btn-toggle-pass svg {
    stroke: #64748b;
    transition: stroke 0.2s ease;
}

.btn-toggle-pass:hover svg {
    stroke: #0b396a;
}

.btn-toggle-pass svg.hidden {
    display: none !important;
}

/* LINKS E BOTÕES DE AÇÃO */
.form-actions-link {
    text-align: right;
    margin-top: -6px;
    margin-bottom: 20px;
}

.forgot-pass-link {
    font-size: 13px;
    color: #0b396a;
    text-decoration: none;
    font-weight: 600;
}

.forgot-pass-link:hover {
    color: #154c86;
    text-decoration: underline;
}

.modal-content .btn-primary {
    width: 100%;
    padding: 13px;
    background-color: #0b396a;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(11, 57, 106, 0.25);
    transition: all 0.2s ease;
}

.modal-content .btn-primary:hover {
    background-color: #082b52;
    box-shadow: 0 4px 12px rgba(11, 57, 106, 0.35);
    transform: translateY(-1px);
}

.modal-content .btn-primary:disabled {
    background-color: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.btn-link-back {
    display: block;
    width: 100%;
    text-align: center;
    background: none;
    border: none;
    color: #64748b;
    font-size: 14px;
    margin-top: 14px;
    cursor: pointer;
    padding: 8px;
    font-weight: 500;
}

.btn-link-back:hover {
    color: #0b396a;
    text-decoration: underline;
}

/* ==========================================================================
   OTIMIZAÇÕES RESPONSIVAS PARA CELULAR (LOGIN / CADASTRO)
   ========================================================================== */
@media (max-width: 480px) {
    .modal-overlay {
        padding: 12px;
        align-items: flex-start;
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .modal-content {
        padding: 24px 18px;
        border-radius: 14px;
        max-width: 100%;
        box-shadow: 0 8px 30px rgba(11, 57, 106, 0.12);
    }

    .modal-brand .login-logo {
        max-width: 260px;
        max-height: 95px;
    }

    .login-system-title {
        font-size: 21px;
    }

    .tab-header {
        margin-bottom: 20px;
        gap: 6px;
    }

    .tab-btn {
        padding: 11px 12px;
        font-size: 14px;
    }

    .input-wrapper input {
        font-size: 16px !important; /* Previne auto-zoom no iOS Safari */
        padding: 12px 42px 12px 14px;
    }

    .modal-content .btn-primary {
        padding: 14px;
        font-size: 16px;
        min-height: 48px;
    }

    .btn-toggle-pass {
        width: 42px;
        height: 42px;
    }
}
