:root {
    --primary: #586bfc;
    --primary-dark: #4555d6;
    --background: #f5f6f8;
    --text: #1a1a1a;
    --shadow: 0 8px 30px rgba(0,0,0,0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Montserrat", sans-serif!important;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    position: relative;
    overflow: hidden;
    padding: 20px;
}

/* Onda decorativa */
body::before {
    content: "";
    position: absolute;
    width: 150%;
    height: 60vh;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 100% 100% / 0 0 30% 30%;
    z-index: -1;
}

.login-container {
    background: white;
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 420px;
    animation: fadeIn 0.3s ease-out;
    position: relative;
    z-index: 2;
    aspect-ratio: 1/1.1;
    display: flex;
    flex-direction: column;
}

.logo-container {
    text-align: center;
    margin-bottom: 1.5rem;
}

.logo {
    width: 180px;
    height: auto;
    margin-bottom: 0.5rem;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.subtitle {
    color: #666;
    font-size: 0.875rem;
    text-align: center;
    max-width: 280px;
    margin: 0 auto 1rem;
    line-height: 1.5;
}

h1 {
    color: var(--text);
    font-size: 1.75rem;
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
}

h1::after {
    content: "";
    position: absolute;
    width: 40px;
    height: 3px;
    background: var(--primary);
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 3px;
}

.form-group {
    margin-bottom: 1.25rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    transition: all 0.2s ease;
}

.input-wrapper i {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 1.25rem;
    transition: color 0.2s ease;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--background);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.form-group input:focus + i {
    color: var(--primary);
}

.submit-btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-top: auto;
}

.submit-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: all 0.6s ease;
}

.submit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(88, 107, 252, 0.4);
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:active {
    transform: translateY(0);
}

.remember-group {
    display: flex;
    align-items: center;
    margin-bottom: 1.25rem;
    user-select: none;
}

.remember-group input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.remember-group label {
    position: relative;
    padding-left: 26px;
    cursor: pointer;
    font-size: 0.875rem;
    color: #666;
    display: flex;
    align-items: center;
    margin: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: var(--background);
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.remember-group:hover input ~ .checkmark {
    border-color: var(--primary);
}

.remember-group input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.remember-group input:checked ~ .checkmark:after {
    display: block;
}

.error-message {
    background-color: #fee2e2;
    border: 2px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: shake 0.5s ease;
}

.error-message i {
    font-size: 1.25rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Responsive */
@media (max-width: 768px) {
    .login-container {
        padding: 1.5rem;
        margin: 1rem;
        aspect-ratio: auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    body::before {
        height: 40vh;
    }

    h1 {
        font-size: 1.5rem;
    }

    .logo {
        width: 140px;
    }
}

/* Para pantallas muy pequeñas */
@media (max-width: 380px) {
    .login-container {
        padding: 1.25rem;
    }
    
    .form-group input {
        padding: 0.65rem 2.25rem 0.65rem 0.85rem;
    }
}

/* Enlace de política de privacidad */
.privacy-policy-link {
    width: 100%;
    display: block;
    text-align: center;
    position: fixed;
    bottom: 20px;
    left: 0;
    z-index: 10;
}

.privacy-policy-link a {
    color: #666;
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.2s ease;
    display: inline-block;
}

.privacy-policy-link a:hover {
    color: var(--primary);
    text-decoration: none;
}
