/* UFC GYM Brand Identity — Palette from Brand Guide v2.0 */
:root {
  --ufc-red: #E81D2D;
  --ufc-red-dark: #C41222;
  --ufc-black: #0A0A0A;
  --ufc-ink: #111111;
  --ufc-white: #FFFFFF;
  --ufc-gold: #D2AE4B;
  --ufc-blue: #14416A;
  --ufc-grey: #CCCCCC;
  --ufc-grey-dark: #6B6B6B;
  --ufc-surface: #F5F5F5;
  --ufc-panel: #FFFFFF;
  --ufc-line: #E2E2E2;
  --radius: 4px;
  --font-display: "Oswald", "Cairo", "Segoe UI", sans-serif;
  --font-body: "Barlow", "Cairo", "Segoe UI", Tahoma, sans-serif;
}

body.app-body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(232, 29, 45, 0.04), transparent 220px),
    var(--ufc-surface);
  color: var(--ufc-ink);
  font-family: var(--font-body);
}

h1, h2, .page-title, .admin-page-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.shell.collapsed {
  grid-template-columns: 0 1fr;
}

.shell.collapsed .sidebar {
  overflow: hidden;
  padding: 0;
  border: 0;
}

.sidebar {
  background: var(--ufc-black);
  color: var(--ufc-white);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-inline-end: 3px solid var(--ufc-red);
}

.brand {
  padding: 0.25rem 0.4rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-logo {
  display: block;
  height: 42px;
  width: auto;
  max-width: 180px;
  margin-bottom: 0.45rem;
}

.brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand span {
  color: var(--ufc-grey);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar nav {
  display: grid;
  gap: 0.25rem;
}

.sidebar a {
  color: #E8E8E8;
  text-decoration: none;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius);
  font-weight: 500;
  border-inline-start: 3px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sidebar a.active {
  background: rgba(232, 29, 45, 0.18);
  border-inline-start-color: var(--ufc-red);
  color: #fff;
}

.sidebar a.admin-link {
  margin-top: 0.85rem;
  border: 1px solid rgba(210, 174, 75, 0.45);
  color: var(--ufc-gold);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: var(--ufc-white);
  border-bottom: 2px solid var(--ufc-black);
}

.topbar-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.content {
  padding: 1.35rem;
}

.panel {
  background: var(--ufc-panel);
  border: 1px solid var(--ufc-line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  border-top: 3px solid var(--ufc-red);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
}

.stat-card {
  background: var(--ufc-panel);
  border: 1px solid var(--ufc-line);
  border-radius: var(--radius);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--ufc-red);
}

.stat-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--ufc-black);
  font-style: italic;
}

.stat-card span {
  color: var(--ufc-grey-dark);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.quick-links a {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  background: var(--ufc-black);
  color: #fff !important;
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.quick-links a:hover {
  background: var(--ufc-red);
}

.app-footer {
  margin-top: auto;
  padding: 0.85rem 1.25rem;
  color: var(--ufc-grey-dark);
  border-top: 1px solid var(--ufc-line);
  font-size: 0.85rem;
}

/* Auth / Login */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background:
    radial-gradient(circle at 20% 20%, rgba(232, 29, 45, 0.35), transparent 42%),
    radial-gradient(circle at 80% 80%, rgba(210, 174, 75, 0.18), transparent 40%),
    linear-gradient(160deg, #0A0A0A 0%, #1A1A1A 55%, #2A0A0D 100%);
}

.auth-card {
  width: min(440px, 100%);
  background: var(--ufc-white);
  border: 0;
  border-radius: var(--radius);
  padding: 1.5rem;
  border-top: 4px solid var(--ufc-red);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.auth-card .auth-brand {
  text-align: center;
  margin-bottom: 1.25rem;
}

.auth-card .auth-brand img {
  height: 52px;
  width: auto;
}

.auth-card .auth-brand p {
  margin: 0.55rem 0 0;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--ufc-grey-dark);
}

.btn-success,
.btn-primary {
  --bs-btn-bg: var(--ufc-red);
  --bs-btn-border-color: var(--ufc-red);
  --bs-btn-hover-bg: var(--ufc-red-dark);
  --bs-btn-hover-border-color: var(--ufc-red-dark);
  --bs-btn-active-bg: var(--ufc-red-dark);
  --bs-btn-active-border-color: var(--ufc-red-dark);
  border-radius: var(--radius) !important;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-dark {
  --bs-btn-bg: var(--ufc-black);
  --bs-btn-border-color: var(--ufc-black);
  border-radius: var(--radius) !important;
}

.btn-warning {
  --bs-btn-bg: var(--ufc-gold);
  --bs-btn-border-color: var(--ufc-gold);
  --bs-btn-color: #111;
  --bs-btn-hover-color: #111;
  border-radius: var(--radius) !important;
}

.btn-outline-primary {
  --bs-btn-color: var(--ufc-red);
  --bs-btn-border-color: var(--ufc-red);
  --bs-btn-hover-bg: var(--ufc-red);
  --bs-btn-hover-border-color: var(--ufc-red);
  border-radius: var(--radius) !important;
}

.line-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--ufc-line);
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 88vw);
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  html[dir="rtl"] .sidebar {
    inset: 0 0 0 auto;
    transform: translateX(105%);
  }

  .shell.mobile-open .sidebar {
    transform: translateX(0);
  }

  .shell.mobile-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 35;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 25;
    padding: 0.65rem 0.75rem;
    padding-top: max(0.65rem, env(safe-area-inset-top));
    gap: 0.5rem;
    flex-wrap: nowrap;
  }

  .topbar #sidebarToggle {
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
  }

  .topbar-actions {
    gap: 0.4rem;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
  }

  .topbar-actions .user-email {
    display: none;
  }

  .topbar-actions .btn {
    min-height: 40px;
    padding-inline: 0.55rem;
    font-size: 0.8rem;
  }

  .content {
    padding: 0.85rem 0.75rem 5.5rem;
  }

  .panel {
    padding: 0.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-responsive {
    margin: 0 -0.15rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    font-size: 0.88rem;
  }

  .table th,
  .table td {
    white-space: nowrap;
    vertical-align: middle;
  }

  .table .contact-name {
    white-space: normal;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .stat-card {
    padding: 0.75rem;
  }

  .stat-card strong {
    font-size: 1.35rem;
  }

  .quick-links {
    gap: 0.5rem;
  }

  .quick-links a {
    flex: 1 1 calc(50% - 0.5rem);
    text-align: center;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  h1, .page-title {
    font-size: 1.25rem;
    line-height: 1.25;
  }

  .form-control,
  .form-select,
  .btn {
    min-height: 44px;
    font-size: 16px !important; /* prevent iOS zoom */
  }

  .btn-sm {
    min-height: 38px;
  }

  .d-flex.gap-2,
  .admin-toolbar,
  .search-box {
    flex-wrap: wrap !important;
  }

  .search-box {
    width: 100%;
  }

  .search-box .form-control,
  .search-box .form-select {
    flex: 1 1 100%;
    max-width: 100% !important;
  }

  .action-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .line-row {
    grid-template-columns: 1fr;
  }

  .auth-wrap {
    padding: max(1rem, env(safe-area-inset-top)) 0.85rem max(1rem, env(safe-area-inset-bottom));
  }

  .auth-card {
    padding: 1.15rem;
  }

  .contact-icon {
    width: 36px;
    height: 36px;
  }

  .app-footer {
    padding: 0.75rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .quick-links a {
    flex: 1 1 100%;
  }
}

/* Touch-friendly base */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.app-body {
  overflow-x: hidden;
}

img, svg {
  max-width: 100%;
  height: auto;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}


.contact-name {
  margin-inline-end: 0.35rem;
}

.contact-links {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  vertical-align: middle;
}

.contact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  text-decoration: none;
  border: 1px solid var(--ufc-line);
  background: #fff;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.contact-icon.contact-email {
  color: var(--ufc-blue);
}

.contact-icon.contact-wa {
  color: #128C7E;
}

.contact-icon:hover:not(.is-disabled) {
  border-color: currentColor;
  background: rgba(0, 0, 0, 0.03);
}

.contact-icon.is-disabled {
  opacity: 0.28;
  cursor: not-allowed;
  color: var(--ufc-grey-dark);
}

