/* =========================================
   PadelPro – App Styles
   Brand: #0089bd
   ========================================= */

/* -------- CSS Variables (Theme) -------- */
:root{
  /* Safe areas */
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --appbar-height: calc(48px + var(--safe-top, 0px));
  --tabbar-height: 78px;
  --tabbar-gap: 12px;
  --tabbar-reserve: calc(var(--tabbar-height) + var(--tabbar-gap) + var(--safe-bottom, 0px));

  /* Brand palette */
  --brand: #0089bd;
  --brand-600: #0079a8;
  --brand-700: #026c96;

  /* Neutrals / text */
  --ink: #0b2c3a;       /* headings / strong */
  --text: #1e293b;      /* body text */
  --muted: #6b7a86;     /* secondary text */

  /* Surfaces */
  --bg: #f7f7fb;        /* app background */
  --card: #ffffff;      /* cards / sheets */
  --divider: #e6eaf1;

  /* Accents / states */
  --success: #2ecc71;
  --warning: #f4a100;
  --danger:  #e03131;

  /* Effects */
  --ring: rgba(0,137,189,.35);
  --soft-shadow: 0 6px 20px rgba(11,44,58,.08);
  --soft-shadow-hover: 0 10px 26px rgba(11,44,58,.12);
  --radius: 16px;
}

/* -------- Base / Reset -------- */
html, body { height: 100%; }
body{
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* reserve space so fixed bottom tabbar never covers content */
  padding-bottom: 0;
}

img{ max-width: 100%; height: auto; }

/* Smooth but considerate animations */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* -------- App Bar (Header) -------- */
.appbar{
  position: sticky; top: 0; z-index: 1030;
  background: var(--brand); color: #fff;
  min-height: var(--appbar-height);
  padding: calc(6px + var(--safe-top,0)) 12px 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.appbar .logo{ height: 26px; }
.appbar .icon-btn{
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 8px; color: #fff;
}
.appbar .icon-btn:hover{ background: rgba(255,255,255,.08); }

/* -------- Offcanvas (Left Menu) -------- */
.offcanvas.offcanvas-start{
  width: 72% !important;
  background-color: #008bbe;
  color: #fff;
  border-right: 0;
  top: var(--appbar-height);
  height: calc(100dvh - var(--appbar-height));
  padding-top: 0;
}
.offcanvas-start .offcanvas-header{
  min-height: 56px;
  padding-top: .75rem;
  padding-bottom: .75rem;
}
.offcanvas-backdrop.show{
  top: var(--appbar-height);
  height: calc(100dvh - var(--appbar-height));
}
.offcanvas-header .btn-close{
  filter: invert(1) grayscale(1) brightness(2);
  opacity: .9;
}
.menu-list a{
  background-color: #0089bd;
  color: #fff;
  border: none !important;
}
.menu-list a:hover,
.offcanvas .list-group-item.active,
.offcanvas .list-group-item:focus{
  background: #007faa;
  color: #fff;
}

/* -------- Hero / Carousel -------- */
.hero-card{
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.carousel-caption{
  left:0; right:0; bottom:0;
  background: linear-gradient(180deg,transparent,rgba(0,0,0,.65));
  padding: 2.5rem 1rem 1rem;
}
.carousel-caption h5{ font-weight: 800; }

/* -------- Sections / Utilities -------- */
.section-title{ font-weight: 700; color: var(--ink); }
.pb-65 { padding-bottom: 65px; }

/* Routing utility */
.route{ display: none; }
.route.active{ display: block; }

/* -------- Tabs (Bottom) -------- */
.tabbar{
  position: fixed; left: 10px; right: 10px; bottom: 8px;
  z-index: 1020;
  background: #fff;
  border-top: 1px solid var(--divider);
  border-radius: 24px;
  min-height: var(--tabbar-height);
  box-shadow: 0 6px 24px rgba(0,0,0,.06);
}
.tabbar .nav{
  min-height: var(--tabbar-height);
  align-items: stretch;
}
.tabbar .nav-item{
  display: flex;
}
.tabbar .nav-link{
  color: #6c778c;
  font-size: .82rem;
  padding: .2rem 0 .12rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  flex: 1 1 auto;
  height: 100%;
  line-height: 1.1;
}
.tabbar .nav-link.active{ color: var(--brand); }
.tabbar .bi{
  font-size: 1.2rem;
  width: 1.25em;
  height: 1.25em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin: 0;
}
.tabbar .bi::before{
  display: block;
  line-height: 1;
  vertical-align: 0;
}

/* -------- Cards -------- */
.card{
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid #f1f3f8;
  box-shadow: var(--soft-shadow);
}
.card:hover{ box-shadow: var(--soft-shadow-hover); }

/* -------- Buttons (Brand) -------- */
.btn-brand{
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 12px;
  font-weight: 600;
}
.btn-brand:hover{ background: var(--brand-600); color:#fff; }
.btn-outline-brand{
  border-color: var(--brand);
  color: var(--brand);
  border-radius: 12px;
  font-weight: 600;
}
.btn-outline-brand:hover{
  background: var(--brand);
  color: #fff;
}

/* Focus ring */
.btn:focus,
.form-control:focus,
.btn-brand:focus,
.btn-outline-brand:focus{
  box-shadow: 0 0 0 .2rem var(--ring);
  outline: 0;
}

/* -------- Forms -------- */
.form-control{
  border-radius: 12px;
  border-color: #e5eaf2;
}
.form-control:focus{
  border-color: var(--brand);
}

/* -------- Badges (Soft) -------- */
.badge-soft-success{
  background: rgba(46,204,113,.16);
  color:#1f8b4f;
  border:1px solid rgba(46,204,113,.25);
}
.badge-soft-danger{
  background: rgba(224,49,49,.14);
  color:#a32525;
  border:1px solid rgba(224,49,49,.22);
}
.badge-soft-secondary{
  background: rgba(108,117,125,.12);
  color:#6c757d;
  border:1px solid rgba(108,117,125,.18);
}

/* -------- Alerts (brand tune) -------- */
.alert{ border-radius: 14px; }
.alert-info{ border-color: rgba(0,137,189,.15); background: rgba(0,137,189,.06); color:#0b5167; }
.alert-warning{ background: rgba(244,161,0,.1); border-color: rgba(244,161,0,.24); color: #915e03; }
.alert-danger{ background: rgba(224,49,49,.08); border-color: rgba(224,49,49,.18); color: #7b1f1f; }

/* -------- Slot Result Cards -------- */
.slot-card .title{ font-weight: 700; color: var(--ink); }
.slot-card .meta{ color: var(--muted); font-size: .92rem; }
.slot-card .pay{ min-width: 132px; }

/* Availability badges on Home */
.badge-availability{ border: 1px solid; }
.badge-good{
  background: rgba(46,204,113,.16);
  color:#1f8b4f;
  border-color: rgba(46,204,113,.25);
}
.badge-limited{
  background: rgba(244,161,0,.14);
  color:#8b6408;
  border-color: rgba(244,161,0,.25);
}
.badge-full{
  background: rgba(224,49,49,.12);
  color:#a32525;
  border-color: rgba(224,49,49,.22);
}

/* -------- Loading Skeletons -------- */
.skel{
  border-radius: 10px; height: 64px;
  background: linear-gradient(90deg, #f0f3f8 25%, #e6ecf3 37%, #f0f3f8 63%);
  background-size: 400% 100%;
  animation: shine 1.2s infinite linear;
  margin-bottom: .5rem;
}
@keyframes shine{ 0%{background-position: 100% 0} 100%{background-position: 0 0} }

/* -------- Toasts (top-right) -------- */
#toastWrap{
  position: fixed;
  top: calc(12px + var(--safe-top, 0));
  right: 12px;
  z-index: 1080;
}

/* -------- Responsive Tweaks -------- */
@media (max-width: 576px){
  .appbar{ padding: calc(6px + var(--safe-top,0)) 10px 6px; }
  .slot-card .title{ font-size: 1rem; }
  .slot-card .meta{ font-size: .9rem; }
}

@media (max-width: 991.98px){
  :root{
    /* Android WebView often reports 0 for safe-area; keep content below status bar */
    --safe-top: max(env(safe-area-inset-top), 24px);
  }
  body{
    padding-bottom: max(var(--tabbar-reserve), 140px);
  }
  .pb-65{
    padding-bottom: max(var(--tabbar-reserve), 140px) !important;
  }
}

body.drawer-open .tabbar{
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 992px){
  .offcanvas-start{ width: 360px !important; }
  body{ padding-bottom: 0; }
}

/* ===== Slot card – pro layout */
.slot-card {
  border: 1px solid #e8eff5;
  border-radius: 16px;
  box-shadow: var(--soft-shadow);
  transition: box-shadow .2s ease, transform .06s ease;
}
.slot-card:hover { box-shadow: var(--soft-shadow-hover); }

.slot-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 16px 12px;
}

.slot-title {
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  margin: 0 0 6px;
}

.slot-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: .92rem;
}

.meta-dot { width: 4px; height: 4px; border-radius: 50%; background: #c9d5e1; align-self:center; }

.badge-soft-success,
.badge-soft-danger {
  border-radius: 10px;
  padding: .18rem .5rem;
  font-weight: 600;
  font-size: .78rem;
}
.badge-soft-success { background: rgba(46,204,113,.16); color:#1f8b4f; border:1px solid rgba(46,204,113,.25); }
.badge-soft-danger  { background: rgba(220,53,69,.14); color:#b02a37; border:1px solid rgba(220,53,69,.22); }

.slot-cta { text-align: right; min-width: 132px; }
.slot-btn { display: block; width: 140px; }
.price-sub { font-size: .78rem; opacity: .85; }

/* Disabled/Booked look */
.slot-card.booked { opacity: .75; }
.slot-card.booked .slot-btn { pointer-events: none; opacity: .6; }

/* Tiny helpers */
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }

/* Compact on small screens */
@media (max-width: 420px){
  .slot-row { grid-template-columns: 1fr; }
  .slot-cta { text-align: left; }
  .slot-btn { width: 100%; }
}

/* Button loading state */
.btn-loading {
  pointer-events: none;
  position: relative;
  opacity: .9;
}
.btn-loading .spinner {
  display: inline-block;
  width: 1rem; height: 1rem;
  border: .15rem solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-right: .5rem;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Results skeletons */
.skel-card {
  border-radius: 16px;
  height: 88px;
  background:
    linear-gradient(100deg, #eef3f8 40%, #e6edf5 50%, #eef3f8 60%)
    #eef3f8;
  background-size: 200% 100%;
  animation: shimmer 1.1s infinite linear;
  margin-bottom: 12px;
  box-shadow: var(--soft-shadow);
}
@keyframes shimmer { from { background-position: right } to { background-position: left } }

/* Enter animation for real results */
.fade-in-up {
  animation: fadeInUp .28s ease-out both;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px) }
  to   { opacity: 1; transform: translateY(0) }
}

#nextAvailCard .title { font-weight: 700; }
#nextAvailCard .meta  { color: var(--muted); font-size: .92rem; }

/* generic inline spinner (no Bootstrap dependency) */
.btn-spinner, .spinner {
  width: 1rem; height: 1rem; border: .15rem solid currentColor;
  border-right-color: transparent; border-radius: 50%;
  display: inline-block; vertical-align: -2px; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* unified loading state */
.is-loading { pointer-events: none; opacity: .9; }
.btn-loader { display: inline-grid; place-items: center; margin-left: .5rem; }
.btn-loader.d-none { display: none; }
