/*
 * Origen 2 - Corporate Login Styles (SSO)
 * Visual based on new_login mockup
 */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f2744 0%, #1a3a5c 50%, #2c5282 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.u-display-none {
    display: none !important;
}

.login-container {
    display: flex;
    width: 900px;
    max-width: 100%;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
    min-height: 480px;
    animation: fadeIn 0.6s ease-out;
}

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

/* Panel izquierdo - Branding */
.brand-panel {
    flex: 1;
    background: linear-gradient(160deg, #1a3a5c 0%, #0f2744 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 40px;
    color: #ffffff;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.brand-panel::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.brand-panel::after {
    content: '';
    position: absolute;
    bottom: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.logo {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, #2c5282 0%, #1a3a5c 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    margin-bottom: 24px;
    letter-spacing: 1px;
    position: relative;
    z-index: 1;
}

.brand-panel h1 {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

.brand-panel .subtitle {
    font-size: 15px;
    opacity: 0.75;
    margin: 0 0 30px 0;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

.divider-line {
    width: 50px;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.brand-panel .description {
    font-size: 13px;
    opacity: 0.6;
    line-height: 1.6;
    max-width: 260px;
    position: relative;
    z-index: 1;
}

.brand-footer {
    margin-top: auto;
    padding-top: 40px;
    font-size: 11px;
    opacity: 0.4;
    position: relative;
    z-index: 1;
}

/* Panel derecho - SSO */
.sso-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px;
    background: #ffffff;
}

.sso-content {
    width: 100%;
    max-width: 320px;
}

.sso-content h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1a3a5c;
    margin: 0 0 8px 0;
    text-align: center;
}

.sso-content .welcome-text {
    font-size: 14px;
    color: #718096;
    margin: 0 0 35px 0;
    text-align: center;
    line-height: 1.5;
}

.sso-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #1a3a5c 0%, #2c5282 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(26, 58, 92, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.sso-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 58, 92, 0.4);
}

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

.sso-btn:disabled {
    opacity: 0.85;
    pointer-events: none;
    cursor: not-allowed;
}

.sso-btn .microsoft-logo {
    flex-shrink: 0;
}

.sso-btn .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.sso-btn.loading .microsoft-logo,
.sso-btn.loading .sso-btn-text {
    display: none;
}

.sso-btn.loading .spinner {
    display: inline-block;
}

.sso-btn.loading::after {
    content: 'Redirigiendo...';
    font-size: 15px;
    font-weight: 600;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.separator {
    display: flex;
    align-items: center;
    margin: 28px 0;
    gap: 15px;
}

.separator-line {
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.separator-text {
    font-size: 12px;
    color: #a0aec0;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-box {
    background: #f7fafc;
    border-left: 4px solid #2c5282;
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 25px;
}

.info-box-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.info-icon {
    color: #2c5282;
    font-size: 16px;
    margin-top: 1px;
    flex-shrink: 0;
}

.info-box h4 {
    font-size: 12px;
    color: #4a5568;
    margin: 0 0 4px 0;
    font-weight: 600;
}

.info-box p {
    font-size: 12px;
    color: #718096;
    margin: 0;
    line-height: 1.5;
}

.help-link {
    text-align: center;
    margin: 0;
}

.help-link a {
    font-size: 13px;
    color: #2c5282;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.help-link a:hover {
    color: #1a3a5c;
    text-decoration: underline;
}

.version-footer {
    margin-top: auto;
    padding-top: 30px;
    text-align: center;
}

.version-footer p {
    font-size: 11px;
    color: #cbd5e0;
    margin: 0;
}

/* Alertas servidor / estado */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
}

.alert-icon {
    flex-shrink: 0;
}

.alert-success {
    background: #ecfdf5;
    border-left: 4px solid #059669;
    color: #065f46;
}

.alert-error {
    background: #fef2f2;
    border-left: 4px solid #dc2626;
    color: #991b1b;
}

.alert-info {
    background: #eff6ff;
    border-left: 4px solid #2c5282;
    color: #1e40af;
}

.alert-warning {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.system-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    background: #f7fafc;
    border-left: 4px solid #2c5282;
    color: #4a5568;
}

.system-message.info {
    background: #eff6ff;
    border-left-color: #2c5282;
    color: #1e40af;
}

.system-message.success {
    background: #ecfdf5;
    border-left-color: #059669;
    color: #065f46;
}

.system-message.error {
    background: #fef2f2;
    border-left-color: #dc2626;
    color: #991b1b;
}

.system-message.warning {
    background: #fffbeb;
    border-left-color: #f59e0b;
    color: #92400e;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 39, 68, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #2c5282;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 90%;
    width: 420px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 10px;
    background: #1a3a5c;
    color: #ffffff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.toast-message {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.toast-close:hover {
    color: #ffffff;
}

.toast-info {
    background: linear-gradient(135deg, #1a3a5c, #2c5282);
}

.toast-success {
    background: linear-gradient(135deg, #047857, #059669);
}

.toast-error {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
}

.toast-warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

/* Responsive */
@media (max-width: 768px) {
    .login-container {
        flex-direction: column;
        min-height: auto;
    }

    .brand-panel {
        padding: 35px 30px;
        min-height: 220px;
    }

    .brand-panel h1 {
        font-size: 26px;
    }

    .sso-panel {
        padding: 35px 30px;
    }

    .brand-footer {
        display: none;
    }

    .version-footer {
        margin-top: 20px;
    }
}
