/* ============================================
   PANEL DE LOGIN - ESTILOS PRINCIPALES
   ============================================ */

* {
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --dark-bg: #1f2937;
    --darker-bg: #111827;
    --light-gray: #f3f4f6;
    --border-color: #e5e7eb;
    --text-primary: #1f2937;
    --text-muted: #6b7280;
}

body.login-page {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
}

/* ============================================
   WRAPPER PRINCIPAL
   ============================================ */

.login-wrapper {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* ============================================
   SIDEBAR IZQUIERDO - INFORMACIÓN DE MARCA
   ============================================ */

.login-sidebar {
    flex: 1;
    background: linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
    color: white;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.login-sidebar::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.login-sidebar > * {
    position: relative;
    z-index: 2;
}

/* Brand Section */
.brand-section {
    text-align: center;
    margin-bottom: 3rem;
}

.brand-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.brand-name {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    letter-spacing: -1px;
}

.brand-tagline {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

/* Features Section */
.features-section {
    flex: 1;
}

.features-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.features-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.features-list li {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    opacity: 0.9;
    transition: all 0.3s ease;
}

.features-list li:hover {
    opacity: 1;
    transform: translateX(10px);
}

.features-list i {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 6px;
    margin-right: 1rem;
    color: var(--primary-color);
    font-size: 1rem;
}

.features-list span {
    font-size: 0.95rem;
}

/* Footer Section */
.footer-section {
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
}

.version-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.5rem;
}

.copyright-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
}

/* ============================================
   FORMULARIO DE LOGIN
   ============================================ */

.login-form-wrapper {
    flex: 1;
    background: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
}

.login-form-container {
    width: 100%;
    max-width: 450px;
    background: white;
    border-radius: 16px;
    padding: 3rem 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Login Header */
.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

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

/* Alertas */
.alert {
    border: none;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    animation: slideDown 0.3s ease-out;
}

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

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert-danger i {
    margin-right: 0.5rem;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
    border-left: 4px solid var(--secondary-color);
}

.alert-success i {
    margin-right: 0.5rem;
}

.btn-close {
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-close:hover {
    opacity: 1;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: block;
}

.form-label i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.login-input {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background-color: var(--light-gray);
}

.login-input:focus {
    background-color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.login-input::placeholder {
    color: #d1d5db;
}

.password-group {
    border-radius: 8px;
    overflow: hidden;
    border: none;
}

.password-group .login-input {
    border: 2px solid var(--border-color);
    border-radius: 8px 0 0 8px;
}

.password-group .toggle-password {
    border: 2px solid var(--border-color);
    border-left: none;
    border-radius: 0 8px 8px 0;
    background-color: var(--light-gray);
    transition: all 0.3s ease;
}

.password-group .toggle-password:focus {
    box-shadow: none;
    outline: none;
}

.password-group .toggle-password:hover {
    background-color: white;
    border-color: var(--primary-color);
}

.login-input:focus + .toggle-password {
    border-color: var(--primary-color);
    background-color: white;
}

/* Links en formulario */
.forgot-password-link {
    font-size: 0.85rem;
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s;
}

.forgot-password-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Remember Me */
.remember-me-section .form-check-input {
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.remember-me-section .form-check-label {
    cursor: pointer;
    color: var(--text-muted);
    margin-left: 0.5rem;
    user-select: none;
    transition: color 0.2s;
}

.remember-me-section .form-check-input:checked ~ .form-check-label {
    color: var(--text-primary);
}

/* Login Button */
.btn-login {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-login:hover {
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

.btn-login:hover::before {
    width: 300px;
    height: 300px;
}

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

.btn-login:disabled {
    background: #9ca3af;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-login i {
    margin-right: 0.5rem;
}

/* Divider */
.divider {
    position: relative;
    text-align: center;
    margin: 1.5rem 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    background: white;
    padding: 0 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    position: relative;
}

/* SSO Options */
.sso-options {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn-sso {
    flex: 1;
    padding: 0.65rem;
    font-size: 0.85rem;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.btn-sso:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: rgba(59, 130, 246, 0.05);
}

.btn-sso i {
    margin-right: 0.5rem;
}

/* Login Footer */
.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    margin: 0;
}

.support-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s;
}

.support-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    border-radius: 16px;
}

.loading-spinner .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
}

.loading-spinner p {
    color: white;
    margin-top: 1rem;
    font-weight: 500;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .login-sidebar {
        display: none;
    }

    .login-form-wrapper {
        flex: 1;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    .login-form-container {
        background: white;
    }
}

@media (max-width: 768px) {
    .login-form-container {
        max-width: 100%;
        margin: 1rem;
        padding: 2rem 1.5rem;
    }

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

    .form-label {
        font-size: 0.9rem;
    }

    .login-input {
        padding: 0.65rem 0.85rem;
        font-size: 0.9rem;
    }

    .btn-login {
        padding: 0.65rem 1.25rem;
        font-size: 0.95rem;
    }

    .sso-options {
        flex-direction: column;
    }

    .btn-sso {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .login-wrapper {
        flex-direction: column;
    }

    .login-form-wrapper {
        padding: 1rem;
    }

    .login-form-container {
        margin: 0;
        padding: 1.5rem 1rem;
        border-radius: 12px;
    }

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

    .login-header p {
        font-size: 0.9rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .alert {
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .divider {
        margin: 1rem 0;
    }

    .divider span {
        padding: 0 0.75rem;
        font-size: 0.8rem;
    }
}

/* ============================================
   MODO OSCURO (FUTURO)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .login-form-wrapper {
        background: #0f172a;
    }

    .login-form-container {
        background: #1f2937;
        color: white;
    }

    .login-header h2,
    .form-label {
        color: white;
    }

    .login-input {
        background-color: #374151;
        border-color: #4b5563;
        color: white;
    }

    .login-input:focus {
        background-color: #4b5563;
    }

    .login-input::placeholder {
        color: #9ca3af;
    }
}

/* ============================================
   ANIMACIONES Y TRANSICIONES
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Efectos de validación */
.form-control.is-invalid {
    border-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.05);
}

.form-control.is-valid {
    border-color: var(--secondary-color);
    background: rgba(16, 185, 129, 0.05);
}

/* Print Styles */
@media print {
    .login-wrapper {
        display: none;
    }
}
