/**
 * Modal - Panel de Login
 * Panel centrado y elevado para acceso por OTP
 */

/* Overlay de fondo */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 2500;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Panel */
.modal {
    position: relative;
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--card-shadow-hover);
    padding: 40px;
    max-width: 420px;
    width: 90%;
    animation: slideUp 0.4s ease;
    border: 1px solid var(--border);
}

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

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

/* Botón Cerrar */
.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease, transform 0.3s ease;
}

.modal-close:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* Encabezado */
.modal-header {
    margin-bottom: 20px;
    text-align: center;
}

.modal-header h2 {
    margin: 0 0 8px 0;
    font-size: 28px;
    color: var(--text-primary);
    font-weight: 600;
}

.modal-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* Tabs */
.modal-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border);
}

.modal-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    position: relative;
}

.modal-tab:hover {
    color: var(--text-primary);
    background-color: var(--overlay-light);
}

.modal-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Contenido del Modal */
.modal-content {
    margin-bottom: 30px;
}

.modal-instructions {
    background-color: var(--bg-secondary);
    border-left: 3px solid var(--primary);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 25px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-instructions strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 8px;
}

.modal-instructions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-instructions li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.modal-instructions li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* Campo de formulario */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-opacity);
}

.form-group input::placeholder {
    color: var(--text-tertiary);
}

/* Botón */
.modal-button {
    padding: 12px 24px;
    background-color: var(--primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    letter-spacing: 0.5px;
}

.modal-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.modal-button:active {
    transform: translateY(0);
}

.modal-button:disabled {
    background-color: var(--text-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Enlace secundario */
.modal-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.modal-footer p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.modal-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.modal-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Estados */
.modal-success {
    text-align: center;
    padding: 20px;
}

.modal-success-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.modal-success h3 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
    font-size: 20px;
}

.modal-success p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.modal-error {
    padding: 14px 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--error);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    margin-bottom: 15px;
    display: none;
    line-height: 1.6;
}

.modal-error.show {
    display: block;
    animation: slideDown 0.3s ease;
}

.modal-error strong {
    color: var(--text-primary);
    font-weight: 700;
}

.modal-error p {
    margin: 8px 0;
    color: var(--text-primary);
}

.modal-error p:first-child {
    margin-top: 0;
}

.modal-error button {
    background-color: var(--primary);
    color: var(--bg-primary);
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: background-color 0.3s ease;
    width: 100%;
    margin-top: 12px;
}

.modal-error button:hover {
    opacity: 0.85;
}

.modal-error button:active {
    transform: scale(0.98);
}

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

/* Loader */
.modal-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-loading.show {
    display: flex;
}

.loader {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--primary);
    animation: pulse-loader 1.4s infinite;
}

.loader:nth-child(1) {
    animation-delay: 0s;
}

.loader:nth-child(2) {
    animation-delay: 0.2s;
}

.loader:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse-loader {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .modal {
        padding: 30px 25px;
        max-width: 100%;
        margin: 20px;
    }

    .modal-header h2 {
        font-size: 24px;
    }

    .modal-close {
        top: 15px;
        right: 15px;
    }
}

@media (max-width: 576px) {
    .modal {
        padding: 25px 20px;
        border-radius: 12px;
    }

    .modal-header h2 {
        font-size: 22px;
    }

    .modal-header p {
        font-size: 13px;
    }

