@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0e1a;
  --bg2: #111827;
  --bg3: #1e293b;
  --card: rgba(30, 41, 59, 0.7);
  --card-border: rgba(99, 102, 241, 0.15);
  --primary: #6366f1;
  --primary-light: #818cf8;
  --accent: #22d3ee;
  --green: #10b981;
  --green-light: #34d399;
  --amber: #f59e0b;
  --red: #ef4444;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;
  --glass: rgba(255, 255, 255, 0.03);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body {
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background animated gradient */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(34, 211, 238, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
  z-index: 0;
  animation: bgShift 20s ease-in-out infinite;
}

@keyframes bgShift {

  0%,
  100% {
    transform: translate(0, 0);
  }

  33% {
    transform: translate(-3%, 2%);
  }

  66% {
    transform: translate(2%, -3%);
  }
}

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* Header */
.header {
  text-align: center;
  padding: 40px 0 30px;
}

.header .logo {
  font-size: 40px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.header .subtitle {
  font-size: 18px;
  color: var(--text2);
  font-weight: 300;
}

.header .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--green-light);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  backdrop-filter: blur(20px);
  transition: all 0.3s;
}

.card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.1);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title .icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* STEM Category Buttons */
.stem-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stem-btn {
  background: var(--bg3);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s;
  color: var(--text);
  position: relative;
}

.stem-btn:hover {
  transform: translateY(-2px);
}

.stem-btn.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
}

.stem-btn .letter {
  font-size: 28px;
  font-weight: 800;
  display: block;
  margin-bottom: 4px;
}

.stem-btn .name {
  font-size: 12px;
  color: var(--text2);
}

.stem-btn .count {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--green);
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stem-btn.s-cat .letter {
  color: #60a5fa;
}

.stem-btn.t-cat .letter {
  color: #c084fc;
}

.stem-btn.e-cat .letter {
  color: #fb923c;
}

.stem-btn.m-cat .letter {
  color: #34d399;
}

.stem-btn.s-cat.active {
  border-color: #60a5fa;
  background: rgba(96, 165, 250, 0.12);
}

.stem-btn.t-cat.active {
  border-color: #c084fc;
  background: rgba(192, 132, 252, 0.12);
}

.stem-btn.e-cat.active {
  border-color: #fb923c;
  background: rgba(251, 146, 60, 0.12);
}

.stem-btn.m-cat.active {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.12);
}

/* Program items */
.programs-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}

.programs-list::-webkit-scrollbar {
  width: 4px;
}

.programs-list::-webkit-scrollbar-track {
  background: transparent;
}

.programs-list::-webkit-scrollbar-thumb {
  background: var(--text3);
  border-radius: 4px;
}

.program-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s;
  font-size: 13px;
  font-weight: 500;
}

.program-item:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.program-item.selected {
  border-color: var(--green);
  background: rgba(16, 185, 129, 0.12);
}

.program-item.selected .check {
  background: var(--green);
  border-color: var(--green);
}

.program-item .check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--text3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 11px;
  color: #fff;
}

.select-all-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-sm);
  color: var(--primary-light);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  margin-bottom: 12px;
}

.select-all-btn:hover {
  background: rgba(99, 102, 241, 0.2);
}

.programs-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
  margin-bottom: 12px;
}

.programs-counter.full {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green-light);
}

/* Students Slider */
.slider-container {
  padding: 10px 0;
}

.slider-value {
  text-align: center;
  font-size: 48px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.slider-label {
  text-align: center;
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 16px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  outline: none;
  direction: ltr;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
  transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 16px rgba(99, 102, 241, 0.6);
}

/* Toggle Options */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.option-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg2);
  border: 2px solid var(--bg3);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s;
  user-select: none;
}

.option-toggle:hover {
  border-color: var(--text3);
  transform: translateY(-1px);
}

.option-toggle.active {
  border-color: var(--green);
  background: rgba(16, 185, 129, 0.08);
}

.option-toggle .toggle-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--bg3);
  transition: all 0.3s;
  flex-shrink: 0;
}

.option-toggle.active .toggle-icon {
  background: var(--green);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.option-toggle .toggle-info {
  flex: 1;
}

.option-toggle .toggle-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.option-toggle .toggle-desc {
  font-size: 11px;
  color: var(--text3);
}

.option-toggle .toggle-status {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--bg3);
  position: relative;
  transition: all 0.3s;
  flex-shrink: 0;
}

.option-toggle .toggle-status::after {
  content: '';
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text3);
  position: absolute;
  top: 3px;
  right: 3px;
  transition: all 0.3s;
}

.option-toggle.active .toggle-status {
  background: var(--green);
}

.option-toggle.active .toggle-status::after {
  background: #fff;
  right: 23px;
}

/* Price Summary */
.price-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(34, 211, 238, 0.08));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  position: sticky;
  top: 20px;
}

.price-total-label {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 8px;
}

.price-total {
  font-size: 42px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
  direction: ltr;
}

.price-vat-note {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 20px;
}

.price-breakd.icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.programs-counter {
  margin-right: auto;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg3);
  padding: 4px 10px;
  border-radius: 12px;
  color: var(--text2);
}

.programs-counter.full {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
}

/* Duration Grid */
.duration-options {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.duration-btn {
  flex: 1;
  text-align: center;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  font-size: 14px;
  min-width: 80px;
}

.duration-btn:hover {
  border-color: var(--text3);
}

.duration-btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
  color: var(--primary-light);
}

/* STEM Categories */
.stem-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stem-card-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stem-btn {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  flex: 1;
}

.stem-add-track {
  width: 100%;
  padding: 8px;
  background: var(--bg3);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.stem-add-track:hover {
  background: var(--primary);
  color: #fff;
}

.price-breakdown {
  text-align: right;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text2);
}

.price-row .val {
  font-weight: 600;
  color: var(--text);
  direction: ltr;
}

.price-row.total-row {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 8px;
  padding-top: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.price-row.total-row .val {
  color: var(--accent);
  font-size: 18px;
}

/* Info Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--bg2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}

.stat-box .num {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary-light);
}

.stat-box .label {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

.stat-box:nth-child(2) .num {
  color: var(--accent);
}

.stat-box:nth-child(3) .num {
  color: var(--green-light);
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

/* Footer */
.footer {
  text-align: center;
  padding: 40px 0 20px;
  color: var(--text3);
  font-size: 13px;
}

.footer a {
  color: var(--primary-light);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ========== ADMIN STYLES ========== */
.admin-gate {
  max-width: 400px;
  margin: 120px auto;
  text-align: center;
}

.admin-gate .lock-icon {
  font-size: 60px;
  margin-bottom: 20px;
}

.admin-gate input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg2);
  border: 2px solid var(--bg3);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  text-align: center;
  direction: ltr;
  outline: none;
  margin-bottom: 12px;
  transition: border-color 0.3s;
}

.admin-gate input:focus {
  border-color: var(--primary);
}

.admin-gate .error {
  color: var(--red);
  font-size: 14px;
  margin-bottom: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  color: #fff;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

.btn-green {
  background: linear-gradient(135deg, var(--green), #059669);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-green:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4);
}

.btn-block {
  width: 100%;
}

/* Admin Form Fields */
.admin-section {
  margin-bottom: 24px;
}

.admin-section h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-light);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.15);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}

.field input {
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  direction: ltr;
  text-align: center;
  outline: none;
  transition: border-color 0.3s;
}

.field input:focus {
  border-color: var(--primary);
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--green);
  color: #fff;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 100;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 30px;
  color: var(--text3);
}

.empty-state .emoji {
  font-size: 40px;
  margin-bottom: 10px;
}

.empty-state p {
  font-size: 14px;
}

/* Responsive */
@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .price-card {
    position: static;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .programs-list {
    grid-template-columns: 1fr;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .stem-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Pulse Animation */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Spot count badge */
.spot-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(34, 211, 238, 0.12);
  color: var(--accent);
  margin-top: 12px;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}

.modal-content {
  background: var(--bg2);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 680px;
  padding: 32px;
  position: relative;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg3);
  border: none;
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--red);
  color: #fff;
}

.admin-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg);
  border: 2px solid var(--bg3);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  text-align: center;
  direction: ltr;
  outline: none;
  transition: border-color 0.3s;
}

.admin-input:focus {
  border-color: var(--primary);
}