/* Preferences Page Styles */
.preferences-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Header */
.preferences-header {
  background: white;
  border-bottom: 1px solid #e1e5e9;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-left h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: #2d3748;
}

.back-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #4a5568;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.back-button:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
  color: #2d3748;
}

.back-button svg {
  flex-shrink: 0;
}

.reset-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #fed7d7;
  border: 1px solid #fc8181;
  border-radius: 8px;
  color: #c53030;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.reset-button:hover {
  background: #feb2b2;
  border-color: #f56565;
}

/* Main Content */
.preferences-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  min-height: calc(100vh - 120px);
}

/* Sidebar */
.preferences-sidebar {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  height: fit-content;
  position: sticky;
  top: 140px;
}

.preferences-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 8px;
  color: #4a5568;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: #f7fafc;
  color: #2d3748;
}

.nav-item.active {
  background: #ebf8ff;
  color: #3182ce;
  border-color: #90cdf4;
}

.nav-item.admin-item {
  color: #805ad5;
}

.nav-item.admin-item:hover {
  background: #faf5ff;
  color: #6b46c1;
}

.nav-item.admin-item.active {
  background: #f3e8ff;
  color: #6b46c1;
  border-color: #c4b5fd;
}

.nav-item svg {
  flex-shrink: 0;
}

.nav-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 1rem 0;
}

.nav-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  padding: 0 1rem;
}

/* Main Content Area */
.preferences-main {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  position: relative;
  overflow: hidden;
}

.section-content {
  padding: 2rem;
}

.preference-section {
  display: none;
}

.preference-section.active {
  display: block;
}

.section-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 1rem;
}

.section-header h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #2d3748;
}

.section-header p {
  margin: 0;
  color: #718096;
  font-size: 1rem;
}

/* Preference Groups */
.preference-groups {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.preference-group {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  background: #f8f9fa;
}

.preference-group h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #2d3748;
}

/* Form Elements */
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.75rem 0;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-row label {
  font-weight: 500;
  color: #4a5568;
  margin-right: 1rem;
}

.form-row select,
.form-row input[type="range"] {
  min-width: 200px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  font-size: 0.875rem;
  transition: border-color 0.2s ease;
}

.form-row select:focus,
.form-row input:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

/* Range Input */
.form-row input[type="range"] {
  border: none;
  background: transparent;
  cursor: pointer;
}

.range-value {
  min-width: 50px;
  text-align: right;
  font-weight: 600;
  color: #3182ce;
  margin-left: 0.5rem;
}

/* Checkbox Styles */
.checkbox-row {
  align-items: flex-start;
  padding: 1rem 0;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  margin-right: 0;
}

.checkbox-row input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #e2e8f0;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.checkbox-row input[type="checkbox"]:checked {
  background: #3182ce;
  border-color: #3182ce;
}

.checkbox-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 6px;
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Admin Sections */
.admin-section {
  display: none;
}

.admin-section.show {
  display: block;
}

/* Bulk Operations */
.bulk-operation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 1rem;
  background: white;
}

.bulk-operation:last-child {
  margin-bottom: 0;
}

.operation-info h4 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: #2d3748;
}

.operation-info p {
  margin: 0;
  font-size: 0.875rem;
  color: #718096;
}

.operation-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #3182ce;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.operation-button:hover {
  background: #2c5aa0;
}

.operation-button.danger {
  background: #e53e3e;
}

.operation-button.danger:hover {
  background: #c53030;
}

.operation-button:disabled {
  background: #a0aec0;
  cursor: not-allowed;
}

/* Progress Bar */
.bulk-progress {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.progress-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #2d3748;
}

.cancel-button {
  padding: 0.5rem 1rem;
  background: #fed7d7;
  color: #c53030;
  border: 1px solid #fc8181;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.cancel-button:hover {
  background: #feb2b2;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: #3182ce;
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: #718096;
}

/* Statistics */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: #ebf8ff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3182ce;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2d3748;
}

.stat-label {
  font-size: 0.875rem;
  color: #718096;
}

.stat-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-name {
  color: #4a5568;
  font-weight: 500;
}

.stat-number {
  color: #3182ce;
  font-weight: 600;
}

/* Save Panel */
.save-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #f0fff4;
  border-top: 1px solid #68d391;
  padding: 1rem 2rem;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.save-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.save-message {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #22543d;
  font-weight: 500;
}

.save-message svg {
  color: #38a169;
}

.save-actions {
  display: flex;
  gap: 0.75rem;
}

.preview-button,
.undo-button {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.preview-button {
  background: #3182ce;
  color: white;
}

.preview-button:hover {
  background: #2c5aa0;
}

.undo-button {
  background: #fed7d7;
  color: #c53030;
}

.undo-button:hover {
  background: #feb2b2;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top: 3px solid #3182ce;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  color: #4a5568;
  font-weight: 500;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-content.small {
  max-width: 400px;
}

.modal-header {
  padding: 1.5rem 2rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
}

.close-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #718096;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.close-button:hover {
  color: #4a5568;
}

.modal-body {
  padding: 1.5rem 2rem;
}

.modal-tab h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #2d3748;
}

.modal-tab p {
  margin: 0 0 1.5rem 0;
  color: #718096;
}

.file-upload-area {
  border: 2px dashed #cbd5e0;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1rem;
}

.file-upload-area:hover {
  border-color: #3182ce;
  background: #f7fafc;
}

.file-upload-area.dragover {
  border-color: #3182ce;
  background: #ebf8ff;
}

.file-upload-area svg {
  color: #a0aec0;
  margin-bottom: 0.5rem;
}

.file-upload-area p {
  margin: 0;
  color: #718096;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.primary-button,
.secondary-button,
.danger-button {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.primary-button {
  background: #3182ce;
  color: white;
}

.primary-button:hover {
  background: #2c5aa0;
}

.primary-button:disabled {
  background: #a0aec0;
  cursor: not-allowed;
}

.secondary-button {
  background: #f7fafc;
  color: #4a5568;
  border: 1px solid #e2e8f0;
}

.secondary-button:hover {
  background: #edf2f7;
}

.danger-button {
  background: #e53e3e;
  color: white;
}

.danger-button:hover {
  background: #c53030;
}

/* Color Palette Preview Styles */
.color-palette-preview {
  margin-top: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.palette-colors {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.color-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.color-swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.palette-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.palette-name {
  font-weight: 600;
  color: #2d3748;
  font-size: 0.9rem;
}

.palette-description {
  font-size: 0.8rem;
  color: #718096;
  font-style: italic;
}

/* Default Theme Colors */
.color-palette-preview[data-theme="default"] .primary { background: #3182ce; }
.color-palette-preview[data-theme="default"] .secondary { background: #4a5568; }
.color-palette-preview[data-theme="default"] .accent { background: #38b2ac; }
.color-palette-preview[data-theme="default"] .background { background: #f7fafc; }

/* Forest Theme Colors (Olive Green & Earth Tones) */
.color-palette-preview[data-theme="forest"] .primary { background: #6b7d47; }
.color-palette-preview[data-theme="forest"] .secondary { background: #8b4513; }
.color-palette-preview[data-theme="forest"] .accent { background: #9acd32; }
.color-palette-preview[data-theme="forest"] .background { background: #f5f5dc; }

/* Mountain Theme Colors (Stone Gray & Alpine Blue) */
.color-palette-preview[data-theme="mountain"] .primary { background: #708090; }
.color-palette-preview[data-theme="mountain"] .secondary { background: #2f4f4f; }
.color-palette-preview[data-theme="mountain"] .accent { background: #4682b4; }
.color-palette-preview[data-theme="mountain"] .background { background: #f0f8ff; }

/* Desert Theme Colors (Sand & Terracotta) */
.color-palette-preview[data-theme="desert"] .primary { background: #cd853f; }
.color-palette-preview[data-theme="desert"] .secondary { background: #a0522d; }
.color-palette-preview[data-theme="desert"] .accent { background: #daa520; }
.color-palette-preview[data-theme="desert"] .background { background: #fdf5e6; }

/* Woodland Theme Colors (Deep Green & Brown) */
.color-palette-preview[data-theme="woodland"] .primary { background: #228b22; }
.color-palette-preview[data-theme="woodland"] .secondary { background: #654321; }
.color-palette-preview[data-theme="woodland"] .accent { background: #32cd32; }
.color-palette-preview[data-theme="woodland"] .background { background: #f0fff0; }

/* Wilderness Theme Colors (Pine & Moss) */
.color-palette-preview[data-theme="wilderness"] .primary { background: #2e8b57; }
.color-palette-preview[data-theme="wilderness"] .secondary { background: #556b2f; }
.color-palette-preview[data-theme="wilderness"] .accent { background: #90ee90; }
.color-palette-preview[data-theme="wilderness"] .background { background: #f5fffa; }

.group-description {
  margin: 0.5rem 0;
  font-size: 0.85rem;
  color: #718096;
  line-height: 1.4;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .preferences-content {
    grid-template-columns: 240px 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
  }
  
  .preferences-sidebar {
    padding: 1rem;
  }
  
  .section-content {
    padding: 1.5rem;
  }
}

@media (max-width: 768px) {
  .preferences-content {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }
  
  .preferences-sidebar {
    position: static;
    order: 2;
  }
  
  .preferences-main {
    order: 1;
  }
  
  .preferences-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .nav-item {
    white-space: nowrap;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
  }
  
  .nav-item svg {
    display: none;
  }
  
  .form-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .form-row select,
  .form-row input[type="range"] {
    min-width: 100%;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .bulk-operation {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .save-content {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .header-content {
    padding: 1rem;
  }
  
  .header-left h1 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .section-content {
    padding: 1rem;
  }
  
  .preference-group {
    padding: 1rem;
  }
  
  .modal-content {
    width: 95%;
    margin: 1rem;
  }
  
  .modal-header,
  .modal-body {
    padding: 1rem;
  }
}
