:root {
    --primary-color: #e91e63;
    --primary-hover: #c2185b;
    --accent-color: #c2185b;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --error-color: #ef4444;
    --error-bg: #fee2e2;
    --success-color: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    background: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
}

/* Split Screen Layout for Login */
.login-split {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.login-left {
    flex: 1;
    background: linear-gradient(rgba(15, 23, 42, 0.75), rgba(15, 23, 42, 0.85)), url('../img/login_bg.jpg') center/cover no-repeat;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    padding: 3rem;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 60%);
    top: -25%;
    left: -25%;
    animation: pulse 15s infinite alternate;
    pointer-events: none;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

.login-left-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 500px;
}

.login-left h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
    line-height: 1.2;
    background: linear-gradient(135deg, #ff6090 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.login-left p {
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.6;
}

.login-right {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--surface-color);
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 2rem;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo-area {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-img {
    max-width: 180px;
    height: auto;
}

.sistema-tag {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 1rem;
}

/* Modal Error */
.modal-error {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--error-bg);
    border-left: 4px solid var(--error-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-error-icon {
    font-size: 1.2rem;
    color: var(--error-color);
}

.modal-error-text {
    flex: 1;
    color: #991b1b;
    font-size: 0.9rem;
    font-weight: 500;
}

.modal-error-close {
    background: none;
    border: none;
    color: #991b1b;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.7;
    transition: 0.2s;
}

.modal-error-close:hover { opacity: 1; }

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
}

.form-input {
    width: 100%;
    padding: 1rem 1rem 1rem 2.8rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    color: var(--text-main);
    background: #f8fafc;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.form-select {
    cursor: pointer;
    padding-right: 2.5rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.1rem;
    transition: 0.3s;
    pointer-events: none;
}

.form-input:focus + .input-icon {
    color: var(--primary-color);
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.1rem;
    transition: 0.3s;
}

.password-toggle:hover {
    color: var(--primary-color);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
}

.remember-me input {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.forgot-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.forgot-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.btn-login {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-login:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}

.institucion-locked {
    background: #f1f5f9 !important;
    color: #64748b !important;
    font-weight: 600;
    cursor: not-allowed;
    padding-left: 2.8rem;
    padding-right: 1rem;
}

/* Recovery Overlay & Modals */
.rec-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(15,23,42,0.7);z-index:9999;justify-content:center;align-items:center;backdrop-filter:blur(8px);opacity:0;transition:opacity .3s}
.rec-overlay.show{display:flex;opacity:1}
.rec-card{background:var(--surface-color);padding:2.5rem 2.5rem;border-radius:20px;box-shadow:0 25px 50px -12px rgba(0,0,0,0.25);width:90%;max-width:440px;position:relative;text-align:center;transform:translateY(-20px);transition:transform .3s}
.rec-overlay.show .rec-card{transform:translateY(0)}
.rec-close{position:absolute;top:15px;right:20px;background:none;border:none;font-size:1.5rem;color:var(--text-muted);cursor:pointer;transition: 0.2s;}
.rec-close:hover{color:var(--error-color);}
.rec-card h3{color:var(--text-main);margin:0 0 .5rem;font-size:1.5rem;font-weight:800}
.rec-card p{color:var(--text-muted);font-size:0.95rem;margin-bottom:1.5rem;line-height:1.5}
.rec-input{width:100%;padding:1rem;border:2px solid var(--border-color);border-radius:10px;font-size:1rem;outline:none;transition:.2s;margin-bottom:1.5rem;text-align:center;font-weight:600;font-family:inherit;}
.rec-input:focus{border-color:var(--primary-color);box-shadow:0 0 0 3px rgba(79, 70, 229, 0.1)}
.rec-option{border:2px solid var(--border-color);border-radius:10px;padding:1rem;margin-bottom:1rem;display:flex;align-items:center;gap:15px;cursor:pointer;text-align:left;background:#f8fafc;transition:0.2s;}
.rec-option:hover{border-color:var(--primary-color);background:white}
.rec-option.disabled{opacity:0.5;cursor:not-allowed;pointer-events:none}
.rec-option input{accent-color:var(--primary-color);width:18px;height:18px}
.rec-opt-title{display:block;font-weight:700;color:var(--text-main);font-size:0.95rem}
.rec-opt-desc{display:block;color:var(--text-muted);font-size:0.8rem;margin-top:3px}
.rec-btn{background:var(--primary-color);color:white;border:none;padding:1rem;width:100%;border-radius:10px;font-size:1rem;font-weight:700;cursor:pointer;transition:.2s;display:flex;justify-content:center;align-items:center;gap:8px;box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);}
.rec-btn:hover{background:var(--primary-hover);transform:translateY(-2px);box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);}
.rec-btn:disabled{background:#94a3b8;cursor:not-allowed;transform:none;box-shadow:none}
.rec-error{color:var(--error-color);font-size:0.85rem;font-weight:600;margin-top:1rem;display:none;background:var(--error-bg);padding:10px;border-radius:8px;text-align:center}
.rec-back{display:inline-block;background:none;border:none;color:var(--primary-color);font-weight:600;font-size:0.9rem;cursor:pointer;margin-top:1.5rem;transition:0.2s;}
.rec-back:hover{text-decoration:underline;color:var(--primary-hover);}
.rec-debug{display:none;margin-top:1rem;text-align:left}
.rec-debug-box{background:#1e293b;color:#e2e8f0;border-radius:8px;padding:1rem;font-family:'Courier New',monospace;font-size:0.8rem;max-height:300px;overflow:auto}
.rec-debug-box strong{color:#fbbf24}

/* Responsive */
@media (max-width: 1100px) {
    .login-left {
        display: none;
    }
    .login-right {
        padding: 1rem;
        background: var(--bg-color);
    }
    .login-card {
        background: white;
        border-radius: 16px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.05);
        padding: 2.5rem 1.5rem;
    }
}

/* Additional Mobile Global Adjustments */
@media (max-width: 768px) {
    .login-split {
        flex-direction: column;
    }
    .login-left {
        display: none; /* Already hidden in 900px query, ensuring here */
    }
    .login-right {
        padding: 15px;
    }
    .login-card {
        padding: 20px;
    }
    .modal-content {
        padding: 20px;
        width: 95%;
        margin: 10px auto;
    }
    .form-group {
        margin-bottom: 1rem;
    }
}
