* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 380px;
    padding: 28px;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 20px;
}

.login-header h1 {
    color: #2c3e50;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.login-header p {
    color: #7f8c8d;
    font-size: 12px;
    margin-top: 2px;
}

.login-icon {
    width: 100px;
    height: 100px;
    background: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    padding: 0;
    transition: all 0.3s ease;
}

.login-icon:hover {
    transform: translateY(-3px) scale(1.05);
}

.login-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
    transition: all 0.3s ease;
}

.login-icon:hover img {
    filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.2));
}

.form-group {
    margin-bottom: 14px;
    position: relative;
    animation: slideInUp 0.5s ease-out backwards;
}

.form-group:nth-child(1) {
    animation-delay: 0.1s;
}

.form-group:nth-child(2) {
    animation-delay: 0.2s;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group label {
    display: block;
    color: #2d3748;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.85;
    transition: all 0.3s ease;
}

.form-group:focus-within label {
    color: #667eea;
    opacity: 1;
}

.form-group .input-icon {
    position: relative;
    display: block;
}

.form-group .input-icon::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50px;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

.form-group .input-icon:focus-within::after {
    transform: scaleX(1);
}

.form-group .input-icon input.form-control-lg {
    width: 100%;
    padding: 11px 16px 11px 50px;
    border: none;
    border-bottom: 2px solid #e2e8f0;
    border-radius: 0;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.95));
    backdrop-filter: blur(10px);
    color: #1a202c;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-group .input-icon input.form-control-lg:hover {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.98));
    border-bottom-color: #cbd5e0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.08);
}

.form-group .input-icon input.form-control-lg:focus {
    outline: none;
    border-bottom-color: transparent;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 1));
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15), 0 0 0 1px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
    padding-top: 13px;
    padding-bottom: 11px;
}

.form-group .input-icon input.form-control-lg::placeholder {
    color: #a0aec0;
    font-weight: 400;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.form-group .input-icon input.form-control-lg:focus::placeholder {
    opacity: 0.4;
}

.error-message {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-message::before {
    content: "⚠";
    font-size: 18px;
}

.btn-login {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    margin-top: 4px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-recovery {
    text-align: center;
    margin-top: 16px;
    margin-bottom: 0;
}

.login-recovery .emergency-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    font-size: 12px;
    display: inline-block;
    transition: all 0.2s ease;
}

.login-recovery .emergency-link:hover {
    text-decoration: underline;
    color: #764ba2;
    transform: translateY(-1px);
}

.login-footer {
    text-align: center;
    margin-top: 8px;
    padding-top: 0;
    border-top: none;
}

.login-footer p {
    margin: 0;
    color: #7f8c8d;
    font-size: 11px;
    line-height: 1.3;
}

.login-footer .footer-copyright {
    margin-bottom: 2px;
    font-size: 12px;
    color: #6b7280;
}

.login-footer .footer-security {
    margin-bottom: 0;
    font-size: 10px;
    color: #9ca3af;
}

@media (max-width: 480px) {
    .login-container {
        padding: 30px 25px;
    }
    
    .login-header h1 {
        font-size: 24px;
    }
}

.input-icon::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.5;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.2));
}

.form-group .input-icon:hover::before {
    opacity: 0.75;
    transform: translateY(-50%) scale(1.05);
}

.form-group .input-icon:focus-within::before {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
    filter: drop-shadow(0 4px 8px rgba(102, 126, 234, 0.4));
}

.input-icon.user::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
}

.input-icon.lock::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
}


/* Modal de emergencia - Diseño moderno */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1000;
    animation: fadeInBackdrop 0.3s ease-out;
}

@keyframes fadeInBackdrop {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-backdrop.active { 
    display: flex;
}

.modal-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    max-width: 560px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.5);
    overflow: hidden;
    transform: scale(0.9);
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.modal-header h3 { 
    margin: 0; 
    color: #1a202c; 
    font-size: 18px; 
    font-weight: 700;
    letter-spacing: -0.3px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #718096;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transform: rotate(90deg);
}

.modal-close:active {
    transform: rotate(90deg) scale(0.9);
}

.modal-body { 
    padding: 18px 20px; 
    background: rgba(255, 255, 255, 0.5);
}

.modal-actions { 
    display: flex; 
    gap: 10px; 
    justify-content: flex-end; 
    padding: 16px 20px; 
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.8) 0%, rgba(255, 255, 255, 0.9) 100%);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
}

.btn-secondary { 
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
    color: #2d3748; 
    border: none; 
    padding: 9px 18px; 
    border-radius: 10px; 
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #cbd5e0 0%, #a0aec0 100%);
}

.btn-primary { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff; 
    border: none; 
    padding: 9px 20px; 
    border-radius: 10px; 
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.modal-body .form-label {
    font-size: 11px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.modal-body .form-control {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.9);
}

.modal-body .form-control:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.modal-body textarea.form-control { 
    min-height: 90px; 
    resize: vertical; 
    font-family: inherit;
}

.modal-body .row.g-3 {
    --bs-gutter-y: 0.75rem;
}

/* ============================================
   VALIDACIÓN DE DNI EN TIEMPO REAL (EMERGENCIA)
   ============================================ */
.modal-body .form-control.border-danger {
    border-color: #ef4444 !important;
    border-width: 2px !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.modal-body .form-control.border-success {
    border-color: #10b981 !important;
    border-width: 2px !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

.invalid-feedback-dni {
    display: block;
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

.invalid-feedback-dni.success {
    color: #10b981;
}

/* Estilos para el modal de recuperación de contraseña */
.modal-body .text-center {
    margin-bottom: 20px;
}

.modal-body .text-center i {
    display: block;
    margin-bottom: 12px;
}

.modal-body .text-center p {
    line-height: 1.6;
    max-width: 100%;
}

.modal-header i {
    font-size: 20px;
    vertical-align: middle;
}

