/* PADELPRO product UI layer — shared visual contract for every module. */
:root {
  --primary: #087f5b;
  --primary-dark: #056247;
  --primary-light: #e9f8f1;
  --secondary: #15261f;
  --secondary-light: #263c33;
  --bg-page: #f4f7f5;
  --bg-card: #fff;
  --text-main: #24312c;
  --text-muted: #60716a;
  --text-light: #82918b;
  --border: #dce5e1;
  --border-focus: #75c9aa;
  --success: #087f5b;
  --warning: #b86a00;
  --danger: #c63e3e;
  --info: #2765a8;
  --shadow-sm: 0 1px 2px rgba(21, 38, 31, .04);
  --shadow-md: 0 8px 24px rgba(21, 38, 31, .07);
  --shadow-lg: 0 18px 48px rgba(21, 38, 31, .11);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --content-wide: 1280px;
  --control-height: 44px;
  --focus-ring: 0 0 0 3px rgba(8, 127, 91, .2);
}

body {
  color: var(--text-main);
  background: radial-gradient(circle at 10% -10%, rgba(8, 127, 91, .055), transparent 28rem), var(--bg-page);
}
.container, .header-container { max-width: var(--content-wide); }
.view-section { min-width: 0; }
.courts-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.court-card { min-width: 0; }
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

.header {
  height: 68px;
  background: rgba(255, 255, 255, .92);
  border-color: rgba(209, 222, 216, .9);
  box-shadow: 0 1px 0 rgba(21, 38, 31, .03);
}
.logo { letter-spacing: -.035em; }
.nav { gap: .25rem; }
.nav-link {
  min-height: 40px;
  padding: .55rem .75rem;
  border-radius: 9px;
  font-size: .86rem;
  font-weight: 650;
}
.nav-link.active { color: var(--primary-dark); background: var(--primary-light); }

.btn, .mini-btn, .action-btn {
  min-height: var(--control-height);
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: -.01em;
  touch-action: manipulation;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 5px 14px rgba(8, 127, 91, .16);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { color: var(--secondary); background: #fff; border-color: #cfdcd6; }
.btn-secondary:hover { color: var(--primary-dark); border-color: #9ebdaf; background: #f8fbf9; }
.btn:disabled, .mini-btn:disabled, .action-btn:disabled {
  cursor: not-allowed;
  opacity: .55;
  box-shadow: none;
}

.form-group { margin-bottom: 1rem; }
.form-group label, .lbl-dark {
  display: inline-block;
  margin-bottom: .4rem;
  color: var(--secondary);
  font-size: .79rem;
  font-weight: 750;
  letter-spacing: .01em;
}
.form-control, .input-light {
  min-height: var(--control-height);
  border: 1px solid #cfdcd6;
  border-radius: 10px;
  background: #fff;
  color: var(--text-main);
  font: inherit;
  line-height: 1.35;
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.form-control:hover, .input-light:hover { border-color: #aabdb4; }
.form-control:focus, .input-light:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.form-control::placeholder, .input-light::placeholder { color: #87958f; }
textarea.form-control, textarea.input-light { min-height: 104px; resize: vertical; }

.admin-grid {
  grid-template-columns: minmax(210px, 228px) minmax(0, 1fr);
  align-items: start;
  gap: 1.25rem;
}
.admin-sidebar {
  position: sticky;
  top: 84px;
  z-index: 8;
  max-height: calc(100dvh - 100px);
  overflow: auto;
  padding: .65rem;
  border-color: #d5e0db;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  scrollbar-width: thin;
}
.admin-menu { gap: .2rem; }
.admin-menu-btn {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: .62rem .7rem;
  border-radius: 9px;
  color: #52635c;
  font-size: .84rem;
  font-weight: 650;
  line-height: 1.25;
}
.admin-menu-btn:hover { background: #f2f7f4; color: var(--secondary); }
.admin-menu-btn.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  box-shadow: inset 3px 0 0 var(--primary);
}
.admin-sub-panel { min-width: 0; }

.admin-card, .profile-card, .wallet-card, .booking-summary-card, .match-card,
.court-card, .shop-card, .door-card, .health-card {
  border-color: #d9e3de;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.admin-card { margin-bottom: 1rem; overflow: clip; }
.admin-card-header {
  min-height: 58px;
  padding: .85rem 1rem;
  border-bottom: 1px solid #e5ece8;
  background: #fbfcfb;
  gap: .75rem;
}
.admin-card-header h3 { line-height: 1.2; letter-spacing: -.02em; }

.metrics-row, .kpi-money-grid { gap: .75rem; margin-bottom: 1rem; }
.metric-card, .kpi-money, .health-card {
  background: #fff;
  border: 1px solid #d9e3de;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.metric-card { min-width: 0; padding: 1rem; gap: .85rem; }
.metric-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 10px;
  font-size: 1.1rem;
}
.metric-info span, .kpi-money-label, .health-card-label { letter-spacing: .055em; font-size: .69rem; }
.metric-info strong, .kpi-money-num, .health-card-num {
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
}

.table-scroll, .shop-table-wrap, .admin-card > div[style*="overflow-x:auto"] {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .82rem;
}
.admin-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: .72rem .85rem;
  color: #586961;
  background: #f4f8f6;
  border-bottom: 1px solid #d9e3de;
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: .045em;
  text-transform: uppercase;
  white-space: nowrap;
}
.admin-table td {
  padding: .72rem .85rem;
  border-bottom: 1px solid #e8eeeb;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: 0; }

.app-subnav, .shop-admin-tabs, .sup-filters {
  gap: .35rem !important;
  padding: .3rem;
  border: 1px solid #d9e3de !important;
  border-radius: 12px;
  background: #edf3f0;
}
.app-subnav button, .shop-admin-tabs button, .sup-filters button {
  min-height: 40px;
  padding: .55rem .8rem;
  border: 0;
  border-radius: 9px;
  white-space: nowrap;
  font-weight: 700;
}
.app-subnav button.active, .app-subnav button.active-tab, .shop-admin-tabs button.active, .sup-filters button.active {
  color: var(--primary-dark);
  background: #fff;
  box-shadow: 0 1px 4px rgba(21, 38, 31, .11);
}

.modal-overlay {
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: rgba(15, 28, 23, .54);
  backdrop-filter: blur(5px);
}
.modal {
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}
.modal-header { padding: 1rem 1.15rem; border-bottom: 1px solid var(--border); }
.modal-body { padding: 1.15rem; }
.modal-close { min-width: 44px; min-height: 44px; border-radius: 10px; }
.toast {
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
[class*="empty"], [class*="loading"] { text-wrap: balance; }

@media (hover: hover) and (pointer: fine) {
  .admin-table tbody tr:hover td { background: #f7faf8; }
  .admin-card:hover, .metric-card:hover { border-color: #cbdad3; }
}

@media (max-width: 992px) {
  .admin-grid { grid-template-columns: minmax(0, 1fr); gap: .85rem; }
  .admin-sidebar {
    top: 68px;
    max-height: none;
    margin-inline: calc(var(--mobile-gutter) * -1);
    padding: .5rem var(--mobile-gutter);
    border-width: 1px 0;
    border-radius: 0;
    background: rgba(244, 247, 245, .96);
    backdrop-filter: blur(12px);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .admin-sidebar::-webkit-scrollbar { display: none; }
  .admin-menu { flex-direction: row; width: max-content; gap: .35rem; }
  .admin-menu-btn {
    flex: 0 0 auto;
    min-height: 40px;
    padding: .56rem .72rem;
    white-space: nowrap;
    overflow-wrap: normal;
    border: 1px solid #d7e2dd;
    background: #fff;
  }
  .admin-menu-btn.active { border-color: #9bcab7; box-shadow: inset 0 -3px 0 var(--primary); }
  #admin-reset-btn { margin-top: 0 !important; }
}

@media (max-width: 768px) {
  :root { --control-height: 48px; }
  .header { height: 64px; }
  .container, .header-container {
    padding-left: max(var(--mobile-gutter), env(safe-area-inset-left));
    padding-right: max(var(--mobile-gutter), env(safe-area-inset-right));
  }
  #view-admin > .container, #view-booking > .container {
    padding-top: 1.25rem !important;
    padding-bottom: 2rem !important;
  }
  #view-admin > .container > h2 { font-size: clamp(1.55rem, 7vw, 1.9rem) !important; }
  #view-admin > .container > p { margin-bottom: 1rem !important; line-height: 1.45; }
  .admin-sidebar { top: 64px; }
  .admin-card { border-radius: 12px; }
  .admin-card-header { align-items: stretch; padding: .85rem; }
  .admin-card-header > div { width: 100%; }
  .admin-card-header input[type="search"] { width: 100% !important; flex: 1 1 100%; }
  .metrics-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { align-items: flex-start; flex-direction: column; }
  .metric-info strong { font-size: 1.35rem; }
  .app-subnav, .shop-admin-tabs, .sup-filters {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    margin-inline: calc(var(--mobile-gutter) * -1);
    padding-inline: var(--mobile-gutter);
    border-inline: 0 !important;
    border-radius: 0;
    scrollbar-width: none;
  }
  .app-subnav::-webkit-scrollbar, .shop-admin-tabs::-webkit-scrollbar, .sup-filters::-webkit-scrollbar { display: none; }
  .modal { width: 100%; max-height: min(88dvh, 760px); border-radius: 18px 18px 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-body { padding-bottom: max(1.15rem, env(safe-area-inset-bottom)); }
  .toast { left: var(--mobile-gutter); right: var(--mobile-gutter); width: auto; }
}

@media (max-width: 420px) {
  .metrics-row { grid-template-columns: minmax(0, 1fr); }
  .metric-card { flex-direction: row; align-items: center; }
  .admin-card-header .btn { flex: 1 1 auto; }
}

@media (max-width: 600px) {
  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td { display: block; width: 100%; }
  .admin-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .admin-table tbody {
    display: grid;
    gap: .75rem;
    padding: .75rem;
    background: #f6f9f7;
  }
  .admin-table tbody tr {
    padding: .35rem .8rem;
    border: 1px solid #d9e3de;
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }
  .admin-table td {
    display: grid;
    grid-template-columns: minmax(7rem, .8fr) minmax(0, 1.2fr);
    gap: .75rem;
    min-height: 42px;
    padding: .65rem 0;
    overflow-wrap: anywhere;
    border-bottom: 1px solid #e8eeeb;
    text-align: right;
  }
  .admin-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .045em;
    text-align: left;
    text-transform: uppercase;
  }
  .admin-table td:last-child {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    border-bottom: 0;
  }
  .admin-table td:last-child::before { margin-right: auto; align-self: center; }
  .admin-table td .mini-btn,
  .admin-table td .btn { flex: 1 1 auto; min-width: 76px; }
}

@media (pointer: coarse) {
  .admin-menu-btn, .app-subnav button, .shop-admin-tabs button, .sup-filters button { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
