/* ===========================================
   GESTIOLEX - Saved Filters (Filtri Salvati)
   =========================================== */

/* ===========================================
   CONTAINER FILTRI SALVATI
   =========================================== */
.saved-filters-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ===========================================
   DROPDOWN FILTRI
   =========================================== */
.saved-filters-dropdown {
  position: relative;
  display: inline-block;
}

.saved-filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.85rem;
  color: #495057;
  background: white;
  border: 1px solid #ced4da;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.saved-filters-toggle:hover {
  border-color: #0B5E70;
  color: #0B5E70;
}

.saved-filters-toggle.has-active {
  background: #e7f5f7;
  border-color: #0B5E70;
  color: #0B5E70;
}

.saved-filters-toggle-icon {
  font-size: 1rem;
}

.saved-filters-toggle-text {
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-filters-toggle-caret {
  font-size: 0.7rem;
  opacity: 0.6;
}

/* Menu dropdown */
.saved-filters-menu {
  position: fixed;
  z-index: 9999;
  min-width: 220px;
  max-width: 300px;
  max-height: 400px;
  overflow-y: auto;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  padding: 6px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.saved-filters-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Header menu */
.saved-filters-menu-header {
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e5e7eb;
}

/* Item filtro */
.saved-filters-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  transition: background-color 0.1s;
}

.saved-filters-item:hover {
  background-color: #f3f4f6;
}

.saved-filters-item.active {
  background-color: #e7f5f7;
  color: #0B5E70;
}

.saved-filters-item-icon {
  font-size: 0.9rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.saved-filters-item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-filters-item-delete {
  opacity: 0;
  padding: 2px 6px;
  font-size: 0.8rem;
  color: #dc3545;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.saved-filters-item:hover .saved-filters-item-delete {
  opacity: 1;
}

.saved-filters-item-delete:hover {
  background: #fef2f2;
  color: #b91c1c;
}

/* Divider */
.saved-filters-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 6px 0;
}

/* Azione salva nuovo */
.saved-filters-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.875rem;
  color: #0B5E70;
  cursor: pointer;
  transition: background-color 0.1s;
}

.saved-filters-action:hover {
  background-color: #e7f5f7;
}

.saved-filters-action-icon {
  font-size: 1rem;
}

/* Empty state */
.saved-filters-empty {
  padding: 16px 12px;
  text-align: center;
  color: #9ca3af;
  font-size: 0.85rem;
}

.saved-filters-empty-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
  display: block;
}

/* ===========================================
   PULSANTE SALVA FILTRO
   =========================================== */
.btn-save-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1rem;
  color: #6b7280;
  background: white;
  border: 1px solid #ced4da;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save-filter:hover {
  border-color: #fbbf24;
  color: #f59e0b;
  background: #fffbeb;
}

.btn-save-filter.is-saved {
  border-color: #f59e0b;
  color: #f59e0b;
  background: #fffbeb;
}

/* ===========================================
   MODAL SALVA FILTRO
   =========================================== */
.save-filter-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.save-filter-modal.show {
  opacity: 1;
  visibility: visible;
}

.save-filter-modal-content {
  width: 90%;
  max-width: 400px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  transform: scale(0.95);
  transition: transform 0.2s;
}

.save-filter-modal.show .save-filter-modal-content {
  transform: scale(1);
}

.save-filter-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.save-filter-modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.save-filter-modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.save-filter-modal-close:hover {
  color: #111827;
}

.save-filter-modal-body {
  padding: 20px;
}

.save-filter-modal-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.save-filter-modal-input:focus {
  outline: none;
  border-color: #0B5E70;
  box-shadow: 0 0 0 3px rgba(11, 94, 112, 0.15);
}

.save-filter-modal-hint {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #6b7280;
}

.save-filter-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
}

.save-filter-modal-btn {
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.save-filter-modal-btn-cancel {
  background: white;
  border: 1px solid #d1d5db;
  color: #374151;
}

.save-filter-modal-btn-cancel:hover {
  background: #f3f4f6;
}

.save-filter-modal-btn-save {
  background: #0B5E70;
  border: 1px solid #0B5E70;
  color: white;
}

.save-filter-modal-btn-save:hover {
  background: #094a59;
}

/* ===========================================
   DARK MODE
   =========================================== */
[data-bs-theme="dark"] .saved-filters-toggle {
  background: #2d3339;
  border-color: #3d4349;
  color: #e5e7eb;
}

[data-bs-theme="dark"] .saved-filters-toggle:hover {
  border-color: #4dd0e1;
  color: #4dd0e1;
}

[data-bs-theme="dark"] .saved-filters-toggle.has-active {
  background: rgba(77, 208, 225, 0.15);
  border-color: #4dd0e1;
  color: #4dd0e1;
}

[data-bs-theme="dark"] .saved-filters-menu {
  background: #212529;
  border-color: #3d4349;
}

[data-bs-theme="dark"] .saved-filters-menu-header {
  color: #9ca3af;
  border-bottom-color: #3d4349;
}

[data-bs-theme="dark"] .saved-filters-item {
  color: #e5e7eb;
}

[data-bs-theme="dark"] .saved-filters-item:hover {
  background-color: #2d3339;
}

[data-bs-theme="dark"] .saved-filters-item.active {
  background-color: rgba(77, 208, 225, 0.15);
  color: #4dd0e1;
}

[data-bs-theme="dark"] .saved-filters-divider {
  background: #3d4349;
}

[data-bs-theme="dark"] .saved-filters-action {
  color: #4dd0e1;
}

[data-bs-theme="dark"] .saved-filters-action:hover {
  background-color: rgba(77, 208, 225, 0.1);
}

[data-bs-theme="dark"] .saved-filters-empty {
  color: #6b7280;
}

[data-bs-theme="dark"] .btn-save-filter {
  background: #2d3339;
  border-color: #3d4349;
  color: #9ca3af;
}

[data-bs-theme="dark"] .btn-save-filter:hover,
[data-bs-theme="dark"] .btn-save-filter.is-saved {
  border-color: #f59e0b;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
}

[data-bs-theme="dark"] .save-filter-modal-content {
  background: #212529;
}

[data-bs-theme="dark"] .save-filter-modal-header {
  border-bottom-color: #3d4349;
}

[data-bs-theme="dark"] .save-filter-modal-title {
  color: #e5e7eb;
}

[data-bs-theme="dark"] .save-filter-modal-close {
  color: #9ca3af;
}

[data-bs-theme="dark"] .save-filter-modal-close:hover {
  color: #e5e7eb;
}

[data-bs-theme="dark"] .save-filter-modal-input {
  background: #2d3339;
  border-color: #3d4349;
  color: #e5e7eb;
}

[data-bs-theme="dark"] .save-filter-modal-input:focus {
  border-color: #4dd0e1;
  box-shadow: 0 0 0 3px rgba(77, 208, 225, 0.2);
}

[data-bs-theme="dark"] .save-filter-modal-hint {
  color: #6b7280;
}

[data-bs-theme="dark"] .save-filter-modal-footer {
  border-top-color: #3d4349;
}

[data-bs-theme="dark"] .save-filter-modal-btn-cancel {
  background: #2d3339;
  border-color: #3d4349;
  color: #e5e7eb;
}

[data-bs-theme="dark"] .save-filter-modal-btn-cancel:hover {
  background: #3d4349;
}

[data-bs-theme="dark"] .save-filter-modal-btn-save {
  background: #0B5E70;
  border-color: #0B5E70;
}

[data-bs-theme="dark"] .save-filter-modal-btn-save:hover {
  background: #0d7a91;
}
