/* ============================================================
   ALNAWRAS POOL — Main Stylesheet
   استراحة النورس — ملف الأنماط الرئيسي
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
  --red:        #D32F2F;
  --red-dark:   #B71C1C;
  --red-light:  #FFEBEE;
  --gold:       #F9A825;
  --blue-dot:   #1976D2;
  --gray-dot:   #757575;
  --text:       #1a1a1a;
  --text-muted: #666666;
  --border:     #eeeeee;
  --bg:         #f5f5f5;
  --white:      #ffffff;
  --shadow:     0 1px 6px rgba(0,0,0,0.08);
  --radius:     12px;
  --radius-sm:  8px;
  --radius-lg:  20px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #111;
  font-family: 'Tajawal', sans-serif;
  color: var(--text);
  direction: rtl;
}

/* ---- App Shell ---- */
#app {
  width: 100%;
  max-width: 420px;
  height: 100vh;
  margin: 0 auto;
  background: var(--white);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   SCREENS
   ============================================================ */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  transition: transform 0.35s cubic-bezier(.4,0,.2,1), opacity 0.3s;
  overflow: hidden;
}
.screen.hidden      { transform: translateX(-100%); opacity: 0; pointer-events: none; }
.screen.slide-right { transform: translateX(100%);  opacity: 0; pointer-events: none; }

/* ---- Scrollable area ---- */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.scroll-area::-webkit-scrollbar { display: none; }

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  background: var(--red);
  color: white;
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.topbar-btn:active { background: rgba(255,255,255,0.35); }

/* ============================================================
   BOTTOM NAV
   ============================================================ */
.bottom-nav {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
  background: white;
  padding: 8px 0 12px;
  flex-shrink: 0;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
}
.nav-item svg  { width: 22px; height: 22px; }
.nav-item span { font-size: 10px; color: #999; }

.nav-item.center-btn {
  background: var(--red);
  border-radius: var(--radius-lg);
  padding: 8px 20px;
  flex-direction: row;
  gap: 6px;
  max-width: 130px;
  margin: 0 8px;
}
.nav-item.center-btn span { color: white; font-size: 13px; font-weight: 600; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-red {
  background: var(--red);
  color: white;
  border: none;
  border-radius: 30px;
  padding: 14px 24px;
  font-family: 'Tajawal', sans-serif;
  font-size: 16px;
  font-weight: 700;
  width: calc(100% - 32px);
  margin: 12px 16px;
  cursor: pointer;
  display: block;
  text-align: center;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}
.btn-red:active { background: var(--red-dark); transform: scale(0.98); }

.btn-outline {
  background: white;
  color: var(--red);
  border: 2px solid var(--red);
  border-radius: 30px;
  padding: 13px 24px;
  font-family: 'Tajawal', sans-serif;
  font-size: 15px;
  font-weight: 600;
  width: calc(100% - 32px);
  margin: 6px 16px;
  cursor: pointer;
  display: block;
  text-align: center;
  transition: background 0.2s;
}
.btn-outline:active { background: var(--red-light); }

/* ============================================================
   CARDS & LAYOUT UTILITIES
   ============================================================ */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 16px 12px;
  overflow: hidden;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  padding: 14px 16px 10px;
}
.divider { height: 1px; background: var(--border); margin: 0 16px; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-muted); }

.form-group input,
.form-group select,
.add-form input,
.add-form select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: 'Tajawal', sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  text-align: right;
  direction: rtl;
  width: 100%;
  background: white;
  color: var(--text);
}
.form-group input:focus,
.form-group select:focus,
.add-form input:focus,
.add-form select:focus {
  border-color: var(--red);
}

/* ============================================================
   SPLASH SCREEN
   ============================================================ */
#screen-splash {
  background: var(--red);
  justify-content: center;
  align-items: center;
  gap: 20px;
}
.splash-logo {
  width: 110px;
  height: 110px;
  background: rgba(255,255,255,0.15);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
}
.splash-title { color: white; font-size: 28px; font-weight: 800; text-align: center; }
.splash-sub   { color: rgba(255,255,255,0.75); font-size: 15px; text-align: center; }
.splash-btns  { display: flex; flex-direction: column; gap: 10px; width: 100%; padding: 0 24px; margin-top: 20px; }
.splash-btns .btn-red     { margin: 0; background: white; color: var(--red); }
.splash-btns .btn-outline { margin: 0; border-color: white; color: var(--red); background: white; }
.splash-version { font-size: 12px; color: rgba(255,255,255,0.4); margin-top: 12px; }

/* ============================================================
   LOGIN / REGISTER
   ============================================================ */
.login-header { background: var(--red); padding: 40px 20px 30px; text-align: center; }
.login-header h1 { color: white; font-size: 22px; font-weight: 800; }
.login-header p  { color: rgba(255,255,255,0.8); font-size: 13px; margin-top: 4px; }

.login-form { padding: 24px 16px; display: flex; flex-direction: column; gap: 14px; }
.form-link  { text-align: center; font-size: 13px; color: var(--red); cursor: pointer; font-weight: 600; }
.form-hint  { text-align: center; font-size: 12px; color: #bbb; }

/* ============================================================
   USER HOME — POOL DETAILS
   ============================================================ */
.price-section { padding: 14px 16px; }
.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.price-row:last-child { border-bottom: none; }
.price-label { font-size: 14px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.price-val   { font-size: 15px; font-weight: 700; }

.map-placeholder {
  height: 160px;
  background: #e8f0fe;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
}
.map-placeholder:hover { background: #dde8fd; }

.desc-section { padding: 14px 16px; }
.desc-section p { font-size: 14px; line-height: 1.7; color: var(--text-muted); }

.amenity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #f5f5f5;
  cursor: pointer;
}
.amenity-name    { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.amenity-icon    { font-size: 18px; }
.amenity-chevron { color: #ccc; font-size: 16px; }

.terms-box {
  background: #fafafa;
  border-radius: var(--radius-sm);
  margin: 8px 16px;
  padding: 12px 16px;
}
.terms-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.terms-item  { font-size: 13px; color: var(--text-muted); padding: 2px 0; }

/* ============================================================
   BOOKING CALENDAR
   ============================================================ */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  justify-content: flex-end;
}
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-muted); }
.legend-dot  { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 8px;
}
.cal-nav-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 50%;
  transition: background 0.15s;
}
.cal-nav-btn:hover { background: var(--bg); }

.cal-month-label { font-size: 16px; font-weight: 700; flex: 1; text-align: center; }

.cal-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  padding: 0 16px;
}
.cal-day-name { font-size: 12px; color: var(--text-muted); font-weight: 600; padding: 6px 0; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0 12px;
  gap: 4px;
}
.cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
  user-select: none;
}
.cal-cell.today    { background: #1a1a1a; color: white; font-weight: 700; }
.cal-cell.past     { color: #ccc; cursor: default; }
.cal-cell.selected { background: var(--red) !important; color: white; }
.cal-cell:not(.past):not(.fully-booked):not(.closed):not(.today):not(.selected):hover { background: #f5f5f5; }

/* Booking dots */
.cal-cell.has-dot::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.cal-cell.morning-booked::after { background: var(--gold); }
.cal-cell.evening-booked::after { background: var(--blue-dot); }
.cal-cell.both-booked::after    { background: var(--red); }
.cal-cell.closed { background: #f5f5f5; color: #aaa; cursor: default; }

/* ---- Session Picker ---- */
.session-picker { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }

.session-option {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s;
}
.session-option.selected { border-color: var(--red); background: var(--red-light); }
.session-option-info { display: flex; flex-direction: column; gap: 3px; }
.session-name  { font-size: 15px; font-weight: 600; }
.session-time  { font-size: 12px; color: var(--text-muted); }
.session-price { font-size: 15px; font-weight: 700; color: var(--red); }
.session-price-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.price-original { font-size: 12px; color: var(--red); text-decoration: line-through; text-decoration-color: var(--red); }

.radio-circle {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.session-option.selected .radio-circle { border-color: var(--red); }
.radio-inner { width: 12px; height: 12px; background: var(--red); border-radius: 50%; display: none; }
.session-option.selected .radio-inner { display: block; }

/* ---- Booking Info Summary ---- */
.booking-info { padding: 0 16px 10px; }
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f5f5f5;
}
.info-label { font-size: 14px; color: var(--text-muted); }
.info-val   { font-size: 14px; font-weight: 600; }
.info-val.red { color: var(--red); font-size: 16px; }

/* ============================================================
   PAYMENT SCREEN
   ============================================================ */
.pay-option {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin: 0 16px 10px;
  transition: all 0.2s;
}
.pay-option.selected { border-color: var(--red); background: var(--red-light); }
.pay-option-left { display: flex; align-items: center; gap: 12px; }

.pay-logo {
  width: 44px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.pay-logo.benefit   { background: #FF6B00; color: white; }
.pay-logo.apple-pay { background: #000; color: white; font-size: 13px; font-weight: 700; letter-spacing: -0.5px; }
.pay-name { font-size: 14px; font-weight: 600; }

.benefit-info { padding: 14px 16px; text-align: center; }
.benefit-box {
  background: #FFF3E0;
  border-radius: var(--radius);
  padding: 20px;
}
.benefit-box h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.benefit-box p  { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.benefit-number { font-size: 22px; font-weight: 800; color: #FF6B00; margin: 8px 0; letter-spacing: 2px; }

#apple-fields .benefit-box { background: #f0f0f0; }
.apple-pay-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #000;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 600;
  margin-top: 12px;
  cursor: pointer;
  letter-spacing: -0.3px;
}

/* ============================================================
   CONFIRMATION SCREEN
   ============================================================ */
.confirm-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  gap: 16px;
}
.confirm-check {
  width: 80px;
  height: 80px;
  background: #E8F5E9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  animation: pop 0.4s ease;
}
@keyframes pop {
  0%   { transform: scale(0.5); opacity: 0; }
  80%  { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
.confirm-title   { font-size: 22px; font-weight: 800; color: #2E7D32; }
.confirm-ref     { font-size: 13px; color: var(--text-muted); }
.confirm-card    { width: 100%; background: #fafafa; border-radius: var(--radius); padding: 16px; text-align: right; }
.whatsapp-note {
  background: #E8F5E9;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: #2E7D32;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

/* ============================================================
   OWNER SCREENS
   ============================================================ */
.owner-tab-bar { display: flex; border-bottom: 1px solid var(--border); }
.owner-tab {
  flex: 1;
  text-align: center;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  transition: all 0.2s;
  font-family: 'Tajawal', sans-serif;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.owner-tab.active { color: var(--red); border-bottom-color: var(--red); }

/* Search */
.export-btn {
  width: 100%;
  background: #1a7a3c;
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 11px 16px;
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.export-btn:active { background: #145e2d; }

.search-bar { margin: 12px 16px; position: relative; }
.search-bar input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 30px;
  padding: 10px 16px 10px 40px;
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  outline: none;
  text-align: right;
  direction: rtl;
}
.search-bar input:focus { border-color: var(--red); }
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}

/* Booking cards in list */
.booking-card {
  background: white;
  border-radius: var(--radius);
  margin: 0 16px 10px;
  padding: 14px;
  box-shadow: var(--shadow);
  border-right: 4px solid var(--gold);
  cursor: pointer;
  transition: box-shadow 0.2s;
}
.booking-card:active  { box-shadow: 0 2px 10px rgba(0,0,0,0.12); }
.booking-card.evening { border-right-color: var(--blue-dot); }
.booking-card.both    { border-right-color: var(--red); }

.booking-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.booking-customer { font-size: 15px; font-weight: 700; }
.booking-badge    { font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.badge-morning    { background: #FFF8E1; color: #F57F17; }
.badge-evening    { background: #E3F2FD; color: #1565C0; }
.badge-both       { background: var(--red-light); color: var(--red); }

.booking-meta { font-size: 12px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 8px; }
.booking-meta span { display: flex; align-items: center; gap: 3px; }

/* Add Booking Form */
.add-form { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* Settings */
.settings-block {
  background: #fafafa;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.settings-block h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.price-type-label { font-size: 13px; font-weight: 700; color: var(--red); margin: 14px 0 6px; padding-bottom: 5px; border-bottom: 1px solid var(--border); }
.price-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.price-table-head { display: grid; grid-template-columns: 80px 1fr 1fr; gap: 6px; text-align: center; font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.price-table-row  { display: grid; grid-template-columns: 80px 1fr 1fr; gap: 6px; align-items: center; margin-bottom: 6px; }
.price-row-name   { font-size: 12px; font-weight: 600; color: var(--text); }
.price-table-row .settings-input { margin-bottom: 0; padding: 8px 6px; font-size: 13px; text-align: center; }

.settings-input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  width: 100%;
  font-family: 'Tajawal', sans-serif;
  font-size: 15px;
  text-align: right;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 10px;
}
.settings-input:focus { border-color: var(--red); }

.pool-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   EMPTY STATE & MISC
   ============================================================ */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  opacity: 0;
  transition: all 0.3s;
  z-index: 999;
  white-space: nowrap;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spacer { height: 16px; }
.spacer-sm { height: 8px; }

/* ============================================================
   RESPONSIVE — on desktop, center the mobile shell
   ============================================================ */
@media (min-width: 500px) {
  body { background: #222; display: flex; align-items: center; justify-content: center; }
  #app { border-radius: 32px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
}
