/* Shared theme panel styles. Used by /app and /dashboard. */

.theme-panel-overlay {
  --tp-primary: var(--c-primary, var(--accent, #3fb950));
  --tp-secondary: var(--c-secondary, var(--accent, #4a9e6a));
  --tp-accent: var(--c-accent, var(--accent, #3fb950));
  --tp-light: var(--c-light, var(--surface2, rgba(63, 185, 80, 0.12)));
  --tp-bg: var(--c-bg, var(--bg, #0d1117));
  --tp-surface: var(--c-surface, var(--surface, #161b22));
  --tp-text: var(--c-text, var(--text, #e6edf3));
  --tp-muted: var(--c-muted, var(--muted, #8b949e));
  --tp-border: var(--c-border, var(--border, rgba(255,255,255,0.12)));
  --tp-font-head: var(--font-head, var(--font, 'Outfit', sans-serif));
  --tp-font-body: var(--font-body, 'DM Sans', sans-serif);

  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(5px);
}

.theme-panel-overlay--desktop {
  align-items: center;
  justify-content: center;
}

.theme-panel-overlay--mobile {
  align-items: flex-end;
  justify-content: center;
}

.theme-panel-overlay *,
.theme-panel-overlay *::before,
.theme-panel-overlay *::after {
  box-sizing: border-box;
}

.theme-panel-sheet {
  background: var(--tp-surface);
  color: var(--tp-text);
  padding: 24px;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.36);
  border: 1px solid var(--tp-border);
  font-family: var(--tp-font-body);
}

.theme-panel-sheet--desktop {
  max-width: 520px;
  width: 90%;
  max-height: 90vh;
  border-radius: 16px;
}

.theme-panel-sheet--mobile {
  width: 100%;
  max-width: 480px;
  max-height: 82vh;
  border-radius: 20px 20px 0 0;
}

.theme-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.theme-panel-title {
  font-family: var(--tp-font-head);
  font-weight: 800;
  font-size: 18px;
  color: var(--tp-text);
}

.theme-panel-x {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--tp-border);
  background: transparent;
  color: var(--tp-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-panel-section {
  margin-bottom: 20px;
}

.theme-panel-section--compact {
  margin-bottom: 16px;
}

.theme-panel-section-label,
.theme-custom-label {
  font-size: 11px;
  color: var(--tp-muted);
  margin-bottom: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.theme-panel-section-head,
.theme-custom-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.theme-panel-grid-2,
.theme-panel-grid-3 {
  display: grid;
  gap: 8px;
}

.theme-panel-grid-2 {
  grid-template-columns: 1fr 1fr;
}

.theme-panel-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.theme-panel-mode-btn,
.theme-panel-font-btn,
.theme-swatch-button,
.theme-apply-btn,
.theme-clear-btn,
.theme-panel-done {
  font-family: var(--tp-font-head);
  appearance: none;
  -webkit-appearance: none;
}

.theme-panel-mode-btn,
.theme-panel-font-btn {
  border-radius: 10px;
  border: 2px solid var(--tp-border);
  background: transparent;
  color: var(--tp-text);
  font-weight: 800;
  cursor: pointer;
}

.theme-panel-mode-btn.active,
.theme-panel-font-btn.active {
  border-color: var(--tp-accent);
  background: color-mix(in srgb, var(--tp-accent) 12%, transparent);
}

.theme-panel-mode-btn {
  padding: 11px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.theme-panel-font-btn {
  padding: 10px 8px;
}

.theme-panel-font-btn--md {
  font-size: 13px;
}

.theme-panel-font-btn--lg {
  font-size: 15px;
}

.theme-panel-font-btn--xl {
  font-size: 17px;
}

.theme-panel-pro-badge,
.theme-pro-badge {
  font-size: 10px;
  background: linear-gradient(135deg, var(--tp-accent), var(--tp-primary));
  color: #fff;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 700;
}

.theme-panel-swatch-grid {
  display: grid;
  gap: 6px;
}

.theme-panel-swatch-grid--free {
  grid-template-columns: repeat(4, 1fr);
}

.theme-panel-swatch-grid--pro {
  grid-template-columns: repeat(6, 1fr);
}

.theme-swatch-button {
  padding: 8px 4px;
  border-radius: 10px;
  border: 2px solid var(--theme-swatch-border, var(--tp-border));
  background: var(--theme-swatch-bg, transparent);
  color: var(--tp-text);
  cursor: pointer;
  min-height: 66px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.theme-swatch-dot {
  width: var(--theme-swatch-size, 34px);
  height: var(--theme-swatch-size, 34px);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, color-mix(in srgb, #fff 24%, transparent), transparent 38%),
    linear-gradient(135deg, var(--theme-swatch-color), color-mix(in srgb, var(--theme-swatch-color) 70%, #000));
  margin: 0 auto 6px;
  box-shadow: var(--theme-swatch-shadow, 0 2px 5px color-mix(in srgb, var(--theme-swatch-color) 20%, transparent));
}

.theme-panel-swatch-label {
  color: var(--tp-muted);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.1;
}

.theme-panel-swatch-label--active {
  color: var(--tp-secondary);
  font-weight: 800;
}

.theme-custom-box {
  margin-bottom: 20px;
  padding: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tp-accent) 8%, var(--tp-surface)), var(--tp-surface));
  border-radius: 12px;
  border: 1px solid var(--tp-border);
}

.theme-custom-head {
  margin-bottom: 10px;
}

.theme-custom-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.theme-color-input {
  width: 44px;
  height: 44px;
  border: 2px solid var(--tp-border);
  border-radius: 10px;
  padding: 3px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.theme-hex-input {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  border-radius: 10px;
  border: 2px solid var(--theme-hex-border, var(--tp-border));
  background: var(--tp-bg);
  color: var(--tp-text);
  font-size: 14px;
  font-weight: 800;
  font-family: var(--tp-font-head);
  outline: none;
}

.theme-apply-btn {
  padding: 11px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--tp-primary), var(--tp-secondary));
  color: #fff;
  border: none;
  font-weight: 800;
  cursor: pointer;
  font-size: 13px;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--tp-primary) 30%, transparent);
}

.theme-clear-btn {
  margin-left: auto;
  font-size: 11px;
  color: #ef4444;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 700;
  text-decoration: underline;
}

.theme-active-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-active-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--theme-active-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--theme-active-color) 40%, transparent);
}

.theme-active-text {
  color: var(--tp-muted);
  font-size: 11px;
}

.theme-active-text strong {
  color: var(--tp-text);
}

.theme-panel-upsell {
  margin-bottom: 20px;
  padding: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tp-accent) 10%, transparent), transparent);
  border: 1px solid color-mix(in srgb, var(--tp-accent) 30%, transparent);
  border-radius: 10px;
}

.theme-panel-upsell__title {
  margin-bottom: 2px;
  color: var(--tp-secondary);
  font-size: 12px;
  font-weight: 800;
}

.theme-panel-upsell__text {
  color: var(--tp-muted);
  font-size: 11px;
}

.theme-panel-done {
  width: 100%;
  background: linear-gradient(135deg, var(--tp-primary), var(--tp-secondary));
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--tp-primary) 30%, transparent);
}

.theme-panel-done--desktop {
  padding: 10px;
}

.theme-panel-done--mobile {
  padding: 12px;
}
