/* =====================================================================
   Members portal - app style (mobile first)
   Loaded after main.css. --mainColor / --darkerColor / --btnTextColor
   come from the gym's settings (see _LayoutClient / _Layout).
   ===================================================================== */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-muted: #f7f8fb;
  --border: #e7eaf0;
  --border-strong: #d5dae3;
  --text: #1b2230;
  --text-muted: #6b7385;
  --text-faint: #9aa1b0;
  --danger: #e5484d;
  --success: #2f9e44;
  --warning: #f08c00;

  --brand-soft: color-mix(in srgb, var(--mainColor) 12%, transparent);
  --brand-ring: color-mix(in srgb, var(--mainColor) 24%, transparent);

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 10px 30px -10px rgba(16, 24, 40, 0.18);

  --topbar-h: 60px;
  --tabbar-h: 66px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

body {
  color: var(--text);
  font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

a { color: var(--mainColor); }
a:hover { color: var(--darkerColor); text-decoration: none; }
.grey { color: var(--text-muted) !important; }
.primary { color: var(--mainColor) !important; }
.bg-light { background: var(--bg) !important; }

/* ---------- App shell ---------------------------------------------- */
.app_shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 1.25rem);
}

@media (min-width: 768px) {
  .app_shell { padding-bottom: 3rem; }
}

.app_topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}

.app_topbar .container-lg {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app_topbar .site_logo {
  height: 36px;
  width: auto;
  max-width: 110px;
  object-fit: contain;
  margin: 0;
}

.app_topbar .topbar_title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app_topbar .topbar_nav {
  display: none;
  gap: 0.25rem;
  margin-right: 1.5rem;
}

.app_topbar .topbar_nav a {
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
}

.app_topbar .topbar_nav a:hover { background: var(--surface-muted); color: var(--text); }
.app_topbar .topbar_nav a.active { background: var(--brand-soft); color: var(--mainColor); font-weight: 700; }

@media (min-width: 768px) {
  .app_topbar .topbar_nav { display: flex; }
  .app_topbar .topbar_title { display: none; }
}

.avatar_btn {
  margin-right: auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--brand-soft);
  color: var(--mainColor);
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app_content { padding-top: 1.25rem; }

@media (min-width: 768px) {
  .app_content { padding-top: 2rem; max-width: 960px; }
}

/* ---------- Bottom tab bar ----------------------------------------- */
.app_tabbar {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  z-index: 1030;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 6px calc(6px + var(--safe-bottom));
  display: flex;
  justify-content: space-around;
}

.app_tabbar a,
.app_tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 500;
  background: none;
  border: 0;
  text-decoration: none;
}

.app_tabbar .tab_icon {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background .2s, color .2s;
}

.app_tabbar a.active { color: var(--mainColor); font-weight: 700; }
.app_tabbar a.active .tab_icon { background: var(--brand-soft); color: var(--mainColor); }

@media (min-width: 768px) {
  .app_tabbar { display: none; }
}

/* WhatsApp button sits above the tab bar */
.fixed_whats {
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px) !important;
  left: 14px !important;
  right: auto !important;
  width: 52px !important;
  height: 52px !important;
  box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
  .fixed_whats { bottom: 24px !important; left: 24px !important; }
}

/* On phones WhatsApp lives in the quick actions and the account sheet, so it never covers a button */
@media (max-width: 767.98px) {
  .fixed_whats { display: none !important; }
}

.quick_grid a.whatsapp i { background: color-mix(in srgb, #25d366 14%, transparent); color: #1da851; }

/* ---------- Bottom sheet (account) --------------------------------- */
.modal.sheet .modal-dialog {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  margin: 0 auto;
  max-width: 520px;
  transform: translateY(100%);
  transition: transform .25s ease-out;
}

.modal.sheet.show .modal-dialog { transform: none; }

.modal.sheet .modal-content {
  border: 0;
  border-radius: 22px 22px 0 0;
  padding-bottom: var(--safe-bottom);
}

@media (min-width: 768px) {
  .modal.sheet .modal-dialog { bottom: auto; top: 15vh; }
  .modal.sheet .modal-content { border-radius: 22px; }
}

.sheet_handle {
  width: 44px;
  height: 5px;
  border-radius: 5px;
  background: var(--border-strong);
  margin: 10px auto 4px;
}

.sheet_profile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sheet_profile .avatar_btn { width: 54px; height: 54px; font-size: 1.35rem; margin: 0; }
.sheet_profile .name { font-weight: 700; font-size: 1.05rem; }
.sheet_profile .meta { color: var(--text-muted); font-size: 0.85rem; }

.sheet_links { padding: 0.5rem 0.75rem 0.75rem; }

.sheet_links a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.8rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500;
}

.sheet_links a:hover,
.sheet_links a:active { background: var(--surface-muted); }

.sheet_links a .link_icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.sheet_links a .fa-chevron-left { margin-right: auto; color: var(--text-faint); font-size: 0.8rem; }
.sheet_links a.danger { color: var(--danger); }
.sheet_links a.danger .link_icon { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }

/* ---------- Page heading ------------------------------------------- */
.page_head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.page_head h1,
.page_head h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
}

.page_head p { margin: 0.15rem 0 0; color: var(--text-muted); font-size: 0.88rem; }
.page_head .main_btn { margin-right: auto; }

.section_label {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1.5rem 0 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- Cards & lists ------------------------------------------ */
.card,
.blocked_el,
.app_card {
  background: var(--surface);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
}

.blocked_el { padding: 1.25rem; }

.hero_card {
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.25rem 1.1rem;
  color: var(--btnTextColor, #fff);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255, 255, 255, 0.18), transparent 55%),
    linear-gradient(135deg, var(--mainColor), var(--darkerColor));
  box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--mainColor) 80%, transparent);
  position: relative;
  overflow: hidden;
}

.hero_card .hello { font-size: 0.9rem; opacity: 0.85; }
.hero_card .name { font-size: 1.35rem; font-weight: 700; margin: 0.1rem 0 0.35rem; }
.hero_card .meta { font-size: 0.85rem; opacity: 0.85; }
.hero_card .hero_icon { position: absolute; left: -12px; bottom: -18px; font-size: 6.5rem; opacity: 0.12; }

.quick_grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-top: 1rem;
}

.quick_grid a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 0.25rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.quick_grid a i {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--mainColor);
  font-size: 1.05rem;
}

.quick_grid a:active { transform: scale(0.97); }

.list_card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  margin-bottom: 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

a.list_card:hover { color: var(--text); border-color: var(--border-strong); }
a.list_card:active { transform: scale(0.99); }

.list_card .lead_icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--mainColor);
  font-size: 1.1rem;
}

.list_card .body { flex: 1; min-width: 0; }
.list_card .title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list_card .meta { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }
.list_card .trail { text-align: left; flex-shrink: 0; }
.list_card .amount { font-weight: 700; font-size: 1.05rem; }
.list_card .amount small { color: var(--text-muted); font-weight: 500; font-size: 0.72rem; }

.list_card.stacked { flex-wrap: wrap; }
.list_card .actions {
  width: 100%;
  display: flex;
  gap: 0.5rem;
  padding-top: 0.75rem;
  margin-top: 0.15rem;
  border-top: 1px dashed var(--border);
}

.list_card .actions .btn,
.list_card .actions a {
  flex: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.chip.success { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.chip.danger { background: color-mix(in srgb, var(--danger) 11%, transparent); color: var(--danger); }
.chip.warning { background: color-mix(in srgb, var(--warning) 14%, transparent); color: #b86200; }

.empty_block {
  text-align: center;
  padding: 2.5rem 1.25rem;
  color: var(--text-muted);
}

.empty_block img { width: 140px; max-width: 50%; margin-bottom: 1rem; opacity: 0.9; }
.empty_block h3 { font-size: 1.05rem; font-weight: 700; color: var(--text); }

/* ---------- Buttons ------------------------------------------------ */
.main_btn,
.gradient_btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 46px;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm) !important;
  border: 0;
  background: var(--mainColor) !important;
  color: var(--btnTextColor, #fff) !important;
  font-weight: 700;
  font-size: 0.98rem;
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--mainColor) 80%, transparent);
  transition: background .15s, transform .05s;
}

.main_btn:hover,
.gradient_btn:hover { background: var(--darkerColor) !important; color: var(--btnTextColor, #fff) !important; }
.main_btn:active { transform: scale(0.98); }
.main_btn.small_btn { min-height: 38px; padding: 0.3rem 0.85rem; font-size: 0.88rem; }
.main_btn.danger { background: var(--danger) !important; box-shadow: none; }

.ghost_btn,
.transparent_btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  font-size: 0.9rem;
}

.ghost_btn:hover,
.transparent_btn:hover { background: var(--surface-muted); color: var(--text); }
.ghost_btn.brand { color: var(--mainColor); border-color: color-mix(in srgb, var(--mainColor) 40%, transparent); }

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success {
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.9rem !important;
  font-weight: 500;
}

/* ---------- Forms -------------------------------------------------- */
.form_control,
.form-control {
  background: var(--surface) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-sm) !important;
  min-height: 48px;
  padding: 0.65rem 0.85rem !important;
  font-size: 16px !important; /* prevents iOS zoom on focus */
  color: var(--text);
  box-shadow: none;
}

.form_control:focus,
.form-control:focus {
  outline: 0;
  border-color: var(--mainColor) !important;
  box-shadow: 0 0 0 4px var(--brand-ring) !important;
}

.form_line { display: none !important; }
.input_group i { color: var(--text-faint); }
.input_group label,
label.medium_font { font-weight: 600; font-size: 0.88rem; color: var(--text); margin-bottom: 0.4rem; }

.select2-container .select2-selection--single {
  min-height: 48px;
  height: 48px;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-sm) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 46px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 46px; }
.select2-container--open .select2-selection { border-color: var(--mainColor) !important; }
.select2-dropdown { border-color: var(--border) !important; border-radius: var(--radius-sm) !important; overflow: hidden; }

/* Appointment choices (radio cards) */
.checkbox_block {
  display: flex !important;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.9rem 1rem !important;
  margin: 0;
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius) !important;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.checkbox_block.active,
.checkbox_block:has(input:checked) {
  border-color: var(--mainColor) !important;
  background: color-mix(in srgb, var(--mainColor) 6%, var(--surface));
}

.slot_time_box {
  min-width: 58px;
  padding: 0.4rem 0.3rem;
  border-radius: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  text-align: center;
  font-weight: 700;
  line-height: 1.15;
}

.slot_time_box small { display: block; font-weight: 500; font-size: 0.7rem; color: var(--text-muted); }
.checkbox_block .slot_info { flex: 1; min-width: 0; }
.checkbox_block .slot_name { font-weight: 700; }
.checkbox_block .slot_meta { font-size: 0.8rem; color: var(--text-muted); }
.checkbox_block .seats { font-size: 0.78rem; white-space: nowrap; }

.checkbox_block .radio_circle {
  position: static !important;
  flex-shrink: 0;
  width: 22px !important;
  height: 22px !important;
  margin: 0 !important;
  border-color: var(--border-strong) !important;
}

.checkbox_block.active .radio_circle,
.checkbox_block:has(input:checked) .radio_circle { border-color: var(--mainColor) !important; }

.sticky_action {
  position: sticky;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px);
  z-index: 5;
}

@media (min-width: 768px) {
  .sticky_action { bottom: 16px; }
}

/* Countdown (markup from countdown.js) */
.countdown {
  display: grid !important;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0.5rem;
  font-family: inherit;
}

.countdown > div,
.countdown .countdown-container {
  margin: 0 !important;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem 0.25rem;
  display: flex !important;
  flex-direction: column-reverse;
  align-items: center;
}

.countdown > div span:last-of-type,
.countdown .countdown-value {
  border: 0 !important;
  border-radius: 0 !important;
  width: auto !important;
  height: auto !important;
  line-height: 1.2 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  text-shadow: none !important;
  font-size: 1.4rem !important;
  font-weight: 700;
  color: var(--mainColor) !important;
}

.countdown .countdown-heading { font-size: 0.72rem !important; color: var(--text-muted) !important; margin: 0 !important; }

/* Tables (desktop details pages) */
.table thead th {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-top: 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td { vertical-align: middle; border-top: 1px solid var(--border); }

/* Pagination */
.pagination { gap: 0.3rem; justify-content: center; margin: 1rem 0; }
.pagination .page-link {
  border-radius: var(--radius-sm) !important;
  min-width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin: 0 !important;
}
.pagination .page-item.active .page-link { background: var(--mainColor); border-color: var(--mainColor); color: var(--btnTextColor, #fff); }

/* Modals */
.modal-content { border: 0; border-radius: var(--radius-lg); }
.modal-header, .modal-footer { border-color: var(--border); }

/* Measures */
.measure-block {
  border-radius: var(--radius) !important;
  padding: 1rem !important;
}

.measure-block img { width: 52px; opacity: 0.8; }

/* ---------- Login / register --------------------------------------- */
.login_wrapper {
  background-size: cover;
  background-position: center;
  position: relative;
}

.login_wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--mainColor) 55%, #000 45%) 0%, rgba(0, 0, 0, 0.55) 100%);
}

.login_wrapper > .container-lg { position: relative; z-index: 1; }

.login_wrapper .bg-white {
  border-radius: 24px !important;
  overflow: hidden;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.45) !important;
}

.login_wrapper .site_logo { height: 64px; width: auto; max-width: 160px; object-fit: contain; margin-top: 1.5rem !important; }

.login_wrapper .nav-tabs {
  margin: 0.5rem 1.5rem 0;
  padding: 4px;
  background: var(--surface-muted);
  border: 1px solid var(--border) !important;
  border-radius: 999px;
}

.login_wrapper .nav-tabs li { flex: 1; }

.login_wrapper .nav-tabs .nav-link {
  border: 0 !important;
  border-radius: 999px !important;
  padding: 0.6rem 0 !important;
  color: var(--text-muted) !important;
  font-weight: 600;
  text-align: center;
  background: transparent !important;
}

.login_wrapper .nav-tabs .nav-link.active {
  background: var(--surface) !important;
  color: var(--text) !important;
  box-shadow: var(--shadow-sm);
}

.login_wrapper .tab-content form { padding: 1.5rem !important; }

.login_welcome {
  color: #fff;
  text-align: center;
  padding: 2.5rem 1rem 1rem;
}

.login_welcome h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 0.35rem; }
.login_welcome p { margin: 0; opacity: 0.85; font-size: 0.95rem; }

@media (max-width: 575.98px) {
  .login_wrapper { justify-content: flex-end !important; }
  .login_wrapper .col-md-5 { padding: 0; }
  .login_wrapper .bg-white {
    margin: 0 !important;
    border-radius: 28px 28px 0 0 !important;
    padding-bottom: var(--safe-bottom);
  }
}

/* Loader */
.ajax_loader { background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(2px); }
