/* =========================================================
 * PERFIL — sidebar footer, modal perfil, 2FA, btn-ajustes
 * ========================================================= */

/* ── Fila en el sidebar footer (usuario + iconos de módulos) ── */
.sidebar-footer-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.sidebar-footer-row .user-info-btn {
    flex: 1;
    min-width: 0;
}

/* ── Botón clickable en el sidebar-footer ── */
.user-info-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: none;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    cursor: pointer;
    padding: 0.375rem 0.5rem;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
    color: inherit;
}
.user-info-btn:hover {
    background: var(--primary-light);
    border-color: #ffd5bc;
}
.user-info-btn .user-info {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

/* ── Overlay del modal de perfil ── */
.modal-perfil {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.15s ease;
}
.modal-perfil[hidden] {
    display: none;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Caja del modal ── */
.modal-perfil-box {
    background: var(--surface-color);
    border-radius: 0.875rem;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.18s ease;
}
@keyframes slideUp {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── Header del modal ── */
.modal-perfil-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.modal-perfil-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}
.modal-perfil-close {
    background: none;
    border: none;
    font-size: 1.125rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}
.modal-perfil-close:hover {
    background: #fee2e2;
    color: var(--danger-color);
}

/* ── Cuerpo scrollable ── */
.modal-perfil-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* ── Separadores de sección ── */
.perfil-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 1.25rem 0 0.75rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--border-color);
}
.perfil-section-title:first-child {
    margin-top: 0;
}
.perfil-optional {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.75rem;
}

/* ── Grid de campos ── */
.perfil-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
    gap: 0 1rem;
}
.perfil-row .form-group {
    margin-bottom: 1rem;
}
.perfil-group-email {
    grid-column: span 2;
}

.req {
    color: var(--primary-color);
}

.perfil-error {
    padding: 0.75rem 1rem;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    border-left: 3px solid var(--danger-color);
    margin-top: 0.5rem;
}

.perfil-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* ── Footer del modal ── */
.modal-perfil-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.form-inline { display: contents; }

/* =========================================================
 * 2FA — sección en el modal de perfil
 * ========================================================= */
.perfil-2fa-active {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}
.perfil-2fa-active-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}
.perfil-2fa-active-text {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 600;
    color: #065f46;
}
.perfil-2fa-active-text small {
    display: block;
    font-weight: 400;
    color: #047857;
    margin-top: 0.125rem;
}
.perfil-2fa-intro {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.perfil-2fa-steps {
    font-size: 0.875rem;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    line-height: 1.7;
}
.perfil-2fa-qr {
    display: flex;
    justify-content: center;
    margin: 0.75rem 0 1rem;
}
.perfil-2fa-qr canvas,
.perfil-2fa-qr img {
    border: 4px solid #ffffff;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
}
.perfil-2fa-secret-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    margin: 0.5rem 0 0.875rem;
}
.perfil-2fa-secret-code {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 1.0625rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-color);
    word-break: break-all;
}
.btn-copy-secret {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.8125rem;
    cursor: pointer;
    color: var(--text-muted);
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}
.btn-copy-secret:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.perfil-2fa-code-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1.5rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.25em;
    text-align: center;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.perfil-2fa-code-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(247, 89, 0, 0.1);
}
.perfil-2fa-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.perfil-2fa-error {
    padding: 0.625rem 0.875rem;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    border-left: 3px solid var(--danger-color);
    margin-bottom: 0.75rem;
}

/* =========================================================
 * SIDEBAR FOOTER ACTIONS
 * ========================================================= */

.sidebar-footer-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.sidebar-footer-actions .form-inline {
    flex: 1;
}

.sidebar-footer-actions .btn-logout {
    width: 100%;
}

.btn-ajustes {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-ajustes:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Hint de contraseña (usado en el panel Cuenta) */
.gu-password-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: var(--bg-color, #f9fafb);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

/* =========================================================
 * RESPONSIVE — perfil
 * ========================================================= */

@media (max-width: 500px) {
    .modal-perfil-box {
        max-height: 100vh;
        border-radius: 0.75rem 0.75rem 0 0;
        align-self: flex-end;
    }
    .modal-perfil {
        align-items: flex-end;
        padding: 0;
    }
}
