/* =========================================
   Camera App - Settings Panel Styles
   ========================================= */

/* ── Settings Overlay ─────────────────── */
#settings-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 70;
  display: none;
  align-items: flex-end;
  justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#settings-overlay.show {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Settings Panel ───────────────────── */
#settings-panel {
  width: 100%;
  max-width: 500px;
  background: #1a1a1a;
  border-radius: 24px 24px 0 0;
  padding: 24px 24px calc(env(safe-area-inset-bottom, 0px) + 32px);
  animation: slideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  margin-top: auto;
  flex-shrink: 0;
}

#settings-panel.scrolled {
  border-radius: 24px 24px 0 0;
}

/* ── Settings Header ───────────────────── */
#settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

#settings-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

#settings-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

#settings-close:hover {
  background: rgba(255,255,255,0.15);
}

/* ── Settings Section ─────────────────── */
.settings-section {
  margin-bottom: 20px;
}

.settings-section-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ── Settings Row ─────────────────────── */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-label {
  font-size: 14px;
  color: var(--accent);
}

.settings-label-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Toggle Switch ─────────────────────── */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 28px;
  background: rgba(255,255,255,0.15);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.25s;
  flex-shrink: 0;
}

.toggle-switch.active {
  background: var(--success);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.toggle-switch.active::after {
  transform: translateX(20px);
}

/* ── Select Dropdown ──────────────────── */
.settings-select {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--accent) !important;
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 8px 30px 8px 12px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23ffffff' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 130px;
  -webkit-text-fill-color: var(--accent) !important;
}

.settings-select:focus {
  border-color: rgba(255,255,255,0.3);
}

.settings-select option {
  background: #1a1a1a;
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
}

/* ── Text Input ───────────────────────── */
.settings-input {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--accent) !important;
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 10px 12px;
  width: 140px;
  outline: none;
  text-align: right;
  -webkit-text-fill-color: var(--accent) !important;
}

.settings-input:focus {
  border-color: rgba(255,255,255,0.3);
}

.settings-input::placeholder {
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
}

/* ── Range Slider ─────────────────────── */
.settings-range {
  width: 120px;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.settings-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.settings-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.settings-range-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  min-width: 40px;
  text-align: right;
  margin-left: 10px;
}

.range-container {
  display: flex;
  align-items: center;
}

/* ── Watermark Preview ─────────────────── */
#watermark-preview-frame {
  margin-top: 16px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #1a2a3a 0%, #0d1a2a 40%, #1a0a2a 70%, #0a1520 100%);
  position: relative;
  aspect-ratio: 16/9;
}

#watermark-preview {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Color Hex Input ───────────────────── */
.color-hex-input {
  font-family: var(--font-mono) !important;
  font-size: 12px !important;
  text-transform: uppercase;
  width: 72px !important;
  letter-spacing: 0.05em;
}

/* ── Color Presets ───────────────────────── */
.color-presets {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
}

.color-preset {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.color-preset:hover {
  transform: scale(1.12);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.color-preset.active {
  border-color: #fff;
  transform: scale(1.08);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}

/* ── Color Swatch ──────────────────────── */
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.2);
  transition: border-color 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.color-swatch:hover {
  border-color: rgba(255,255,255,0.5);
  transform: scale(1.08);
}

/* ── Primary Button ────────────────────── */
.settings-btn-primary {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 28px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  letter-spacing: 0.02em;
}

.settings-btn-primary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

.settings-btn-primary:active {
  background: rgba(255, 255, 255, 0.08);
}

.settings-btn-primary:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── SW Update Banner ───────────────────── */
#update-banner {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid rgba(255,255,255,0.12);
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  z-index: 90;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

#update-banner.show {
  transform: translateX(-50%) translateY(0);
}

#update-banner .banner-reload {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}

#update-banner .banner-reload:hover {
  opacity: 0.85;
}

#update-banner .banner-later {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
  font-family: inherit;
}

#update-banner .banner-later:hover {
  color: var(--text-secondary);
}
