/* ========================================
   LOGIN - Diseño moderno en dos paneles
   ======================================== */

:root {
    --color-primary: #0d9488;
    --color-primary-dark: #0f766e;
    --color-primary-light: #14b8a6;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-danger: #dc2626;
    --color-success: #16a34a;
    --color-warning: #d97706;
    --shadow-lg: 0 25px 50px -12px rgba(15, 23, 42, 0.18);
    --radius: 16px;
}

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

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.login-body {
    min-height: 100vh;
    background: #f1f5f9;
}

.login-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Panel izquierdo - marca */
.login-brand {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: linear-gradient(145deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, var(--color-primary-light) 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    top: -120px;
    right: -80px;
}

.login-brand::after {
    content: '';
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    bottom: -60px;
    left: -40px;
}

.login-brand-content {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 24px;
    backdrop-filter: blur(4px);
}

.login-brand h1 {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 12px;
}

.login-brand > .login-brand-content > p {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 32px;
}

.login-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    opacity: 0.95;
}

.login-features i {
    font-size: 1rem;
    opacity: 0.85;
}

/* Panel derecho - formulario */
.login-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    border: 1px solid var(--color-border);
}

.login-header {
    margin-bottom: 28px;
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
}

.login-header p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.login-alerts {
    margin-bottom: 20px;
    min-height: 0;
}

.login-alerts:empty {
    display: none;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text);
    margin-bottom: 8px;
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 2;
}

.login-form .form-control {
    width: 100%;
    padding: 12px 44px;
    font-size: 0.95rem;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    background: #f8fafc;
    color: var(--color-text);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-form .form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.login-form .form-control.is-invalid {
    border-color: var(--color-danger);
    background: #fef2f2;
}

.login-form .form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.btn-toggle-password {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.btn-toggle-password:hover {
    color: var(--color-primary);
    background: rgba(13, 148, 136, 0.08);
}

.login-form .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.login-form .form-check-input {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--color-border);
    cursor: pointer;
}

.login-form .form-check-input:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.login-form .form-check-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
}

.btn-login {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary));
    border: none;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
}

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

.btn-login:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

.btn-login .btn-spinner {
    display: none;
}

.btn-login.is-loading .btn-text {
    visibility: hidden;
}

.btn-login.is-loading .btn-spinner {
    display: block;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.login-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.login-footer small {
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

/* Alertas */
.login-alerts .alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: none;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.9rem;
    margin: 0;
}

.login-alerts .alert i {
    margin-top: 2px;
    flex-shrink: 0;
}

.login-alerts .alert-success {
    background: #dcfce7;
    color: #166534;
}

.login-alerts .alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.login-alerts .alert-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Responsive */
@media (max-width: 900px) {
    .login-wrapper {
        flex-direction: column;
    }

    .login-brand {
        padding: 36px 28px;
        min-height: auto;
    }

    .login-brand h1 {
        font-size: 1.4rem;
    }

    .login-features {
        display: none;
    }

    .login-panel {
        padding: 24px 16px 40px;
    }

    .login-box {
        padding: 32px 24px;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
    }
}

@media (max-width: 480px) {
    .login-brand {
        padding: 28px 20px;
    }

    .login-logo {
        width: 56px;
        height: 56px;
        font-size: 26px;
        margin-bottom: 16px;
    }

    .login-header h2 {
        font-size: 1.3rem;
    }
}
