/* =============================================
    LOGIN.CSS - APP PERSONAL TRAINER
    ============================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    /* O "min-height: 100vh" no body é bom, mas vamos corrigir o overflow no mobile */
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    display: flex;
    max-width: 1000px;
    width: 100%;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

/* Login Box - Lado Esquerdo */
.login-box {
    flex: 1;
    padding: 50px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.logo i {
    font-size: 36px;
    color: #fff;
}

.login-header h1 {
    font-size: 28px;
    color: #1a1a2e;
    margin-bottom: 8px;
    font-weight: 700;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

/* Alertas */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

/* Formulário */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label i {
    color: #667eea;
    font-size: 14px;
}

.form-group input {
    padding: 15px 18px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
}

.form-group input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-group input::placeholder {
    color: #9ca3af;
}

/* Password Wrapper */
.password-wrapper {
    position: relative;
}

.password-wrapper input {
    width: 100%;
    padding-right: 50px;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 5px;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #667eea;
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #6b7280;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

.forgot-password {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Botão Login */
.btn-login {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

/* Login Footer */
.login-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #e5e7eb;
}

.login-footer p {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 15px;
}

.btn-register {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 25px;
    background: #f3f4f6;
    color: #374151;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-register:hover {
    background: #e5e7eb;
    color: #1a1a2e;
}

/* NOVO: Estilização para o link de Instalar App */
.btn-pwa-link {
    /* Mantém o estilo base do .btn-register, mas aplica as cores personalizadas */
    margin-top: 10px; 
    background-color: #667eea; 
    color: white; 
    border: 1px solid #667eea;
}

.btn-pwa-link:hover {
    /* Efeito de hover para o botão principal */
    background: #764ba2;
    color: white;
}


/* =============================================
    Decoração - Lado Direito
    ============================================= */
.login-decoration {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px;
    position: relative;
    overflow: hidden;
}

.login-decoration::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.decoration-content {
    position: relative;
    z-index: 1;
    color: #fff;
    text-align: center;
    max-width: 350px;
}

.decoration-content h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.3;
}

.decoration-content p {
    font-size: 15px;
    opacity: 0.9;
    line-height: 1.6;
    margin-bottom: 30px;
}

.features-list {
    list-style: none;
    text-align: left;
}

.features-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.features-list li:last-child {
    border-bottom: none;
}

.features-list li i {
    color: #a7f3d0;
    font-size: 16px;
}

/* =============================================
    Elementos Decorativos Flutuantes
    ============================================= */
.login-decoration::after {
    content: '';
    position: absolute;
    bottom: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

/* =============================================
    Responsividade
    ============================================= */
@media (max-width: 900px) {
    .login-container {
        flex-direction: column;
        max-width: 450px;
    }
    
    .login-decoration {
        padding: 40px 30px;
        order: -1;
    }
    
    .decoration-content h2 {
        font-size: 22px;
    }
    
    .features-list {
        display: none;
    }
    
    .decoration-content p {
        margin-bottom: 0;
    }
}

@media (max-width: 500px) {
    body {
        /* Permite que o conteúdo role no eixo Y se for maior que a tela do dispositivo, 
           resolvendo o problema de corte quando o teclado aparece, por exemplo. */
        min-height: auto; 
        align-items: flex-start; /* Alinha o conteúdo ao topo, não ao centro, no mobile */
        padding: 0; /* Remove padding externo no mobile para usar a tela toda */
    }
    
    .login-container {
        /* Garante que o container use 100% da largura do viewport */
        max-width: 100%;
        border-radius: 0; /* Opção: remover bordas arredondadas no mobile */
        /* Permite que o conteúdo role verticalmente dentro do container */
        overflow-y: auto; 
    }
    
    .login-box {
        padding: 35px 25px;
    }
    
    .login-header h1 {
        font-size: 24px;
    }
    
    .logo {
        width: 70px;
        height: 70px;
    }
    
    .logo i {
        font-size: 30px;
    }
    
    .form-group input {
        padding: 13px 15px;
        font-size: 14px;
    }
    
    .form-options {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .btn-login {
        padding: 14px;
        font-size: 15px;
    }
    
    .login-decoration {
        padding: 30px 20px;
        /* Opcional: Se quiser remover totalmente a decoração no mobile, descomente: */
        /* display: none; */
    }
    
    .decoration-content h2 {
        font-size: 20px;
    }
    
    .decoration-content p {
        font-size: 14px;
    }
}

/* =============================================
    Animações Extras
    ============================================= */
.login-box {
    animation: fadeInLeft 0.6s ease;
}

.login-decoration {
    animation: fadeInRight 0.6s ease;
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =============================================
    Loading State para o Botão
    ============================================= */
.btn-login.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-login.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =============================================
    Estados de Validação
    ============================================= */
.form-group input.error {
    border-color: #dc2626;
    background-color: #fef2f2;
}

.form-group input.success {
    border-color: #059669;
    background-color: #f0fdf4;
}

.form-group .error-message {
    color: #dc2626;
    font-size: 12px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* =============================================
    Tema Escuro (opcional)
    ============================================= */
@media (prefers-color-scheme: dark) {
    /* Descomente se quiser suporte a tema escuro automático */
    /*
    .login-box {
        background: #1f2937;
    }
    
    .login-header h1 {
        color: #fff;
    }
    
    .login-header p {
        color: #9ca3af;
    }
    
    .form-group label {
        color: #e5e7eb;
    }
    
    .form-group input {
        background: #374151;
        border-color: #4b5563;
        color: #fff;
    }
    
    .form-group input::placeholder {
        color: #6b7280;
    }
    
    .login-footer {
        border-top-color: #374151;
    }
    
    .login-footer p {
        color: #9ca3af;
    }
    
    .btn-register {
        background: #374151;
        color: #e5e7eb;
    }
    */
}