/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-deep: #0a0a0f;
  --bg-card: #12121c;
  --bg-card2: #1a1a28;
  --border: #2a2a3d;
  --neon-blue: #00d4ff;
  --neon-pink: #ff006e;
  --neon-green: #00ff88;
  --neon-yellow: #ffd700;
  --neon-purple: #b44aff;
  --text-main: #e8e8ff;
  --text-muted: #7070a0;
  --text-dim: #4a4a6a;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-blue: 0 0 18px rgba(0, 212, 255, 0.25);
  --shadow-pink: 0 0 18px rgba(255, 0, 110, 0.25);
  --shadow-green: 0 0 18px rgba(0, 255, 136, 0.25);
}

html {
  font-size: 16px;
}

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

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

/* ===== HEADER ===== */
.app-header {
  background: linear-gradient(135deg, #0d0d1a 0%, #12122a 100%);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 0 auto;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-icon {
  font-size: 2rem;
  filter: drop-shadow(0 0 8px var(--neon-blue));
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-quick {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
  text-shadow: none;
  filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.5));
}

.logo-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  -webkit-text-fill-color: var(--text-muted);
}

.header-stats {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--neon-blue);
  white-space: nowrap;
}

.stat-chip.revenue {
  color: var(--neon-green);
}

.stat-chip.time-chip {
  color: var(--neon-yellow);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
}

.chip-icon {
  font-size: 0.9rem;
}

/* ===== NAV ===== */
.main-nav {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 0.5rem;
  overflow-x: auto;
  position: sticky;
  top: 68px;
  z-index: 99;
}

.nav-btn {
  flex: 1;
  min-width: 80px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'Cairo', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.75rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.nav-btn:hover {
  color: var(--text-main);
}

.nav-btn.active {
  color: var(--neon-blue);
  border-bottom-color: var(--neon-blue);
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
}

/* ===== PAGES ===== */
.page {
  display: none;
  padding: 1rem;
  max-width: 900px;
  margin: 0 auto;
  padding-bottom: 5rem;
}

.page.active {
  display: block;
}

/* ===== SECTION TITLE ===== */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.neon-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--neon-blue);
  box-shadow: 0 0 8px var(--neon-blue);
  display: inline-block;
  flex-shrink: 0;
}

.neon-dot.green {
  background: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
}

.neon-dot.yellow {
  background: var(--neon-yellow);
  box-shadow: 0 0 8px var(--neon-yellow);
}

.neon-dot.pink {
  background: var(--neon-pink);
  box-shadow: 0 0 8px var(--neon-pink);
}

/* ===== STATIONS GRID ===== */
.stations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 0.85rem;
}

.station-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.85rem;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 150px;
}

.station-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: var(--border);
  transition: background 0.3s, box-shadow 0.3s;
}

.station-card.available::before {
  background: var(--text-dim);
}

.station-card.active::before {
  background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple));
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.6);
}

.station-card.active {
  border-color: rgba(0, 212, 255, 0.3);
  box-shadow: var(--shadow-blue);
  background: linear-gradient(135deg, #12121c, #141428);
}

.station-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 212, 255, 0.4);
}

.station-icon {
  font-size: 1.8rem;
  text-align: center;
}

.station-name {
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-main);
  line-height: 1.3;
}

.station-status {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  align-self: center;
}

.status-available {
  background: rgba(0, 255, 136, 0.1);
  color: var(--neon-green);
  border: 1px solid rgba(0, 255, 136, 0.3);
}

.status-active {
  background: rgba(0, 212, 255, 0.1);
  color: var(--neon-blue);
  border: 1px solid rgba(0, 212, 255, 0.3);
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.4);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0);
  }
}

.station-timer {
  font-family: 'Orbitron', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--neon-blue);
  text-align: center;
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.7);
  letter-spacing: 2px;
}

.station-cost {
  font-size: 0.78rem;
  color: var(--neon-green);
  text-align: center;
  font-weight: 700;
}

.station-player {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== PRODUCTS GRID ===== */
.inventory-actions {
  margin-bottom: 1rem;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.85rem;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  position: relative;
}

.product-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--neon-green), var(--neon-yellow));
}

.product-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.product-category {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.product-price {
  font-size: 1rem;
  font-weight: 900;
  color: var(--neon-green);
}

.product-stock {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.product-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.btn-icon {
  flex: 1;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.3rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Cairo', sans-serif;
}

.btn-icon:hover {
  color: var(--neon-blue);
  border-color: var(--neon-blue);
}

.btn-icon.danger:hover {
  color: var(--neon-pink);
  border-color: var(--neon-pink);
}

/* ===== REPORTS ===== */
.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.report-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.85rem;
  text-align: center;
}

.report-card .rc-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.report-card .rc-value {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--neon-blue);
}

.report-card .rc-value.green {
  color: var(--neon-green);
}

.report-card .rc-value.yellow {
  color: var(--neon-yellow);
}

.report-card .rc-value.pink {
  color: var(--neon-pink);
}

.session-log {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.log-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.log-item .log-name {
  font-weight: 700;
  color: var(--text-main);
}

.log-item .log-time {
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-top: 0.15rem;
}

.log-item .log-total {
  font-weight: 900;
  color: var(--neon-green);
  font-size: 0.95rem;
}

/* ===== SETTINGS ===== */
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.setting-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.setting-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.setting-input {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  padding: 0.4rem 0.7rem;
  width: 110px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.setting-input:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.15);
}

.settings-save-btn {
  align-self: flex-start;
  margin-top: 0.5rem;
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.25rem 0;
}

/* ===== BUTTONS ===== */
.btn-neon {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(180, 74, 255, 0.15));
  border: 1px solid var(--neon-blue);
  color: var(--neon-blue);
  font-family: 'Cairo', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

.btn-neon:hover {
  background: rgba(0, 212, 255, 0.25);
  box-shadow: 0 0 18px rgba(0, 212, 255, 0.45);
  transform: translateY(-1px);
}

.btn-neon.small {
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'Cairo', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline:hover {
  border-color: var(--text-muted);
  color: var(--text-main);
}

.btn-danger {
  background: linear-gradient(135deg, rgba(255, 0, 110, 0.15), rgba(255, 0, 110, 0.05));
  border: 1px solid var(--neon-pink);
  color: var(--neon-pink);
  font-family: 'Cairo', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: rgba(255, 0, 110, 0.25);
  box-shadow: var(--shadow-pink);
}

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 212, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--neon-blue);
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.4);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.modal-field label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.modal-input {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  direction: rtl;
}

.modal-input:focus {
  border-color: var(--neon-blue);
}

select.modal-input {
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.active-session-info {
  background: var(--bg-card2);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.82rem;
  line-height: 1.8;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.active-session-info span {
  color: var(--neon-blue);
  font-weight: 700;
}

.session-orders {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.order-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  background: var(--bg-card2);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
}

.order-item .order-name {
  color: var(--text-main);
}

.order-item .order-price {
  color: var(--neon-green);
  font-weight: 700;
}

.order-item .order-del-btn {
  width: 20px;
  height: 20px;
  margin-inline-start: 0.5rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.65rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.order-item .order-del-btn:hover {
  color: var(--neon-pink);
  border-color: var(--neon-pink);
  box-shadow: 0 0 8px rgba(255, 0, 110, 0.35);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card2);
  border: 1px solid var(--neon-green);
  color: var(--neon-green);
  font-family: 'Cairo', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.65rem 1.5rem;
  border-radius: 30px;
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
  z-index: 1000;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s;
  opacity: 0;
  white-space: nowrap;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .logo-quick {
    font-size: 1.1rem;
  }

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

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

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

  .header-stats {
    gap: 0.3rem;
  }

  .stat-chip {
    font-size: 0.72rem;
    padding: 0.25rem 0.5rem;
  }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.station-card,
.product-card,
.report-card {
  animation: fadeIn 0.3s ease;
}

/* ===== ADDITIONAL FIXES ===== */

/* tap hint text on available cards */
.station-tap-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: auto;
}

/* orders label in active modal */
.orders-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-weight: 600;
}

/* empty state messages */
.empty-msg {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 0.5rem;
}

/* fix qty input width inside flex-col modal-field */
#addOrderQty {
  width: 100% !important;
  margin-top: 0.5rem;
}

/* report card small unit text */
.rc-value small {
  font-size: 0.6rem;
  font-weight: 400;
  opacity: 0.75;
}

/* sticky nav — use CSS var to handle dynamic header height */
@supports (top: env(safe-area-inset-top)) {
  .main-nav {
    top: calc(68px + env(safe-area-inset-top));
  }
}

/* delete button on available station cards */
.station-del-btn {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card2);
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 2;
}

.station-del-btn:hover {
  color: var(--neon-pink);
  border-color: var(--neon-pink);
  box-shadow: 0 0 10px rgba(255, 0, 110, 0.35);
}

/* reports: edit/delete actions on each log entry */
.log-item {
  gap: 0.75rem;
}

.log-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.log-actions {
  display: flex;
  gap: 0.35rem;
}

.btn-icon.mini {
  flex: 0 0 auto;
  padding: 0.2rem 0.45rem;
  font-size: 0.7rem;
}

/* ensure active station card timer is visible on small cards */
@media (max-width: 360px) {
  .station-timer {
    font-size: 0.85rem;
    letter-spacing: 1px;
  }

  .station-name {
    font-size: 0.78rem;
  }
}