/* ==================== AUTH MODALS - VERSIÓN OPTIMIZADA ==================== */
.auth-modal {
    --modal-border-radius: 18px;
    --modal-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.25);
    --modal-backdrop: rgba(0, 0, 0, 0.4);
    --input-height: 48px;
    --button-height: 48px;
}

.auth-modal .modal-dialog {
    max-width: 420px;
    margin: 0.5rem auto;
    padding: 0 1rem;
}

.auth-modal .modal-content {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--modal-border-radius);
    box-shadow: var(--modal-shadow);
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    max-height: 95vh;
    overflow-y: auto;
}

/* ==================== MODAL HEADER - MÁS COMPACTO ==================== */
.auth-modal .modal-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-light) 100%);
    padding: 1.25rem 1.5rem 0.75rem;
    border: none;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}

.auth-modal .modal-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at center,
        rgba(var(--accent-color-rgb), 0.03) 0%,
        transparent 70%
    );
    pointer-events: none;
}

.auth-modal .modal-icon {
    width: 44px;
    height: 44px;
    background: var(--accent-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    color: white;
    box-shadow: 0 3px 12px rgba(var(--accent-color-rgb), 0.25);
    position: relative;
    z-index: 2;
}

.auth-modal .modal-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.2rem 0;
    letter-spacing: -0.01em;
    position: relative;
    z-index: 2;
}

.auth-modal .modal-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
    opacity: 0.8;
    position: relative;
    z-index: 2;
}

.auth-modal .btn-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: all 0.3s ease;
    padding: 0;
    font-size: 1.1rem;
    color: var(--text-secondary);
    z-index: 3;
}

.auth-modal .btn-close:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: scale(1.05);
}

.auth-modal .btn-close::before {
    content: '×';
    font-size: 1.1rem;
    line-height: 1;
    font-weight: 300;
}

/* ==================== MODAL BODY - MÁS COMPACTO ==================== */
.auth-modal .modal-body {
    padding: 1.25rem 1.5rem 1.5rem;
    position: relative;
}

/* ==================== FORM STYLES - OPTIMIZADO PARA ALTURA ==================== */
.auth-form {
    max-width: 100%;
    margin: 0 auto;
}

.auth-form .form-group {
    margin-bottom: 1rem;
}

.auth-form .form-label {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    letter-spacing: -0.01em;
}

.auth-form .form-label i {
    color: var(--accent-color);
    font-size: 0.9rem;
    width: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-form .form-control {
    height: var(--input-height);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 0 1rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.auth-form .form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--accent-color-rgb), 0.15);
    background: var(--bg-light);
    outline: none;
}

.auth-form .form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* ==================== PASSWORD INPUT WRAPPER ==================== */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .form-control {
    padding-right: 2.8rem;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    z-index: 10;
}

.password-toggle:hover {
    color: var(--accent-color);
    background: rgba(var(--accent-color-rgb), 0.1);
}

.password-toggle i {
    font-size: 0.9rem;
}

/* ==================== FORM OPTIONS - MÁS COMPACTO ==================== */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.auth-form .form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.auth-form .form-check-input {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 3px;
    background: var(--bg-secondary);
    margin: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.auth-form .form-check-input:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.auth-form .form-check-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--accent-color-rgb), 0.15);
}

.auth-form .form-check-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1.4;
    user-select: none;
}

.forgot-link,
.terms-link {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.forgot-link:hover,
.terms-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* ==================== PASSWORD STRENGTH METER - MÁS COMPACTO ==================== */
.password-strength {
    margin-top: 0.4rem;
    margin-bottom: 1rem;
}

.strength-meter {
    height: 3px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.4rem;
    border: 1px solid var(--border-color);
}

.strength-bar {
    height: 100%;
    transition: all 0.4s ease;
    border-radius: 2px;
    background: #dc3545;
    width: 0%;
}

.strength-text {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin: 0;
    text-align: center;
}

/* ==================== FORM VALIDATION - COMPACTO ==================== */
.auth-form .form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

.auth-form .form-control.is-valid {
    border-color: #198754;
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.15);
}

.auth-form .invalid-feedback {
    display: none;
    font-size: 0.75rem;
    color: #dc3545;
    margin-top: 0.2rem;
    padding-left: 0.25rem;
}

.auth-form .form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

/* ==================== BUTTONS - MÁS COMPACTOS ==================== */
.btn-auth-submit {
    height: var(--button-height);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border: 2px solid var(--accent-color);
    background: var(--accent-color);
    color: white;
    width: 100%;
    margin-bottom: 1rem;
    box-shadow: 0 3px 10px rgba(var(--accent-color-rgb), 0.2);
}

.btn-auth-submit:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(var(--accent-color-rgb), 0.3);
}

.btn-auth-switch {
    height: var(--button-height);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    width: 100%;
}

.btn-auth-switch:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-1px);
}

.auth-form .btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ==================== DIVIDER - MÁS COMPACTO ==================== */
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1rem 0 0.75rem 0;
    color: var(--text-secondary);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    padding: 0 0.75rem;
    font-size: 0.8rem;
    background: var(--bg-light);
    font-weight: 500;
}

/* ==================== MODAL ANIMATIONS ==================== */
.auth-modal.fade .modal-dialog {
    transform: scale(0.9) translateY(-20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-modal.show .modal-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ==================== DARK THEME ADJUSTMENTS ==================== */
[data-theme="dark"] .auth-modal .modal-content {
    background: var(--bg-light);
    border-color: var(--border-color);
}

[data-theme="dark"] .auth-modal .modal-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-light) 100%);
}

[data-theme="dark"] .auth-form .form-control {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

[data-theme="dark"] .auth-form .form-control:focus {
    background: var(--bg-light);
}

[data-theme="dark"] .auth-divider span {
    background: var(--bg-light);
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 576px) {
    .auth-modal .modal-dialog {
        margin: 0.25rem;
        padding: 0;
    }
    
    .auth-modal .modal-header {
        padding: 1rem 1.25rem 0.5rem;
    }
    
    .auth-modal .modal-body {
        padding: 1rem 1.25rem 1.25rem;
    }
    
    .auth-modal .modal-title {
        font-size: 1.2rem;
    }
    
    .auth-modal .modal-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .auth-modal .btn-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 28px;
        height: 28px;
    }
    
    .form-options {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .auth-form .form-check {
        justify-content: center;
    }
    
    .forgot-link {
        text-align: center;
    }
    
    .auth-form .form-group {
        margin-bottom: 0.8rem;
    }
    
    .auth-form .form-control {
        height: 44px;
    }
    
    .btn-auth-submit,
    .btn-auth-switch {
        height: 44px;
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .auth-modal .modal-dialog {
        margin: 0.125rem;
    }
    
    .auth-modal .modal-header {
        padding: 0.75rem 1rem 0.5rem;
    }
    
    .auth-modal .modal-body {
        padding: 0.75rem 1rem 1rem;
    }
    
    .auth-modal .modal-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
}

/* ==================== LOADING STATES ==================== */
.auth-form .btn .spinner-border {
    width: 0.9rem;
    height: 0.9rem;
    border-width: 2px;
}

/* ==================== ACCESSIBILITY IMPROVEMENTS ==================== */
.auth-form .form-control:focus,
.auth-form .form-check-input:focus,
.password-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(var(--accent-color-rgb), 0.25);
}

.password-toggle:focus {
    background: rgba(var(--accent-color-rgb), 0.1);
}

/* ==================== UTILITY CLASSES ==================== */
.w-100 {
    width: 100% !important;
}

.me-2 {
    margin-right: 0.5rem !important;
}

.text-decoration-none {
    text-decoration: none !important;
}

.text-decoration-none:hover {
    text-decoration: underline !important;
}

/* ==================== OPTIMIZACIÓN ESPECÍFICA PARA MODAL DE REGISTRO ==================== */
/* Hacer el modal de registro más compacto */
#registerModal .modal-dialog {
    max-width: 400px;
}

#registerModal .modal-header {
    padding: 1rem 1.25rem 0.5rem;
}

#registerModal .modal-body {
    padding: 1rem 1.25rem 1.25rem;
}

#registerModal .form-group {
    margin-bottom: 0.8rem;
}

#registerModal .password-strength {
    margin-top: 0.3rem;
    margin-bottom: 0.8rem;
}

#registerModal .auth-divider {
    margin: 0.8rem 0 0.6rem 0;
}

/* Ajustar tamaños específicos para el modal de registro */
#registerModal .modal-title {
    font-size: 1.25rem;
}

#registerModal .modal-subtitle {
    font-size: 0.8rem;
}

#registerModal .modal-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}