/* Preferences Modal Styles */
.preferences-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 3000;
  overflow-y: auto;
}

.preferences-modal.show {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
}

.preferences-modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  margin-top: 20px;
  animation: slideIn 0.3s ease;
}

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

.preferences-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.preferences-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #111827;
}

.preferences-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.preferences-close-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.preferences-modal-body {
  padding: 0;
  max-height: calc(90vh - 120px);
  overflow-y: auto;
}

.preferences-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  padding: 0 24px;
}

.preferences-tab {
  padding: 12px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-weight: 500;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.preferences-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.preferences-tab:hover {
  color: #374151;
}

.preferences-tab-content {
  display: none;
  padding: 24px;
}

.preferences-tab-content.active {
  display: block;
}

.preferences-section {
  margin-bottom: 32px;
}

.preferences-section:last-child {
  margin-bottom: 0;
}

.preferences-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 16px 0;
}

.preferences-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.preference-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
}

.preference-label {
  flex: 1;
}

.preference-label strong {
  display: block;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

.preference-label span {
  font-size: 14px;
  color: #6b7280;
}

.preference-control {
  margin-left: 16px;
}

.preference-control select,
.preference-control input[type="number"],
.preference-control input[type="range"] {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  min-width: 120px;
}

.preference-control input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.preference-control input[type="range"] {
  min-width: 150px;
}

.range-value {
  margin-left: 8px;
  font-weight: 600;
  color: #374151;
  min-width: 40px;
  text-align: center;
}

.preferences-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.preferences-actions {
  display: flex;
  gap: 12px;
}

.preferences-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.preferences-btn-primary {
  background: #2563eb;
  color: white;
}

.preferences-btn-primary:hover {
  background: #1d4ed8;
}

.preferences-btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.preferences-btn-secondary:hover {
  background: #e5e7eb;
}

.preferences-btn-danger {
  background: #dc2626;
  color: white;
}

.preferences-btn-danger:hover {
  background: #b91c1c;
}

.preview-area {
  margin-top: 16px;
  padding: 16px;
  background: #f3f4f6;
  border-radius: 8px;
  border-left: 4px solid #2563eb;
}

.preview-area h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.preview-area p {
  margin: 0;
  font-size: 14px;
  color: #6b7280;
}

/* Dark theme support */
.dark-theme .preferences-modal-content {
  background: #2c2c2c !important;
  color: #ffffff !important;
}

.dark-theme .preferences-modal-header,
.dark-theme .preferences-tabs,
.dark-theme .preferences-modal-footer {
  background: #383838 !important;
  border-color: #404040 !important;
}

.dark-theme .preferences-modal-header h2 {
  color: #ffffff !important;
}

.dark-theme .preference-item {
  background: #383838 !important;
  border-color: #404040 !important;
  color: #ffffff !important;
}

.dark-theme .preference-label strong {
  color: #ffffff !important;
}

.dark-theme .preference-label span {
  color: #cccccc !important;
}

.dark-theme .preview-area {
  background: #2c2c2c !important;
  border-left-color: #66BB6A !important;
  color: #ffffff !important;
}

.dark-theme .preference-control select,
.dark-theme .preference-control input[type="number"],
.dark-theme .preference-control input[type="range"] {
  background: #2c2c2c !important;
  border: 1px solid #404040 !important;
  color: #ffffff !important;
}

.dark-theme .preference-control select:focus,
.dark-theme .preference-control input[type="number"]:focus,
.dark-theme .preference-control input[type="range"]:focus {
  border-color: #66BB6A !important;
  outline: none !important;
}

.dark-theme .range-value {
  color: #ffffff !important;
}

.dark-theme .preferences-close-btn {
  background: #404040 !important;
  color: #ffffff !important;
}

.dark-theme .preferences-close-btn:hover {
  background: #555555 !important;
}

.dark-theme .preferences-tab {
  background: #2c2c2c !important;
  color: #cccccc !important;
  border: 1px solid #404040 !important;
}

.dark-theme .preferences-tab:hover {
  background: #404040 !important;
  color: #ffffff !important;
}

.dark-theme .preferences-tab.active {
  background: #66BB6A !important;
  color: #ffffff !important;
  border-color: #66BB6A !important;
}

.dark-theme .preferences-section {
  background: #2c2c2c !important;
  color: #ffffff !important;
}

.dark-theme .preferences-section h3 {
  color: #ffffff !important;
  border-bottom: 2px solid #404040 !important;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .preferences-modal-content {
    margin: 10px;
    max-height: 95vh;
  }
  
  .preferences-grid {
    grid-template-columns: 1fr;
  }
  
  .preferences-tabs {
    overflow-x: auto;
    padding: 0 16px;
  }
  
  .preferences-tab-content {
    padding: 16px;
  }
  
  .preference-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .preference-control {
    margin-left: 0;
    margin-top: 12px;
    width: 100%;
  }
}
