/**
 * شاشة اختيار الثيم — HUD سينمائي Iron Man / Star Wars
 */

#themePickerScreen.theme-screen {
  position: fixed;
  inset: 0;
  z-index: 100500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#themePickerScreen.theme-screen.hidden {
  display: none !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.theme-screen-open {
  overflow: hidden;
}

/* ——— خلفية سينمائية ——— */
.hud-theme-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.hud-theme-fx__grid {
  position: absolute;
  inset: -20%;
  background:
    linear-gradient(rgba(0, 229, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  transform: perspective(600px) rotateX(58deg) translateY(12%);
  opacity: 0.55;
  animation: hudGridDrift 18s linear infinite;
}

@keyframes hudGridDrift {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 0 40px, 40px 0; }
}

.hud-theme-fx__scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.9), transparent);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.8);
  opacity: 0;
  animation: hudScanSweep 2.8s ease-in-out infinite;
}

@keyframes hudScanSweep {
  0% { top: -4%; opacity: 0; }
  8% { opacity: 0.9; }
  92% { opacity: 0.9; }
  100% { top: 104%; opacity: 0; }
}

.hud-theme-fx__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 45%, transparent 0%, rgba(0, 0, 0, 0.72) 100%);
}

#themePickerScreen .theme-screen-backdrop {
  position: fixed;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 55% at 50% 100%, rgba(0, 120, 255, 0.18) 0%, transparent 55%),
    rgba(0, 2, 8, 0.88);
  backdrop-filter: blur(8px);
  cursor: pointer;
  opacity: 1;
}

#themePickerScreen.hidden .theme-screen-backdrop {
  opacity: 0;
}

/* ——— لوحة HUD ——— */
#themePickerScreen .gx-theme-panel,
#themePickerPanel.gx-theme-panel {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  width: min(96vw, 960px);
  max-width: 960px;
  max-height: min(92vh, 880px);
  margin: auto;
  padding: 2px;
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.55), rgba(0, 100, 200, 0.2), rgba(0, 229, 255, 0.45));
  box-shadow:
    0 0 60px rgba(0, 180, 255, 0.2),
    0 24px 80px rgba(0, 0, 0, 0.55);
  opacity: 1;
  transform: none;
  filter: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#themePickerScreen.is-opening .gx-theme-panel {
  animation: hudPanelReveal 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

#themePickerScreen.is-closing .gx-theme-panel {
  animation: hudPanelHide 0.35s ease forwards;
}

@keyframes hudPanelReveal {
  0% {
    transform: scale(0.9) translateY(28px);
    opacity: 0.2;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

@keyframes hudPanelHide {
  to {
    transform: scale(0.96) translateY(18px);
    opacity: 0;
  }
}

#themePickerScreen .hud-theme-panel-inner {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 2px;
  background:
    linear-gradient(180deg, rgba(4, 16, 32, 0.97) 0%, rgba(2, 10, 22, 0.98) 100%);
  padding: 22px 22px 26px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.hud-theme-panel-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(0, 229, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.5;
}

.hud-panel-corners {
  position: absolute;
  inset: 10px;
  pointer-events: none;
  z-index: 3;
}

.hud-panel-corners span {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: #00e5ff;
  border-style: solid;
  opacity: 0.85;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
}

.hud-panel-corners span:nth-child(1) { top: 0; right: 0; border-width: 2px 2px 0 0; }
.hud-panel-corners span:nth-child(2) { top: 0; left: 0; border-width: 2px 0 0 2px; }
.hud-panel-corners span:nth-child(3) { bottom: 0; right: 0; border-width: 0 2px 2px 0; }
.hud-panel-corners span:nth-child(4) { bottom: 0; left: 0; border-width: 0 0 2px 2px; }

.gx-theme-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(0, 229, 255, 0.22);
  position: relative;
  z-index: 2;
}

.hud-theme-header-brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-theme-header-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #00e5ff;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

.hud-theme-header-tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00e5ff;
  box-shadow: 0 0 10px #00e5ff;
  animation: hudTagPulse 1.6s ease-in-out infinite;
}

@keyframes hudTagPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.gx-theme-title {
  margin: 0;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: #e8f8ff;
  letter-spacing: 0.04em;
  text-shadow: 0 0 16px rgba(0, 229, 255, 0.35);
}

.hud-theme-subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: #6eb8d8;
  line-height: 1.45;
}

.gx-theme-back {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 8px;
  background: rgba(0, 229, 255, 0.08);
  color: #00e5ff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.12);
}

.gx-theme-back:hover {
  background: rgba(0, 229, 255, 0.18);
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.3);
  transform: scale(1.04);
}

/* ——— مفتاح Light / Dark ——— */
.gx-mode-toggle {
  display: flex;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 24px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 8, 18, 0.9);
  border: 1px solid rgba(0, 229, 255, 0.2);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 180, 255, 0.08);
  position: relative;
  z-index: 2;
}

.gx-mode-btn {
  flex: 1;
  padding: 10px 20px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #8ec8e0;
  font-size: 14px;
  font-weight: 700;
  font-family: "Rajdhani", inherit;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.22s ease, box-shadow 0.22s ease, color 0.22s;
}

.gx-mode-btn.is-active {
  background: linear-gradient(135deg, #0099cc, #00e5ff);
  color: #001018;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.45);
}

.gx-mode-btn:not(.is-active):hover {
  background: rgba(0, 229, 255, 0.1);
  color: #d0f4ff;
}

/* ——— شبكة الثيمات ——— */
.gx-theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px 14px;
  position: relative;
  z-index: 2;
}

@media (max-width: 820px) {
  .gx-theme-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 560px) {
  .gx-theme-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 10px;
  }
}

.gx-theme-section-label {
  grid-column: 1 / -1;
  font-family: "Rajdhani", inherit;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6a8a9a;
  margin-top: 6px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(0, 229, 255, 0.12);
}

.gx-theme-section-label.is-hud-section {
  color: #00e5ff;
  font-size: 12px;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.35);
  border-bottom-color: rgba(0, 229, 255, 0.25);
}

.gx-theme-section-label.is-hud-section i {
  margin-left: 6px;
}

.gx-theme-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.gx-theme-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gx-theme-preview {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 4px;
  background: #060c14;
  border-top: 2px solid var(--gx-accent, #ff2948);
  border-left: 2px solid var(--gx-accent, #ff2948);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 4px 16px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: box-shadow 0.25s, transform 0.25s;
}

.gx-theme-card:hover .gx-theme-preview {
  transform: translateY(-3px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 24px color-mix(in srgb, var(--gx-accent) 45%, transparent);
}

.gx-theme-card.is-selected .gx-theme-preview {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.15),
    0 0 28px color-mix(in srgb, var(--gx-accent) 55%, transparent);
}

/* معاينة HUD — حلقة دوارة */
.gx-theme-preview.is-hud-preview {
  background:
    radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--gx-accent) 18%, transparent) 0%, transparent 55%),
    #040810;
}

.hud-preview-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 58%;
  height: 58%;
  margin: -29% 0 0 -29%;
  border: 2px dashed color-mix(in srgb, var(--gx-accent) 70%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 14px color-mix(in srgb, var(--gx-accent) 40%, transparent);
  animation: hudPreviewSpin 12s linear infinite;
}

.hud-preview-ring::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid color-mix(in srgb, var(--gx-accent) 35%, transparent);
  border-radius: 50%;
  border-top-color: var(--gx-accent);
  animation: hudPreviewSpin 4s linear infinite reverse;
}

.hud-preview-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14%;
  height: 14%;
  margin: -7% 0 0 -7%;
  border-radius: 50%;
  background: var(--gx-accent);
  box-shadow: 0 0 16px var(--gx-accent), 0 0 32px color-mix(in srgb, var(--gx-accent) 50%, transparent);
  animation: hudCorePulse 2s ease-in-out infinite;
}

@keyframes hudPreviewSpin {
  to { transform: rotate(360deg); }
}

@keyframes hudCorePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.88); opacity: 0.75; }
}

.gx-preview-tab {
  position: absolute;
  top: 0;
  left: 0;
  width: 38%;
  height: 28%;
  background: rgba(4, 8, 14, 0.9);
  border-bottom-right-radius: 6px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.gx-preview-dots {
  position: absolute;
  top: 6px;
  left: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 2;
}

.gx-preview-dots i {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--gx-accent, #ff2948);
  box-shadow: 0 0 6px color-mix(in srgb, var(--gx-accent) 60%, transparent);
}

.gx-theme-preview.is-light-mode {
  background: #e8eef4;
  border-color: var(--gx-accent);
}

.gx-theme-preview.is-light-mode .gx-preview-tab {
  background: #d8e0ea;
}

.gx-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
}

.gx-theme-name-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.gx-theme-name {
  font-family: "Rajdhani", inherit;
  font-size: 13px;
  font-weight: 700;
  color: #e0f0f8;
  line-height: 1.25;
}

.is-hud-card .gx-theme-name {
  color: #c8f4ff;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.2);
}

.gx-theme-desc {
  font-size: 10px;
  color: #6a90a8;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gx-theme-radio {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #3a5a6a;
  background: transparent;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  position: relative;
}

.gx-theme-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.2s;
}

.gx-theme-card.is-selected .gx-theme-radio {
  border-color: #00e5ff;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.45);
}

.gx-theme-card.is-selected .gx-theme-radio::after {
  background: #00e5ff;
}

/* ——— لوحات تحكم احترافية (SciFi / Corona / Royal) ——— */
.gx-theme-section-label.is-dash-section {
  color: #00f2ff;
  font-size: 12px;
  text-shadow: 0 0 10px rgba(0, 242, 255, 0.35);
  border-bottom-color: rgba(0, 242, 255, 0.22);
}

.gx-theme-section-label.is-dash-section i {
  margin-left: 6px;
}

.gx-theme-preview.is-dash-preview {
  background: #060a12;
  border-color: var(--gx-accent, #00f2ff);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--gx-accent, #00f2ff) 18%, transparent),
    0 0 18px color-mix(in srgb, var(--gx-accent, #00f2ff) 22%, transparent);
}

.dash-preview-grid {
  position: absolute;
  inset: 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 5px;
  pointer-events: none;
}

.dash-preview-grid i {
  display: block;
  border-radius: 3px;
  background: color-mix(in srgb, var(--gx-accent, #00f2ff) 12%, #0a1018);
  border: 1px solid color-mix(in srgb, var(--gx-accent, #00f2ff) 35%, transparent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--gx-accent, #00f2ff) 15%, transparent);
}

.dash-preview-grid i:nth-child(1) { opacity: 1; }
.dash-preview-grid i:nth-child(2) { opacity: 0.75; }
.dash-preview-grid i:nth-child(3) { opacity: 0.55; }
.dash-preview-grid i:nth-child(4) { opacity: 0.9; }

.is-dash-card .gx-theme-name {
  color: #d8f8ff;
  text-shadow: 0 0 8px color-mix(in srgb, var(--gx-accent, #00f2ff) 35%, transparent);
}

.is-dash-card.is-selected .gx-theme-preview {
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--gx-accent, #00f2ff) 45%, transparent),
    0 0 24px color-mix(in srgb, var(--gx-accent, #00f2ff) 35%, transparent);
}

.is-dash-card.is-selected .gx-theme-radio {
  border-color: var(--gx-accent, #00f2ff);
  box-shadow: 0 0 10px color-mix(in srgb, var(--gx-accent, #00f2ff) 45%, transparent);
}

.is-dash-card.is-selected .gx-theme-radio::after {
  background: var(--gx-accent, #00f2ff);
}
