/* ==========================================================================
   SETTINGS APPLICATION STYLES
   ========================================================================== */

.settings-app {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.settings-sidebar {
  width: 200px;
  background: rgba(0, 0, 0, 0.15);
  border-right: var(--glass-border-subtle);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.settings-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.settings-nav-item.active {
  background: var(--accent);
  color: #ffffff;
}

/* Style No. 3 — accent is pure white, so active nav text inverts to black */
[data-ui-style="3"] .settings-nav-item.active {
  color: var(--text-invert);
}

.settings-nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
}

.settings-content {
  flex: 1;
  overflow-y: auto;
  overflow-anchor: none;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-page {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.settings-page.active {
  display: flex;
}

.settings-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.settings-section-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
}

.ui-style-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ui-style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.ui-style-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--glass-border-subtle);
  border-radius: var(--style-corner-radius);
  background: var(--bg-surface);
  color: var(--text-primary);
}

.ui-style-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.ui-style-card.active {
  border-color: var(--accent);
}

.ui-style-preview {
  display: block;
  width: 100%;
  aspect-ratio: 720 / 404;
  object-fit: cover;
  background: var(--bg-surface-solid);
}

.ui-style-card-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
}

.ui-style-name {
  font-size: 11.5px;
  font-weight: 600;
}

.ui-style-description {
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.3;
}

.settings-row .switch input:disabled + .slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: var(--glass-border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.settings-row-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-row-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-row-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Storage overview */
.storage-overview {
  border: var(--glass-border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  padding: 18px;
}

.storage-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.storage-hero-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--accent-light);
  color: var(--accent);
}

.storage-hero-icon svg {
  width: 22px;
  height: 22px;
}

.storage-hero-info {
  flex: 1;
  min-width: 0;
}

.storage-hero-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.storage-hero-capacity {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.storage-hero-used {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.storage-hero-used strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.storage-hero-used span {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.storage-bar {
  height: 8px;
  margin-top: 16px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.storage-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent);
  transition: width 0.35s ease;
}

.storage-meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.storage-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.storage-category {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: var(--glass-border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11.5px;
}

.storage-category-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.storage-category-name {
  flex: 1;
  color: var(--text-secondary);
}

.storage-category-size {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Wallpaper Presets Grid */
.wallpaper-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.wallpaper-toolbar .btn-primary {
  padding: 6px 14px;
  font-size: 12px;
}

.wallpaper-toolbar-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.wallpaper-card {
  height: 80px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background-size: cover !important;
  background-position: center !important;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.wallpaper-card:hover {
  transform: scale(1.03);
}

.wallpaper-card.active {
  border-color: var(--accent);
}

.wallpaper-card-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  backdrop-filter: blur(4px);
}

.wallpaper-card-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  font-size: 13px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.wallpaper-card:hover .wallpaper-card-remove {
  opacity: 1;
}

.wallpaper-card-remove:hover {
  background: #e11d48;
}

@media (max-width: 620px) {
  .ui-style-grid {
    grid-template-columns: 1fr;
  }
}

/* Accent Color Swatches */
.accent-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.accent-swatch {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform var(--transition-fast);
}

/* "Auto" swatch — neutral marker meaning "follow the UI style" */
.accent-swatch.auto {
  background: var(--accent);
  border-color: rgba(255, 255, 255, 0.35);
  position: relative;
}

.accent-swatch.auto::after {
  content: 'A';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}

/* Segmented option picker (clock style / font) */
.settings-row .segmented {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.segment-btn {
  padding: 5px 12px;
  border: 1px solid var(--glass-border-subtle);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.segment-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.segment-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Clock position — enter drag-to-move mode directly on the desktop */
.clock-position-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.clock-position-btn svg {
  width: 15px;
  height: 15px;
}

/* Range slider field */
.range-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-field input[type="range"] {
  width: 150px;
  accent-color: var(--accent);
}

.range-value {
  min-width: 42px;
  text-align: right;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

/* Color picker field */
.color-field {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.color-input {
  width: 30px;
  height: 28px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
}

.color-input:hover {
  border-color: var(--accent);
}

.accent-swatch:hover {
  transform: scale(1.15);
}

.accent-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 24px;
  margin-right: 38px;
  vertical-align: middle;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Small text beside all toggle buttons showing whether the option is on or off */
.switch::after {
  content: "Off";
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
}

.switch:has(input:checked)::after,
.switch[data-state="on"]::after {
  content: "On";
}

.switch[data-state="off"]::after {
  content: "Off";
}

/* -------------------------------------------------------------
   THEME TOGGLE & BUTTON RULES:
   Dark mode: all buttons & toggle buttons are WHITE
   Light mode: all buttons & toggle buttons are DARK
   ------------------------------------------------------------- */

/* Dark Mode Toggles */
[data-theme="dark"] .slider,
[data-ui-style="2"] .slider,
[data-ui-style="3"] .slider,
:root:not([data-theme="light"]) .slider {
  background-color: rgba(255, 255, 255, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .slider:before,
[data-ui-style="2"] .slider:before,
[data-ui-style="3"] .slider:before,
:root:not([data-theme="light"]) .slider:before {
  background-color: #ffffff;
}

[data-theme="dark"] input:checked + .slider,
[data-ui-style="2"] input:checked + .slider,
[data-ui-style="3"] input:checked + .slider,
:root:not([data-theme="light"]) input:checked + .slider {
  background-color: #ffffff !important;
  border-color: #ffffff !important;
}

[data-theme="dark"] input:checked + .slider:before,
[data-ui-style="2"] input:checked + .slider:before,
[data-ui-style="3"] input:checked + .slider:before,
:root:not([data-theme="light"]) input:checked + .slider:before {
  background-color: #0f172a !important;
}

[data-theme="dark"] .switch::after,
[data-ui-style="2"] .switch::after,
[data-ui-style="3"] .switch::after,
:root:not([data-theme="light"]) .switch::after {
  color: #ffffff;
}

/* Light Mode Toggles */
[data-theme="light"] .slider {
  background-color: rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(15, 23, 42, 0.3);
}

[data-theme="light"] .slider:before {
  background-color: #0f172a;
}

[data-theme="light"] input:checked + .slider {
  background-color: #0f172a !important;
  border-color: #0f172a !important;
}

[data-theme="light"] input:checked + .slider:before {
  background-color: #ffffff !important;
}

[data-theme="light"] .switch::after {
  color: #0f172a;
}
