/**
 * ShadowReader - Settings Modal Component Styles
 * Gothic-themed settings modal with glowing frame and atmospheric styling
 */

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--easing-smooth);
}

.modal-overlay.visible {
  display: flex;
  opacity: 1;
}

/* Settings Modal Container */
.settings-modal {
  position: relative;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  background: linear-gradient(135deg, var(--color-brown-dark) 0%, var(--color-purple-deep) 100%);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 
    0 0 40px rgba(255, 140, 66, 0.3),
    0 0 80px rgba(255, 140, 66, 0.2),
    0 20px 60px rgba(0, 0, 0, 0.8);
  transform: scale(0.9);
  transition: transform var(--duration-normal) var(--easing-smooth);
}

.modal-overlay.visible .settings-modal {
  transform: scale(1);
}

/* Gothic Frame Border */
.modal-frame {
  position: relative;
  padding: var(--spacing-xl);
  border: 2px solid var(--color-orange-candle);
  border-radius: 6px;
  margin: 8px;
  background: rgba(26, 15, 15, 0.6);
  box-shadow: 
    inset 0 0 20px rgba(255, 140, 66, 0.1),
    0 0 20px rgba(255, 140, 66, 0.4);
  animation: frameGlow 3s ease-in-out infinite;
}

@keyframes frameGlow {
  0%, 100% {
    box-shadow: 
      inset 0 0 20px rgba(255, 140, 66, 0.1),
      0 0 20px rgba(255, 140, 66, 0.4);
  }
  50% {
    box-shadow: 
      inset 0 0 30px rgba(255, 140, 66, 0.15),
      0 0 30px rgba(255, 140, 66, 0.6);
  }
}

/* Corner Decorations */
.modal-frame::before,
.modal-frame::after {
  content: '';
  position: absolute;
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--color-orange-candle);
  opacity: 0.6;
}

.modal-frame::before {
  top: -2px;
  left: -2px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 6px;
}

.modal-frame::after {
  bottom: -2px;
  right: -2px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 6px;
}

/* Modal Title */
.settings-modal h2 {
  font-family: var(--font-gothic);
  font-size: 2rem;
  color: var(--color-orange-candle);
  text-align: center;
  margin: 0 0 var(--spacing-lg) 0;
  text-shadow: 
    0 0 10px rgba(255, 140, 66, 0.6),
    0 0 20px rgba(255, 140, 66, 0.3);
  letter-spacing: 2px;
}

/* Settings Content */
.settings-content {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: var(--spacing-sm);
  scrollbar-width: thin;
  scrollbar-color: var(--color-orange-candle) rgba(45, 27, 78, 0.3);
}

.settings-content::-webkit-scrollbar {
  width: 8px;
}

.settings-content::-webkit-scrollbar-track {
  background: rgba(45, 27, 78, 0.3);
  border-radius: 4px;
}

.settings-content::-webkit-scrollbar-thumb {
  background: var(--color-orange-candle);
  border-radius: 4px;
  opacity: 0.6;
}

.settings-content::-webkit-scrollbar-thumb:hover {
  background: var(--color-orange-glow);
}

/* Settings Group */
.settings-group {
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 140, 66, 0.2);
  border-radius: 4px;
  transition: all var(--duration-fast) var(--easing-smooth);
}

.settings-group:hover {
  background: rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 140, 66, 0.4);
  box-shadow: 0 0 15px rgba(255, 140, 66, 0.2);
}

.settings-group label {
  display: block;
  font-family: var(--font-gothic);
  font-size: 1.1rem;
  color: var(--color-parchment);
  margin-bottom: var(--spacing-sm);
  text-shadow: 0 0 5px rgba(255, 140, 66, 0.3);
  letter-spacing: 1px;
}

.settings-group .setting-description {
  font-size: 0.85rem;
  color: var(--color-parchment-dark);
  margin-top: var(--spacing-xs);
  font-style: italic;
  opacity: 0.8;
}

/* Select Dropdown */
.settings-group select {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  background: rgba(26, 15, 15, 0.8);
  border: 1.5px solid var(--color-orange-candle);
  border-radius: 4px;
  color: var(--color-parchment);
  font-family: var(--font-gothic);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--duration-fast) var(--easing-smooth);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.settings-group select:hover {
  border-color: var(--color-orange-glow);
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 10px rgba(255, 140, 66, 0.3);
}

.settings-group select:focus {
  outline: none;
  border-color: var(--color-orange-glow);
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 15px rgba(255, 140, 66, 0.5);
}

.settings-group select option {
  background: var(--color-brown-dark);
  color: var(--color-parchment);
  padding: var(--spacing-sm);
}

/* Theme Options */
.theme-options {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.theme-btn {
  flex: 1;
  min-width: 120px;
  padding: var(--spacing-md);
  background: rgba(26, 15, 15, 0.8);
  border: 2px solid var(--color-orange-candle);
  border-radius: 4px;
  color: var(--color-parchment);
  font-family: var(--font-gothic);
  font-size: 0.95rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--duration-fast) var(--easing-smooth);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.theme-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 140, 66, 0.3), transparent);
  transition: left 0.5s ease;
}

.theme-btn:hover::before {
  left: 100%;
}

.theme-btn:hover {
  border-color: var(--color-orange-glow);
  box-shadow: 
    0 0 15px rgba(255, 140, 66, 0.4),
    inset 0 0 10px rgba(255, 140, 66, 0.1);
  transform: translateY(-2px);
}

.theme-btn:active {
  transform: translateY(0);
}

.theme-btn.active {
  background: rgba(255, 140, 66, 0.2);
  border-color: var(--color-orange-glow);
  box-shadow: 
    0 0 20px rgba(255, 140, 66, 0.5),
    inset 0 0 15px rgba(255, 140, 66, 0.2);
}

/* Theme Preview Swatches */
.theme-btn .theme-swatch {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: var(--spacing-xs);
  height: 20px;
}

.theme-swatch-color {
  width: 24px;
  height: 20px;
  border-radius: 2px;
  border: 1px solid rgba(255, 140, 66, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Classic Theme Swatch */
.theme-btn[data-theme="classic"] .theme-swatch-color:nth-child(1) {
  background: #1A0F0F;
}
.theme-btn[data-theme="classic"] .theme-swatch-color:nth-child(2) {
  background: #2D1B4E;
}
.theme-btn[data-theme="classic"] .theme-swatch-color:nth-child(3) {
  background: #FF8C42;
}

/* Midnight Theme Swatch */
.theme-btn[data-theme="midnight"] .theme-swatch-color:nth-child(1) {
  background: #0A0A1A;
}
.theme-btn[data-theme="midnight"] .theme-swatch-color:nth-child(2) {
  background: #1A1A3E;
}
.theme-btn[data-theme="midnight"] .theme-swatch-color:nth-child(3) {
  background: #4A90E2;
}

/* Crimson Theme Swatch */
.theme-btn[data-theme="crimson"] .theme-swatch-color:nth-child(1) {
  background: #1A0000;
}
.theme-btn[data-theme="crimson"] .theme-swatch-color:nth-child(2) {
  background: #3E0A0A;
}
.theme-btn[data-theme="crimson"] .theme-swatch-color:nth-child(3) {
  background: #DC143C;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
}

.toggle-switch input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 15, 15, 0.8);
  border: 1.5px solid var(--color-orange-candle);
  border-radius: 30px;
  transition: all var(--duration-fast) var(--easing-smooth);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 2px;
  background: var(--color-parchment-dark);
  border-radius: 50%;
  transition: all var(--duration-fast) var(--easing-smooth);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-slider {
  background: rgba(255, 140, 66, 0.3);
  border-color: var(--color-orange-glow);
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 10px rgba(255, 140, 66, 0.4);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(30px);
  background: var(--color-orange-candle);
  box-shadow: 0 0 10px rgba(255, 140, 66, 0.6);
}

.toggle-switch:hover .toggle-slider {
  border-color: var(--color-orange-glow);
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 8px rgba(255, 140, 66, 0.3);
}

/* Range Slider */
.settings-group input[type="range"] {
  width: 100%;
  height: 8px;
  background: rgba(26, 15, 15, 0.8);
  border: 1px solid var(--color-orange-candle);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.settings-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--color-orange-candle);
  border: 2px solid var(--color-orange-glow);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 
    0 0 10px rgba(255, 140, 66, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all var(--duration-fast) var(--easing-smooth);
}

.settings-group input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--color-orange-glow);
  box-shadow: 
    0 0 15px rgba(255, 140, 66, 0.8),
    0 2px 6px rgba(0, 0, 0, 0.4);
  transform: scale(1.1);
}

.settings-group input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--color-orange-candle);
  border: 2px solid var(--color-orange-glow);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 
    0 0 10px rgba(255, 140, 66, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all var(--duration-fast) var(--easing-smooth);
}

.settings-group input[type="range"]::-moz-range-thumb:hover {
  background: var(--color-orange-glow);
  box-shadow: 
    0 0 15px rgba(255, 140, 66, 0.8),
    0 2px 6px rgba(0, 0, 0, 0.4);
  transform: scale(1.1);
}

.settings-group input[type="range"]:hover {
  border-color: var(--color-orange-glow);
  box-shadow: 0 0 8px rgba(255, 140, 66, 0.3);
}

/* Range Value Display */
.range-value {
  display: inline-block;
  margin-left: var(--spacing-sm);
  padding: 2px var(--spacing-sm);
  background: rgba(255, 140, 66, 0.2);
  border: 1px solid var(--color-orange-candle);
  border-radius: 3px;
  color: var(--color-orange-candle);
  font-family: var(--font-gothic);
  font-size: 0.9rem;
  min-width: 50px;
  text-align: center;
}

/* Wax Seal Close Button */
.wax-seal-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  width: 50px;
  height: 50px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all var(--duration-fast) var(--easing-smooth);
  z-index: 10;
}

.wax-seal-close:hover {
  transform: scale(1.1) rotate(90deg);
  filter: drop-shadow(0 0 10px rgba(255, 140, 66, 0.6));
}

.wax-seal-close:active {
  transform: scale(0.95) rotate(90deg);
}

.wax-seal-close .wax-seal-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Action Buttons */
.settings-actions {
  display: flex;
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(255, 140, 66, 0.2);
}

.settings-btn {
  flex: 1;
  padding: var(--spacing-md) var(--spacing-lg);
  background: rgba(26, 15, 15, 0.8);
  border: 2px solid var(--color-orange-candle);
  border-radius: 4px;
  color: var(--color-parchment);
  font-family: var(--font-gothic);
  font-size: 1rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--duration-fast) var(--easing-smooth);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.settings-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 140, 66, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

.settings-btn:hover::before {
  width: 300px;
  height: 300px;
}

.settings-btn:hover {
  border-color: var(--color-orange-glow);
  box-shadow: 
    0 0 15px rgba(255, 140, 66, 0.4),
    inset 0 0 10px rgba(255, 140, 66, 0.1);
  transform: translateY(-2px);
}

.settings-btn:active {
  transform: translateY(0);
}

.settings-btn span {
  position: relative;
  z-index: 1;
}

.settings-btn.primary {
  background: rgba(255, 140, 66, 0.2);
  border-color: var(--color-orange-glow);
}

.settings-btn.primary:hover {
  background: rgba(255, 140, 66, 0.3);
  box-shadow: 
    0 0 20px rgba(255, 140, 66, 0.6),
    inset 0 0 15px rgba(255, 140, 66, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
  .settings-modal {
    width: 95%;
    max-height: 90vh;
  }

  .modal-frame {
    padding: var(--spacing-lg);
  }

  .settings-modal h2 {
    font-size: 1.5rem;
  }

  .theme-options {
    flex-direction: column;
  }

  .theme-btn {
    min-width: 100%;
  }

  .settings-actions {
    flex-direction: column;
  }

  .wax-seal-close {
    width: 40px;
    height: 40px;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
  }
}

/* Accessibility */
.settings-group input:focus,
.settings-group select:focus,
.theme-btn:focus,
.settings-btn:focus {
  outline: 2px solid var(--color-orange-glow);
  outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .settings-modal,
  .settings-group,
  .theme-btn,
  .toggle-slider,
  .toggle-slider::before,
  .settings-btn,
  .wax-seal-close {
    transition: none;
    animation: none;
  }

  .theme-btn::before,
  .settings-btn::before {
    display: none;
  }
}
