/*
 * Identidade da area de login do APPGUARD -- painel institucional escuro a
 * esquerda, formulario branco a direita, roxo #8b5cf6 como cor de acao.
 *
 * Vivia embutido em App/Telas/login/index.php. Saiu para ca quando a tela de
 * dois fatores passou a usar o mesmo layout: duas copias do mesmo CSS viram
 * duas telas que divergem no primeiro ajuste. Consumido por:
 *   App/Telas/login/index.php, dois-fatores.php, cadastrar-mfa.php
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 50%, #c084fc 100%);
}

.login-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.institutional-side {
    flex: 1;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d1b4e 50%, #4c1d95 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    position: relative;
    overflow: hidden;
}

.institutional-content {
    width: 100%;
    max-width: 520px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.logo-container {
    position: relative;
    margin-bottom: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.institutional-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 50%;
    position: relative;
    z-index: 1;
}

.logo-container .logo-ring {
    width: 180px;
    height: 180px;
}

.institutional-title {
    font-size: 36px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 15px;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
    letter-spacing: 1px;
}

.institutional-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    margin-bottom: 40px;
}



@keyframes logoGlow {

    0%,
    100% {
        filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 20px rgba(139, 92, 246, 0.3));
    }

    50% {
        filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 30px rgba(168, 85, 247, 0.6));
    }
}

.logo-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: rotateRing 20s linear infinite;
}

@keyframes rotateRing {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
}

.stat-number {
    font-size: 32px;
    font-weight: 800;
    color: #8b5cf6;
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.stat-label {
    font-size: 14px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.feature-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border-left: 3px solid #8b5cf6;
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
}

.feature-item i {
    font-size: 20px;
    margin-right: 15px;
    color: #8b5cf6;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 10px;
}

.feature-text {
    font-size: 14px;
    color: #ffffff;
    font-weight: 500;
    line-height: 1.4;
}

/* Lado direito - Formulário de login */
.login-side {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    /* O `body` e 100vh com overflow hidden (o login cabe inteiro na tela). As
       telas do segundo fator nao cabem: o cadastro tem passos, QR, chave,
       campo e botao. Entao quem rola e este lado, mantendo a faixa
       institucional parada. */
    max-height: 100vh;
    overflow-y: auto;
}

.login-box {
    width: 100%;
    max-width: 450px;
    /* Centraliza na vertical SEM `justify-content: center` no pai. Com o pai
       rolando, o center corta o topo do conteudo e a parte cortada fica
       inacessivel -- nao da para rolar para tras dela. `margin: auto` no item
       centraliza quando sobra espaco e se comporta como flex-start quando
       falta. */
    margin: auto 0;
}

.client-logo {
    max-width: 200px;
    margin-bottom: 40px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    font-size: 16px;
}

.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.form-control-login {
    width: 100%;
    padding: 15px 20px;
    padding-left: 50px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-control-login:focus {
    outline: none;
    border-color: #8b5cf6;
    background: white;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

.input-icon {
    position: absolute;
    left: 18px;
    top: 42px;
    color: #999;
    font-size: 18px;
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 50%, #c084fc 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.forgot-password {
    text-align: center;
    margin-top: 20px;
}

.forgot-password a {
    color: #8b5cf6;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.forgot-password a:hover {
    color: #a855f7;
    text-decoration: underline;
}

.ip-info {
    margin-top: 30px;
    padding: 12px 20px;
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.ip-info i {
    color: #8b5cf6;
    margin-right: 8px;
}

.ip-info span {
    color: #666;
    font-size: 14px;
    font-weight: 600;
}

.alert {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-danger {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    text-align: center;
    font-weight: 600;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    text-align: center;
    font-weight: 600;
}

.sandbox-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #ffc107;
    color: #856404;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 10;
}

/* Modal de recuperação de senha */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.modal-header h3 {
    font-size: 24px;
    color: #333;
    margin-bottom: 10px;
}

.modal-header p {
    color: #666;
    font-size: 14px;
}

.btn-close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.btn-close-modal:hover {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary {
    background: #6c757d;
    margin-top: 10px;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Responsividade */
@media (max-width: 992px) {
    .login-container {
        flex-direction: column;
    }

    .institutional-side {
        padding: 30px 20px;
        min-height: 45vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .institutional-content {
        width: 100%;
        max-width: 100%;
    }

    .logo-container {
        margin-bottom: 30px;
        text-align: center;
    }

    .institutional-logo {
        max-width: 120px;
    }

    .logo-ring {
        width: 160px;
        height: 160px;
    }

    .institutional-title {
        font-size: 28px;
        margin-bottom: 15px;
    }

    .institutional-subtitle {
        font-size: 14px;
        margin-bottom: 30px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
        margin-top: 20px;
    }

    .stat-item {
        padding: 15px 10px;
    }

    .stat-number {
        font-size: 18px;
    }

    .stat-label {
        font-size: 12px;
    }

    .features-grid {
        display: none;
    }

    .login-side {
        padding: 30px 20px;
        min-height: 55vh;
        /* Aqui quem rola e a pagina inteira (o `body` abaixo), entao o lado do
           formulario nao pode ter scroll proprio -- dois scrolls aninhados
           deixam o usuario preso no de dentro. */
        max-height: none;
        overflow-y: visible;
    }

    body {
        overflow: auto;
    }
}

@media (max-width: 768px) {
    .institutional-side {
        display: none;
    }

    .login-side {
        flex: 1;
        min-height: 100vh;
        padding: 40px 30px;
        justify-content: center;
    }

    .login-box {
        max-width: 100%;
        width: 100%;
    }

    .client-logo {
        max-width: 180px;
        margin-bottom: 50px;
    }

    .login-header h2 {
        font-size: 32px;
        margin-bottom: 15px;
    }

    .login-header p {
        font-size: 18px;
        margin-bottom: 40px;
    }

    .form-control-login {
        padding: 18px 25px;
        padding-left: 55px;
        font-size: 18px;
    }

    .input-icon {
        font-size: 20px;
        top: 46px;
    }

    .btn-login {
        padding: 18px;
        font-size: 20px;
        margin-top: 15px;
    }

    .forgot-password a {
        font-size: 16px;
    }

    .ip-info {
        margin-top: 40px;
        padding: 15px 25px;
    }

    .ip-info span {
        font-size: 16px;
    }
}

@media (max-width: 576px) {
    .login-side {
        padding: 30px 20px;
    }

    .client-logo {
        max-width: 150px;
        margin-bottom: 40px;
    }

    .login-header h2 {
        font-size: 28px;
    }

    .login-header p {
        font-size: 16px;
        margin-bottom: 35px;
    }

    .form-control-login {
        padding: 16px 22px;
        padding-left: 50px;
        font-size: 16px;
    }

    .input-icon {
        font-size: 18px;
        top: 42px;
    }

    .btn-login {
        padding: 16px;
        font-size: 18px;
    }

    .forgot-password a {
        font-size: 15px;
    }

    .ip-info {
        margin-top: 35px;
        padding: 12px 20px;
    }

    .ip-info span {
        font-size: 15px;
    }
}