/* --------------------------------------------------------------------------
   14. MODALES MATERIAL DESIGN
   -------------------------------------------------------------------------- */
/* Botón cerrar modal / alert / offcanvas con alto contraste */
.btn-close,
.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.75;
    transition: var(--transition);
}

.btn-close:hover,
.btn-close-white:hover {
    opacity: 1;
    transform: rotate(90deg);
}

[data-theme="light"] .btn-close,
[data-theme="light"] .btn-close-white {
    filter: none;
    opacity: 0.55;
}

[data-theme="light"] .btn-close:hover,
[data-theme="light"] .btn-close-white:hover {
    opacity: 0.85;
}

/* --------------------------------------------------------------------------
   15. MENÚS DESPLEGABLES (DROPDOWNS)
   -------------------------------------------------------------------------- */
.dropdown-menu {
    background-color: var(--mdb-surface) !important;
    border: 1px solid var(--mdb-border) !important;
    border-radius: var(--mdb-radius);
    box-shadow: var(--mdb-shadow-3) !important;
    padding: var(--space-2) 0;
    color: var(--mdb-text-primary) !important;
}

.dropdown-item {
    color: var(--mdb-text-primary) !important;
    padding: 0.55rem 1.15rem;
    font-size: 0.875rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--mdb-surface-hover) !important;
    color: var(--mdb-text-primary) !important;
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--mdb-primary) !important;
    color: #ffffff !important;
}

.dropdown-divider {
    border-top: 1px solid var(--mdb-border) !important;
    opacity: 1;
    margin: var(--space-2) 0;
}

/* --------------------------------------------------------------------------
   16. ALERTAS MATERIAL DESIGN
   -------------------------------------------------------------------------- */
.alert {
    border-radius: var(--mdb-radius);
    border-width: 1px;
    border-style: solid;
    padding: 0.85rem 1.15rem;
    font-size: 0.875rem;
    color: var(--mdb-text-primary);
}

.alert-primary {
    background-color: rgba(var(--mdb-primary-rgb), 0.12) !important;
    border-color: rgba(var(--mdb-primary-rgb), 0.30) !important;
    color: #90b8f8 !important;
}

.alert-success {
    background-color: rgba(var(--mdb-success-rgb), 0.12) !important;
    border-color: rgba(var(--mdb-success-rgb), 0.30) !important;
    color: #6ee7b7 !important;
}

.alert-danger {
    background-color: rgba(var(--mdb-danger-rgb), 0.12) !important;
    border-color: rgba(var(--mdb-danger-rgb), 0.30) !important;
    color: #fca5a5 !important;
}

.alert-warning {
    background-color: rgba(var(--mdb-warning-rgb), 0.12) !important;
    border-color: rgba(var(--mdb-warning-rgb), 0.30) !important;
    color: #fde047 !important;
}

.alert-info {
    background-color: rgba(var(--mdb-info-rgb), 0.12) !important;
    border-color: rgba(var(--mdb-info-rgb), 0.30) !important;
    color: #7dd3fc !important;
}

[data-theme="light"] .alert-primary {
    background-color: #ebf3fe !important;
    border-color: #b6d4fe !important;
    color: #084298 !important;
}

[data-theme="light"] .alert-success {
    background-color: #e8f7ee !important;
    border-color: #badbcc !important;
    color: #0f5132 !important;
}

[data-theme="light"] .alert-danger {
    background-color: #fdf2f2 !important;
    border-color: #f5c2c7 !important;
    color: #842029 !important;
}

[data-theme="light"] .alert-warning {
    background-color: #fffbeb !important;
    border-color: #ffecb5 !important;
    color: #664d03 !important;
}

[data-theme="light"] .alert-info {
    background-color: #f0f9ff !important;
    border-color: #b6effb !important;
    color: #055160 !important;
}

/* --------------------------------------------------------------------------
   17. UTILIDADES DE FONDO Y SUPERFICIES (EVITA ELEMENTOS BLANCOS INVOLUNTARIOS)
   -------------------------------------------------------------------------- */
.bg-body-tertiary {
    background-color: var(--mdb-surface-elevated) !important;
    color: var(--mdb-text-primary) !important;
}

.bg-body-secondary {
    background-color: var(--mdb-surface-hover) !important;
    color: var(--mdb-text-primary) !important;
}

.bg-light {
    background-color: var(--mdb-surface-elevated) !important;
    color: var(--mdb-text-primary) !important;
}

[data-theme="light"] .bg-body-tertiary {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
}

[data-theme="light"] .bg-body-secondary {
    background-color: #e2e8f0 !important;
    color: #1e293b !important;
}

[data-theme="light"] .bg-light {
    background-color: #f8fafc !important;
    color: #1e293b !important;
}

/* --------------------------------------------------------------------------
   18. COMPONENTES AUXILIARES (OFFCANVAS, LIST-GROUP, BORDES)
   -------------------------------------------------------------------------- */
.offcanvas {
    background-color: var(--mdb-surface-sidebar) !important;
    color: var(--mdb-text-primary) !important;
    border-color: var(--mdb-border) !important;
}

.offcanvas-header {
    border-bottom: 1px solid var(--mdb-border);
}

.list-group-item {
    background-color: var(--mdb-surface);
    border-color: var(--mdb-border);
    color: var(--mdb-text-primary);
}

.list-group-item:hover {
    background-color: var(--mdb-surface-hover);
    color: var(--mdb-text-primary);
}

.list-group-item.active {
    background-color: var(--mdb-primary);
    border-color: var(--mdb-primary);
    color: #ffffff;
}

/* Shared action controls used by inventory, menu and order cards. */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    border: 1px solid var(--mdb-border);
    border-radius: var(--mdb-radius);
    background: var(--mdb-surface-elevated);
    color: var(--mdb-text-primary);
    cursor: pointer;
}
.action-btn:hover { background: var(--mdb-surface-hover); }
.action-btn:focus-visible { outline: 2px solid var(--mdb-info); outline-offset: 2px; }

/* The form uses the same four steps at every viewport size. */
#createProductModal .form-step:not(.active) { display: none; }
#createProductModal .wizard-progress-dots { display: flex; gap: 8px; margin-top: 8px; }
#createProductModal .step-dot { width: 24px; height: 4px; border-radius: 2px; background: var(--mdb-border); }
#createProductModal .step-dot.active { background: var(--mdb-primary); }

/* --------------------------------------------------------------------------
   19. CLASES UTILITARIAS PARA IMÁGENES (evita desbordes y distorsiones)
   -------------------------------------------------------------------------- */

/* Vista previa de logos y avatares: contiene la imagen completa sin recortar */
.img-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Imagen de producto en cards: llena el espacio recortando si es necesario */
.product-image {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

/* Contenedor de logo de restaurante en configuración */
.logo-preview-container {
    width: 84px;
    height: 84px;
    max-height: 200px;
    max-width: 200px;
    background: var(--card-dark-light);
    border: 1px solid var(--card-border);
    border-radius: var(--mdb-radius);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Avatar grande de perfil (foto de usuario) */
.profile-avatar-container {
    width: 84px;
    height: 84px;
    max-height: 150px;
    max-width: 150px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Logo pequeño del restaurante en sidebar/perfil */
.logo-small {
    width: 32px;
    height: 32px;
    max-height: 48px;
    max-width: 48px;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}
/* Enlaces legales disponibles también después del registro. */
.legal-footer { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 20px 16px; font-size: 14px; line-height: 1.6; }
.legal-footer a { color: inherit; text-decoration: underline; text-underline-offset: 4px; padding-block: 8px; }
.legal-footer a:focus-visible { outline: 3px solid #60a5fa; outline-offset: 4px; }
