/* =========================================
   Stripe-Inspired Golf Course Management
   Modern, Clean, Professional Styling
   ========================================= */

/* CSS Custom Properties - Stripe's Design Tokens */
:root {
  /* Primary Colors - Stripe's signature palette */
  --stripe-indigo: #0154A6;
  --stripe-indigo-light: #0154A6;
  --stripe-indigo-dark: #4f46e5;
  --stripe-cyan: #00d4ff;
  
  /* Neutrals */
  --stripe-slate-900: #0a2540;
  --stripe-slate-700: #425466;
  --stripe-slate-500: #697386;
  --stripe-slate-400: #8792a2;
  --stripe-slate-300: #a3acb9;
  --stripe-slate-200: #c1c9d2;
  --stripe-slate-100: #e3e8ee;
  --stripe-slate-50: #f6f9fc;
  --stripe-white: #ffffff;
  
  /* Functional Colors */
  --success: #30d158;
  --warning: #ff9f0a;
  --danger: #ff453a;
  
  /* Shadows - Stripe's signature layered shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-focus: 0 0 0 3px rgba(99, 91, 255, 0.25);
  
  /* Typography */
  --font-display: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-xxl: 4rem;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   Base Reset & Typography
   ========================================= */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--stripe-slate-700);
  background: linear-gradient(135deg, var(--stripe-slate-50) 0%, #eef2f7 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =========================================
   Layout Containers
   ========================================= */

.ast-article-single {
  max-width: 800px;
  margin: var(--space-2xl) auto;
  padding: 0 var(--space-lg);
}

.entry-header {
  margin-bottom: var(--space-xl);
  text-align: left;
}

.entry-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--stripe-slate-900);
  letter-spacing: -0.025em;
  margin: 0;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--stripe-slate-100);
}

.entry-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

/* =========================================
   Handicap Section & User Greeting
   ========================================= */

.handicap-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.user-greeting {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  justify-content: center;
}

.user-greeting .user-avatar {
  width: 80px;
  height: 80px;
  padding: 8px;
  border-radius: 50%;
  object-fit: contain;
  border: 2px solid var(--stripe-indigo);
  box-shadow: var(--shadow-md);
}

.user-greeting .user-name {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--stripe-indigo);
  display: inline-block;
}

/* =========================================
   Handicap Cards
   ========================================= */

.handicap-cards {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg) !important;
  align-content: center;
  justify-content: center;
  text-align: center;
}

.handicap-cards h5 {
  flex: 1;
  min-width: 280px;
  max-width: 380px;
  margin: 0;
  padding: var(--space-xl);
  background: var(--stripe-white);
  border-radius: var(--radius-lg);
  border-top: 4px solid var(--stripe-indigo);
  box-shadow: var(--shadow-lg);
  font-family: 'Garamond-Premier-Pro-Display',garamond-premier-pro-display,serif;
  font-size: 1.85rem;
  font-weight: 300;
  color: var(--stripe-slate-900);
  position: relative;
}

.handicap-cards h5 small {
  display: block;
  margin-top: var(--space-sm);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--stripe-slate-500);
  font-style: normal;
}

.handicap-cards h5 small i {
  font-style: italic;
}

.handicap-cards h5 .score{
    font-size: 1.5rem;
    font-family: var(--font-display);
}

.handicap-cards h5:not(.handicap-card-disabled) .score{
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--stripe-indigo);
}

.handicap-cards h5 .fa-trophy {
  color: var(--warning);
  margin-left: var(--space-sm);
}

/* Ensure active cards are not affected */
.handicap-cards h5:not(.handicap-card-disabled) {
  opacity: 1;
  background: var(--stripe-white);
  border-top-color: var(--stripe-indigo);
  color: var(--stripe-slate-900);
}

/* =========================================
   Disabled Handicap Cards
   ========================================= */

.handicap-cards h5.handicap-card-disabled {
  position: relative;
  opacity: 1;
  background: var(--stripe-slate-50) !important;
  border-top: 4px solid var(--stripe-slate-300) !important;
  color: var(--stripe-slate-500) !important;
  cursor: not-allowed;
}

.handicap-cards h5.handicap-card-disabled::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(0, 0, 0, 0.02) 10px,
    rgba(0, 0, 0, 0.02) 20px
  );
  border-radius: var(--radius-lg);
  pointer-events: none;
}

/* =========================================
   Tooltip Styles
   ========================================= */

.tooltip-trigger {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  z-index: 10;
}

.tooltip-trigger i.fa-question-circle {
  font-size: 0.875rem;
  color: var(--stripe-slate-400);
  transition: color var(--transition-fast);
}

.tooltip-trigger:hover i.fa-question-circle {
  color: var(--stripe-indigo);
}

.tooltip-content {
  position: absolute;
  bottom: calc(100% + 8px);
  top: auto;
  right: 0;
  width: 280px;
  max-width: calc(100vw - 16px);
  padding: var(--space-md);
  background: var(--stripe-slate-900);
  color: var(--stripe-white);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  text-transform: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: all var(--transition-fast);
  pointer-events: none;
  z-index: 1000;
}

/* Tooltip arrow - at bottom */
.tooltip-content::before {
  content: '';
  position: absolute;
  bottom: -6px;
  top: auto;
  right: 8px;
  width: 12px;
  height: 12px;
  background: var(--stripe-slate-900);
  transform: rotate(45deg);
  border-radius: 2px;
}

.tooltip-trigger:hover .tooltip-content,
.tooltip-trigger:focus .tooltip-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Tooltip in table header */
.tooltip-trigger-header {
  top: auto;
  right: auto;
  display: inline-flex;
  margin-left: var(--space-sm);
  vertical-align: middle;
}

/* In the handicap table, pin the tooltip to the top-right corner of the header
   cell instead of trailing the (centered, often wrapping) header text. Other
   tables keep the default inline placement next to the word. */
.handicap-table th:has(.tooltip-trigger-header) {
  position: relative;
}

.handicap-table th .tooltip-trigger-header {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  margin-left: 0;
}

/* Per-cell tooltip triggers used only on the mobile card layout; the desktop
   table shows these tooltips in the column headers instead */
.tooltip-card-trigger {
  display: none;
}

.tooltip-trigger-header .tooltip-content {
  bottom: calc(100% + 8px);
  top: auto;
  right: 0;
  left: auto;
  transform: translateY(4px);
}

.tooltip-trigger-header .tooltip-content::before {
  bottom: -6px;
  top: auto;
  right: 8px;
  left: auto;
  transform: rotate(45deg);
}

.tooltip-trigger-header:hover .tooltip-content,
.tooltip-trigger-header:focus .tooltip-content {
  transform: translateY(0);
}

/* Tooltip inside disabled cards - prevent opacity inheritance */
.handicap-card-disabled .tooltip-trigger,
.handicap-card-disabled .tooltip-content {
  opacity: 1 !important;
}

.handicap-card-disabled .tooltip-trigger .tooltip-content {
  opacity: 0 !important;
}

.handicap-card-disabled .tooltip-trigger:hover .tooltip-content,
.handicap-card-disabled .tooltip-trigger:focus .tooltip-content {
  opacity: 1 !important;
}

/* =========================================
   Form Base Styling
   ========================================= */

form {
  background: var(--stripe-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: visible;
  border: 1px solid var(--stripe-slate-100);
}

/* =========================================
   Modern Form Layout (div-based)
   ========================================= */

.course-form-container {
  margin-bottom: var(--space-xl);
}

.course-form-container form {
  max-width: none;
}

/* Form with div-based layout */
form:has(.form-body) {
  max-width: none;
}

.form-header {
  background: linear-gradient(135deg, var(--stripe-slate-900) 0%, #1a3a52 100%);
  color: var(--stripe-white);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.form-body {
  padding: var(--space-lg);
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md) var(--space-xl);
}

.form-row {
  display: flex !important;
  flex-direction: column !important;
  gap: var(--space-sm);
}

.form-row label {
  width: auto;
  font-weight: 500;
  color: var(--stripe-slate-700);
  font-size: 0.9375rem;
}

.form-row input[type="text"] {
  flex: 1;
  width: 100%;
  max-width: none;
}

.form-row input.short_input {
  flex: none;
  width: 100%;
  max-width: none;
}

.form-row:last-child {
  grid-column: 1 / -1;
  flex-direction: row !important;
  align-items: center;
  margin-top: var(--space-sm);
}

.form-row:last-child label {
  display: none;
}

/* =========================================
   Table Styling
   ========================================= */

table {
  width: 100% !important;
  border-collapse: separate;
  border-spacing: 0;
  border: none !important;
}

/* Handicap table specific styling */
table.handicap {
  /* max-width removed to allow full width */
}

table.handicap td:first-child {
  width: 160px;
  min-width: 160px;
}

/* Remove margin on buttons inside table cells */
table td button[name="quick_submit"],
table td button[name="score"],
table td button.fa-check {
  margin-top: 0;
}

/* =========================================
   Course Form Table - 2 Column Grid Layout
   ========================================= */

/* Target the form table with inline width style */
form table[style*="350px"] {
  display: block;
  width: 100% !important;
  max-width: none;
}

form table[style*="350px"] > tbody {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md) var(--space-xl);
  padding: var(--space-lg);
  padding-top: 0;
}

/* Header row spans full width */
form table[style*="350px"] > tbody > tr:first-child {
  grid-column: 1 / -1;
  display: block;
  margin: 0 calc(-1 * var(--space-lg));
  margin-bottom: var(--space-sm);
}

form table[style*="350px"] > tbody > tr:first-child th {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Each form row as a flex column */
form table[style*="350px"] > tbody > tr:not(:first-child):not(:last-child) {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* Label cell */
form table[style*="350px"] > tbody > tr:not(:first-child) > td:first-child {
  width: auto !important;
  min-width: auto !important;
  padding: 0;
  border: none;
  font-weight: 500;
  color: var(--stripe-slate-700);
  font-size: 0.9375rem;
}

/* Input cell */
form table[style*="350px"] > tbody > tr:not(:first-child) > td:last-child {
  width: auto;
  min-width: auto;
  padding: 0;
  border: none;
  text-align: left;
}

/* Inputs take full width of their cell */
form table[style*="350px"] tr td input[type="text"] {
  width: 100%;
  max-width: none;
}

form table[style*="350px"] tr td input.short_input {
  width: 100%;
  max-width: none;
}

form table[style*="350px"] tr td select {
  width: 100%;
  max-width: none;
}

/* Button row spans full width */
form table[style*="350px"] > tbody > tr:last-child {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding-top: var(--space-sm);
}

form table[style*="350px"] > tbody > tr:last-child > td:first-child {
  display: none;
}

form table[style*="350px"] > tbody > tr:last-child > td:last-child {
  width: 100%;
  padding: 0;
  border: none;
}

/* Table Header - Spanning Header */
table th[colspan="2"] {
  background: linear-gradient(135deg, var(--stripe-slate-900) 0%, #1a3a52 100%);
  color: var(--stripe-white);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-md) var(--space-lg);
  text-align: left !important;
  border: none;
}

/* Data Table Header */
form table th {
  background: var(--stripe-slate-50);
  color: var(--stripe-slate-700);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--stripe-slate-100);
}

form table th:first-child {
  border-radius: var(--radius-lg) 0 0 0;
  width: 280px;
  min-width: 280px;
}

form table th:last-child {
  border-radius: 0 var(--radius-lg) 0 0;
  text-align: right;
  width: 120px;
  min-width: 120px;
}

/* Table Rows */
form table tr {
  border: none;
}

form table td {
  padding: var(--space-md) var(--space-lg);
  font-size: 1rem;
  color: var(--stripe-slate-700);
  border: none;
  border-bottom: 1px solid var(--stripe-slate-100);
  vertical-align: middle;
  transition: background-color var(--transition-fast);
}

form table td:first-child {
  font-weight: 500;
  color: var(--stripe-slate-900);
  width: 280px;
  min-width: 280px;
}

form table tr:hover td {
  background-color: var(--stripe-slate-50);
}

form table tr:last-child td {
  border-bottom: none;
}

form table tr:last-child td:first-child {
  border-radius: 0 0 0 var(--radius-lg);
}

form table tr:last-child td:last-child {
  border-radius: 0 0 var(--radius-lg) 0;
}

/* Action Buttons in Tables */
form table td:last-child {
  text-align: right;
  white-space: nowrap;
  width: 120px;
  min-width: 120px;
}

/* =========================================
   Input Styling
   ========================================= */

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"] {
  width: 100%;
  max-width: 300px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--stripe-slate-900);
  background: var(--stripe-white);
  border: 1px solid var(--stripe-slate-200);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

input.short_input {
  max-width: 120px;
}

input.medium_input {
  max-width: 150px;
}

input[type="text"]:hover,
input[type="date"]:hover,
input.short_input:hover,
input.medium_input:hover {
  border-color: var(--stripe-slate-400);
}

input[type="text"]:focus,
input[type="date"]:focus,
input.short_input:focus,
input.medium_input:focus {
  border-color: var(--stripe-indigo);
  box-shadow: var(--shadow-focus);
}

input::placeholder {
  color: var(--stripe-slate-400);
}

/* =========================================
   Select Dropdown Styling
   ========================================= */

select {
  width: 100%;
  max-width: 300px;
  padding: 7px 14px;
  padding-right: 40px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--stripe-slate-900);
  background-color: var(--stripe-white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23697386' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  border: 1px solid var(--stripe-slate-200);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

select:hover {
  border-color: var(--stripe-slate-400);
}

select:focus {
  border-color: var(--stripe-indigo);
  box-shadow: var(--shadow-focus);
}

/* =========================================
   Checkbox Styling
   ========================================= */

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  border: 2px solid var(--stripe-slate-300);
  border-radius: var(--radius-sm);
  background: var(--stripe-white);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

input[type="checkbox"]:hover {
  border-color: var(--stripe-slate-400);
}

input[type="checkbox"]:checked {
  background: var(--stripe-indigo);
  border-color: var(--stripe-indigo);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 6px;
  width: 5px;
  height: 10px;
  border: solid var(--stripe-white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="checkbox"]:focus {
  box-shadow: var(--shadow-focus);
}

/* =========================================
   Date Picker Styling
   ========================================= */

input[type="date"] {
  position: relative;
  cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px;
  transition: background-color var(--transition-fast);
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  background-color: var(--stripe-slate-100);
}

/* jQuery UI Datepicker - Stripe Theme */
.ui-widget-header .ui-icon {
  background-image: unset !important;
}

.ui-datepicker {
  font-family: var(--font-display);
  font-size: 0.875rem;
  background: var(--stripe-white);
  border: 1px solid var(--stripe-slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-md);
  width: 280px;
  z-index: 9999 !important;
}

.ui-datepicker-header {
  background: none;
  border: none;
  padding: var(--space-sm) 0 var(--space-md) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ui-datepicker-title {
  font-weight: 600;
  color: var(--stripe-slate-900);
  font-size: 1rem;
}

.ui-datepicker-prev,
.ui-datepicker-next {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--stripe-slate-50);
  border: 1px solid var(--stripe-slate-200);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  position: relative;
  top: auto;
  left: auto;
  right: auto;
}

.ui-datepicker-prev:hover,
.ui-datepicker-next:hover {
  background: var(--stripe-slate-100);
  border-color: var(--stripe-slate-300);
}

.ui-datepicker-prev span,
.ui-datepicker-next span {
  display: none;
}

.ui-datepicker-prev::after {
  content: '‹';
  font-size: 1.25rem;
  color: var(--stripe-slate-700);
}

.ui-datepicker-next::after {
  content: '›';
  font-size: 1.25rem;
  color: var(--stripe-slate-700);
}

.ui-datepicker-calendar {
  width: 100%;
  border-collapse: collapse;
}

.ui-datepicker-calendar th {
  padding: var(--space-sm);
  font-weight: 600;
  color: var(--stripe-slate-500);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ui-datepicker-calendar td {
  padding: 2px;
  text-align: center;
}

.ui-datepicker-calendar td a,
.ui-datepicker-calendar td span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--stripe-slate-700);
  text-decoration: none;
  transition: all var(--transition-fast);
  margin: 0 auto;
}

.ui-datepicker-calendar td a:hover {
  background: var(--stripe-slate-100);
  color: var(--stripe-slate-900);
}

.ui-datepicker-calendar .ui-datepicker-today a {
  background: var(--stripe-slate-100);
  font-weight: 600;
  color: var(--stripe-slate-900);
}

.ui-datepicker-calendar .ui-datepicker-current-day a,
.ui-datepicker-calendar td a.ui-state-active {
  background: var(--stripe-indigo);
  color: var(--stripe-white);
  font-weight: 600;
}

.ui-datepicker-calendar td a.ui-state-active:hover {
  background: var(--stripe-indigo-light);
}

.ui-datepicker-calendar .ui-datepicker-other-month span {
  color: var(--stripe-slate-300);
}

/* Future dates disabled via maxDate: 0 */
.ui-datepicker-calendar td.ui-datepicker-unselectable span,
.ui-datepicker-calendar td.ui-state-disabled span {
  color: var(--stripe-slate-300);
  opacity: 0.5;
  cursor: not-allowed;
}

/* Remove jQuery UI default styling */
.ui-widget.ui-widget-content {
  border: 1px solid var(--stripe-slate-200);
}

.ui-state-default,
.ui-widget-content .ui-state-default {
  border: none;
  background: none;
}

.ui-state-highlight,
.ui-widget-content .ui-state-highlight {
  border: none;
  background: var(--stripe-slate-100);
}

.ui-state-active,
.ui-widget-content .ui-state-active {
  border: none;
  background: var(--stripe-indigo);
  color: var(--stripe-white);
}

/* =========================================
   Inline Edit Row Styling
   ========================================= */

/* Tighten cell padding in edit mode so inputs fit fixed columns */
form table td:has(input[type="text"]),
form table td:has(select) {
  padding-left: var(--space-sm);
  padding-right: var(--space-sm);
}

/* Rating / Slope inline container */
td:has(input[name="rating"]) {
  white-space: nowrap;
  text-align: center;
}

form table td input[name="rating"],
form table td input[name="slope"] {
  display: inline-block;
  width: 46px;
  max-width: 46px;
  padding: 8px 4px;
  text-align: center;
  vertical-align: middle;
}

/* Wider rating/slope inputs only on the Add Score full-entry page */
.full-score-wrap input[name="rating"],
.full-score-wrap input[name="slope"] {
  width: 120px;
  max-width: 120px;
}

/* Match the rating/slope cell padding to the other input cells on the Add
   Score full-entry page (their inputs are type="number", so they miss the
   global :has(input[type="text"]) rule) */
.full-score-wrap td:has(input[name="rating"]),
.full-score-wrap td:has(input[name="slope"]) {
  padding-left: var(--space-sm);
  padding-right: var(--space-sm);
}

/* Inline course edit only: fixed columns so inputs line up under their
   headers, with Course Name kept the widest column */
.course-table-editing {
  width: 100%;
  table-layout: fixed;
}

.course-table-editing input[type="text"],
.course-table-editing input[type="number"] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.course-table-editing th:nth-child(1),
.course-table-editing td:nth-child(1) { width: 30%; } /* Course Name */
.course-table-editing th:nth-child(2),
.course-table-editing td:nth-child(2) { width: 20%; } /* Tee Name */
.course-table-editing th:nth-child(3),
.course-table-editing td:nth-child(3) { width: 18%; } /* Course Rating */
.course-table-editing th:nth-child(4),
.course-table-editing td:nth-child(4) { width: 18%; } /* Course Slope */
.course-table-editing th:nth-child(5),
.course-table-editing td:nth-child(5) { width: 14%; } /* Update */

/* Score input centered, fills cell */
td input[name="score"] {
  text-align: center;
}

td input[name="course"] {
  margin-bottom: 0;
}

/* Update button in edit mode */
button[name="submit_update"] {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 0 12px;
  background: linear-gradient(135deg, var(--stripe-indigo) 0%, var(--stripe-indigo-dark) 100%);
  color: var(--stripe-white);
  box-shadow: var(--shadow-md);
  margin-top: 0;
}

button[name="submit_update"]:hover {
  background: linear-gradient(135deg, var(--stripe-indigo-light) 0%, var(--stripe-indigo) 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

/* =========================================
   Responsive — Card Layout (read + edit)
   Below 960px the personal handicap table collapses into
   centered, stacked cards. Header row is hidden; each card
   carries its own field labels via data-label.
   ========================================= */

@media screen and (max-width: 960px) {

  /* Table becomes a centered stack of cards */
  table.handicap-table {
    display: block;
    width: 100%;
    table-layout: auto;
    border: none;
  }

  /* Implicit tbody must also go block or it caps card width */
  table.handicap-table tbody {
    display: block;
    width: 100%;
  }

  /* The form container drops its card chrome so cards stand alone */
  form:has(table.handicap-table) {
    background: none;
    box-shadow: none;
    border: none;
  }

  /* Hide the header row */
  table.handicap-table tr:first-child {
    display: none;
  }

  /* Each row is a card, centered with a comfortable max width */
  table.handicap-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    width: 100%;
    max-width: 680px;
    margin: 0 auto var(--space-md) auto;
    background: var(--stripe-white);
    border: 1px solid var(--stripe-slate-100);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-lg);
  }

  /* Cells */
  table.handicap-table td {
    display: block;
    width: auto !important;
    min-width: 0 !important;
    border: none !important;
    padding: 0 !important;
    text-align: left !important;
    white-space: normal !important;
    font-size: 1rem;
  }

  /* Tooltip cells: field label on its own line (as usual), the tooltip icon
     sits inline right after the value */
  table.handicap-table .cell-value {
    display: inline;
  }

  table.handicap-table .tooltip-card-trigger {
    position: relative;
    top: -2px;
    right: auto;
    display: inline-flex;
    vertical-align: middle;
    margin-left: var(--space-xs);
  }

  /* Field label from data-label */
  table.handicap-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: var(--space-xs);
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--stripe-slate-500);
  }

  table.handicap-table td[data-label=""]::before {
    content: none;
  }

  /* Course spans full width */
  table.handicap-table td:nth-child(2) {
    grid-column: 1 / -1;
  }

  /* Action cell spans full width */
  table.handicap-table td.edit-action-cell,
  table.handicap-table td.row-action-cell {
    grid-column: 1 / -1;
    display: flex;
    gap: var(--space-sm);
  }

  /* Inputs / selects fill their cell (edit mode) */
  table.handicap-table input[type="text"],
  table.handicap-table select {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Rating / Slope: two boxes side by side under one label */
  table.handicap-table td:has(input[name="rating"]) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
  }

  table.handicap-table td:has(input[name="rating"])::before {
    flex: 0 0 100%;
  }

  table.handicap-table input[name="rating"],
  table.handicap-table input[name="slope"] {
    width: 90px !important;
    max-width: 90px !important;
    flex: 0 0 auto;
    text-align: center;
  }

  /* Full-width Save button with text (edit mode) */
  table.handicap-table td.edit-action-cell button[name="submit_update"] {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }

  table.handicap-table td.edit-action-cell button[name="submit_update"]::after {
    content: " Save";
  }
}

/* Single column on small phones */
@media screen and (max-width: 560px) {
  table.handicap-table tr {
    grid-template-columns: 1fr;
  }
}





/* =========================================
   Button Styles
   ========================================= */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
  line-height: 1;
}

button:focus-visible {
  box-shadow: var(--shadow-focus);
}

/* Primary Button */
.btn-primary,
button.fa-plus,
button[name="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-width: 44px;
  min-height: 44px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--stripe-indigo) 0%, var(--stripe-indigo-dark) 100%);
  color: var(--stripe-white);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary:hover,
button.fa-plus:hover,
button[name="submit"]:hover {
  background: linear-gradient(135deg, var(--stripe-indigo-light) 0%, var(--stripe-indigo) 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-primary:active,
button.fa-plus:active,
button[name="submit"]:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary i {
  font-size: 0.875rem;
}

/* Icon-only buttons (legacy support) */
button.fa-plus:not(.btn-primary) {
  padding: 0;
}

/* Edit/Update Button */
button.fa-pen-to-square,
button.fa-pencil-square-o,
button[name="update"] {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  margin-right: var(--space-sm);
  background: var(--stripe-white);
  color: var(--stripe-slate-500);
  border: 1px solid var(--stripe-slate-200);
  box-shadow: var(--shadow-sm);
}

button.fa-pen-to-square:hover,
button.fa-pencil-square-o:hover,
button[name="update"]:hover {
  background: var(--stripe-slate-50);
  color: var(--stripe-indigo);
  border-color: var(--stripe-indigo);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Delete Button */
button.fa-trash,
button.fa-cut,
button[name="delete"] {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  background: var(--stripe-white);
  color: var(--stripe-slate-500);
  border: 1px solid var(--stripe-slate-200);
  box-shadow: var(--shadow-sm);
}

button.fa-trash:hover,
button.fa-cut:hover,
button[name="delete"]:hover {
  background: #fff5f5;
  color: var(--danger);
  border-color: var(--danger);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Submit Button with Text (Score form) */
button.fa-check:not([name="submit_update"]),
button[name="score"],
button[name="quick_submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-width: 120px;
  padding: 12px 24px;
  margin-top: var(--space-md);
  background: linear-gradient(135deg, var(--stripe-indigo) 0%, var(--stripe-indigo-dark) 100%);
  color: var(--stripe-white);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

button.fa-check:hover,
button[name="score"]:hover,
button[name="quick_submit"]:hover {
  background: linear-gradient(135deg, var(--stripe-indigo-light) 0%, var(--stripe-indigo) 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

/* Button with FA icon and text */
button.fa.fa-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  min-width: auto;
  min-height: auto;
}

button.fa.fa-plus::before {
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  content: '\f067';
}

/* =========================================
   Action Buttons Container - Horizontal Layout
   ========================================= */

.print-button-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: stretch;
  justify-content: flex-end;
  margin-bottom: var(--space-lg);
}

/* Action Button Styles - Matched Height with Print */
.btn-action,
.print-button-container .btn-print {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px !important;
  height: auto !important;
  min-height: 42px !important;
  background: var(--stripe-white);
  color: var(--stripe-slate-700);
  font-family: var(--font-display);
  font-size: 0.875rem !important;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--stripe-slate-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-sizing: border-box !important;
  text-transform: initial; 
}

.btn-action:hover,
.print-button-container .btn-print:hover {
  background: var(--stripe-slate-50);
  color: var(--stripe-indigo);
  border-color: var(--stripe-indigo);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.btn-action:active,
.print-button-container .btn-print:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-action i,
.print-button-container .btn-print i {
  font-size: 0.875rem;
}

/* =========================================
   Radio Button Styling
   ========================================= */

form > div:not(.form-body) {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-lg);
}

/* Full score form: no wrapper padding */
form > div.full-score-wrap:not(.form-body) {
  padding: 0;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--stripe-white);
  border: 1px solid var(--stripe-slate-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: 500;
  color: var(--stripe-slate-700);
}

.radio-option:hover {
  border-color: var(--stripe-indigo);
  background: var(--stripe-slate-50);
}

.radio-option:has(input:checked) {
  border-color: var(--stripe-indigo);
  background: rgba(99, 91, 255, 0.05);
  box-shadow: var(--shadow-focus);
  color: var(--stripe-slate-900);
}

.radio-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  border: 2px solid var(--stripe-slate-400);
  border-radius: 50%;
  margin: 0;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  flex-shrink: 0;
  background: var(--stripe-white);
}

.radio-option input[type="radio"]:checked {
  border-color: var(--stripe-indigo);
  background: var(--stripe-indigo);
}

.radio-option input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: var(--stripe-white);
  border-radius: 50%;
}

/* =========================================
   Notice/Alert Styling
   ========================================= */

.notice {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  font-size: 0.9375rem;
}

.notice.success {
  background: rgba(48, 209, 88, 0.1);
  border: 1px solid var(--success);
  color: #1a7f37;
}

.notice.error,
.notice.failure {
  background: rgba(255, 69, 58, 0.1);
  border: 1px solid var(--danger);
  color: #c93c37;
}

.notice.notice-info {
  background: rgba(99, 91, 255, 0.1);
  border: 1px solid var(--stripe-indigo);
  color: var(--stripe-slate-700);
}

.notice.warning {
  background: rgba(255, 159, 10, 0.1);
  border: 1px solid var(--warning);
  color: #9a6700;
}

.validity-warning-banner {
  margin-top: var(--space-lg);
}

/* Inline variant of the tooltip trigger: the base .tooltip-trigger is pinned
   to the top-right of its container, but the warning icon sits in the flow of
   the text it marks. The small negative top offset lines the emoji up with
   the surrounding text. */
.tooltip-trigger.validity-warning {
  position: relative;
  top: -2px;
  right: auto;
  display: inline-flex;
  vertical-align: middle;
}

/* No-JS fallback: expand the popup leftward from the icon, matching the
   other in-table tooltips. JavaScript replaces this with viewport-fixed
   positioning the moment the tooltip is shown. */
.tooltip-trigger.validity-warning .tooltip-content {
  right: -8px;
  left: auto;
}

.tooltip-trigger.validity-warning .tooltip-content::before {
  right: 10px;
  left: auto;
}

/* When JavaScript pins a tooltip to the viewport (.tooltip-fixed), the arrow
   tracks the trigger through a CSS variable instead of a fixed corner, and
   flips to the top edge when the popup opens below the trigger. */
/* Only fade and lift; transitioning `all` would animate the top/left values
   the script assigns, sliding the popup across the screen. */
.tooltip-trigger .tooltip-content.tooltip-fixed {
  transition-property: opacity, visibility, transform;
}

.tooltip-trigger .tooltip-content.tooltip-fixed::before {
  left: var(--tooltip-arrow-left, 50%);
  right: auto;
  margin-left: -6px;
}

.tooltip-trigger .tooltip-content.tooltip-fixed.tooltip-below::before {
  bottom: auto;
  top: -6px;
}

.notice a {
  color: var(--stripe-indigo);
  text-decoration: underline;
}

/* =========================================
   Font Awesome 5 & 6 Icons
   ========================================= */

/* Font Awesome 5 */
.fa::before {
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  font-style: normal;
}

/* Font Awesome 6 */
.fa-solid::before {
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-style: normal;
}

.fa-plus::before {
  content: '\f067';
}

.fa-pen-to-square::before,
.fa-pencil-square-o::before {
  content: '\f14b';
}

.fa-trash::before,
.fa-cut::before {
  content: '\f1f8';
}

.fa-check::before {
  content: '\f00c';
}

.fa-trophy::before {
  content: '\f091';
}

/* =========================================
   Animations
   ========================================= */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

form:last-of-type table tr {
  animation: fadeInUp var(--transition-slow) ease-out;
}

/* =========================================
   Empty State
   ========================================= */

form:last-of-type table tr:only-child td[colspan] {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--stripe-slate-400);
  font-style: italic;
}

/* =========================================
   Accessibility
   ========================================= */

*:focus-visible {
  outline: 2px solid var(--stripe-indigo);
  outline-offset: 2px;
}

/* =========================================
   Peer Search Page Styling
   ========================================= */

.peer-search-container {
  margin-bottom: var(--space-xl);
}

.peer-search-form {
  max-width: 600px;
}

.peer-search-form .form-body {
  display: flex !important;
  flex-direction: column !important;
  gap: var(--space-lg);
}

.peer-search-form .search-options {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.peer-search-form .search-options .radio-option {
  flex: 1;
  min-width: 140px;
}

.peer-search-form .search-input-row {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.peer-search-form .search-input-row input[type="text"] {
  flex: 1;
  max-width: none;
}

.peer-search-form .search-input-row .btn-primary {
  flex-shrink: 0;
}

/* Peer Results Table */
.peer-results-container {
  margin-bottom: var(--space-xl);
}

/* Sized to content (not table-layout:fixed) so the Status/Select columns
   stay narrow and Region/City-State-Country get whatever width they need
   to stay on one line, instead of a wide fixed layout starving them and
   forcing wraps while Member sits mostly empty. */
.peer-results-container table.peer-search-results {
  table-layout: auto;
}

/* Just an icon — kept narrow so it's the first thing to give up space to
   Region/City-State-Country as the viewport shrinks, rather than the
   Select column (see the sticky rule below) getting pushed off-screen. */
.peer-results-container table th:first-child,
.peer-results-container table td:first-child {
  width: 70px;
  min-width: 70px;
  text-align: center;
}

/* Sticky at every width, not just narrow ones — Select must stay reachable
   whenever the table is wider than its container, which can happen well
   above the old 768px mobile breakpoint (e.g. tablet widths ~900px). */
.peer-results-container table th:last-child,
.peer-results-container table td:last-child {
  width: 120px;
  min-width: 120px;
  text-align: center;
  position: sticky;
  right: 0;
  z-index: 1;
}

.peer-results-container table td:last-child {
  background: var(--stripe-white);
}

.peer-results-container table th:last-child {
  background: var(--stripe-slate-50);
}

/* The "floating over scrolled content" shadow only makes sense once the
   table actually overflows its container — .is-scrollable is toggled by
   the script at the bottom of table-peer.php based on measured overflow,
   so the shadow doesn't show up on desktop widths where nothing is
   scrolling underneath the sticky column. */
.peer-results-container.is-scrollable table th:last-child,
.peer-results-container.is-scrollable table td:last-child {
  box-shadow: -6px 0 8px -6px rgba(0, 0, 0, 0.15);
}

/* Region and City, State, Country read better on one line than wrapped;
   with table-layout:auto the column simply grows to fit instead of
   squeezing the text. */
.peer-results-container table th:nth-child(3),
.peer-results-container table td:nth-child(3),
.peer-results-container table th:nth-child(4),
.peer-results-container table td:nth-child(4) {
  white-space: nowrap;
}

/* !important guards against ancestor content-area "img { max-width: 100% }"
   resets shrinking the icon to fit the narrow, fixed-width status column. */
.member-status-icon {
  width: 30px !important;
  height: 30px !important;
  display: inline-block;
}

/* Status icon tooltip. The results table sits in a div with
   overflow-x:auto (so it can scroll on narrow screens without the Select
   column running off-screen — see the sticky rule below). A normal
   position:absolute/fixed popup nested inside that div gets clipped by it,
   and — since setting overflow-x forces overflow-y to "auto" too — the
   popup's height was also triggering an unwanted vertical scrollbar on
   the whole results list. To avoid both, table-peer.php moves this popup
   to a single shared element appended directly to <body> on hover/focus
   (see the inline script at the bottom of that template), so it paints
   above everything and can never affect this container's scroll size. */
.status-tooltip {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  cursor: help;
}

.status-tooltip-content {
  display: none;
}

.status-tooltip-popup {
  display: none;
  position: fixed;
  width: 220px;
  max-width: calc(100vw - 16px);
  padding: var(--space-md);
  background: var(--stripe-slate-900);
  color: var(--stripe-white);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  pointer-events: none;
  z-index: 999999;
}

.status-tooltip-popup::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  background: var(--stripe-slate-900);
  border-radius: 2px;
  transform: translateX(-50%) rotate(45deg);
}

.status-tooltip-popup.status-tooltip-below::before {
  bottom: auto;
  top: -6px;
  transform: translateX(-50%) rotate(45deg);
}

/* View/Select Button */
.btn-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 8px 16px;
  background: var(--stripe-white);
  color: var(--stripe-slate-700);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--stripe-slate-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-select:hover {
  background: var(--stripe-slate-50);
  color: var(--stripe-indigo);
  border-color: var(--stripe-indigo);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Peer Profile Section */
.peer-profile-section {
  display: flex;
  justify-content: center;
  margin: var(--space-xl) 0;
}

/* =========================================
   Responsive Design
   ========================================= */

@media (max-width: 1200px) {
  .print-button-container {
    position: relative;
    top: auto;
    right: auto;
    margin-bottom: var(--space-md);
    justify-content: flex-end !important;
    flex-wrap: wrap !important;
  }
}

@media (max-width: 768px) {
  .handicap-cards {
    margin-bottom: var(--space-xl) !important;
  }

  .print-button-container {
    justify-content: center !important;
  }
  
  .btn-action,
  .print-button-container .btn-print {
    padding: 8px 12px !important;
    font-size: 0.75rem !important;
    min-height: 38px !important;
  }
  
  .tooltip-content {
    width: 240px;
    font-size: 0.75rem;
  }
  
  .tooltip-trigger-header .tooltip-content {
    left: auto;
    right: 0;
    transform: translateY(4px);
  }
  
  .tooltip-trigger-header .tooltip-content::before {
    left: auto;
    right: 8px;
    transform: rotate(45deg);
  }
  
  .tooltip-trigger-header:hover .tooltip-content,
  .tooltip-trigger-header:focus .tooltip-content {
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .ast-article-single {
    margin: var(--space-lg) auto;
    padding: 0 var(--space-md);
  }
  
  .entry-title {
    font-size: 1.5rem;
  }
  
  .handicap-cards {
    flex-direction: column;
  }
  
  .handicap-cards h5 {
    min-width: 100%;
  }
  
  .form-body {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .form-row:last-child {
    grid-column: 1;
  }
  
  .btn-primary {
    width: 100%;
  }
  
  form table td {
    padding: var(--space-sm) var(--space-md);
  }
  
  form table td:first-child {
    width: auto;
    min-width: auto;
    font-size: 0.875rem;
  }
  
  input[type="text"],
  input.short_input {
    max-width: 100%;
    font-size: 1rem;
  }
  
  form:last-of-type table {
    display: block;
    overflow-x: auto;
  }
  
  form:last-of-type table th,
  form:last-of-type table td {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
  }
  
  /* Responsive - single column on mobile */
  form table[style*="350px"] > tbody {
    grid-template-columns: 1fr;
  }
  
  .peer-search-form .search-options {
    flex-direction: column;
  }
  
  .peer-search-form .search-options .radio-option {
    min-width: 100%;
  }
  
  .peer-search-form .search-input-row {
    flex-direction: column;
  }
  
  .peer-search-form .search-input-row input[type="text"] {
    width: 100%;
  }
  
  .peer-search-form .search-input-row .btn-primary {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .print-button-container {
    flex-direction: column !important;
    gap: var(--space-sm);
  }
  
  .btn-action,
  .print-button-container .btn-print {
    width: 100%;
    justify-content: center;
  }
}

/* =========================================
   Print Styles
   ========================================= */

@media print {

  @page {
    margin: 1cm;
  }

  body {
    background: #fff !important;
    color: #000;
  }

  /* Hide all site chrome */
  header,
  footer,
  #masthead,
  #colophon,
  .site-header,
  .site-footer,
  .ast-header,
  .ast-header-bar,
  .ast-footer,
  nav,
  .navigation,
  .main-navigation,
  .menu,
  .sidebar,
  #secondary,
  .ast-breadcrumbs,
  .elementor-divider__element,
  .elementor-widget-divider,
  .elementor-widget-heading,
  .entry-header,
  .entry-title,
  .ast-single-post-title,
  .page-title {
    display: none !important;
  }

  /* Hide the page heading and the descriptive paragraph widget */
  h1,
  .elementor-heading-title,
  .elementor-widget-text-editor p {
    display: none !important;
  }

  /* Strip the textured page background everywhere */
  html,
  body,
  #content,
  .site-content,
  .ast-container,
  .elementor,
  .e-con,
  .e-con-inner,
  .e-con-boxed,
  .elementor-element {
    background: none !important;
    background-image: none !important;
    box-shadow: none !important;
  }

  /* Elementor paints its background image/overlay on a ::before layer */
  .elementor-element::before,
  .e-con::before,
  .e-con-inner::before,
  .elementor-background-overlay,
  .elementor-background-video-container::before,
  .elementor-motion-effects-container::before {
    background: none !important;
    background-image: none !important;
    --background-overlay: none !important;
    content: none !important;
  }

  /* Hide page controls and helpers */
  .print-button-container,
  .btn-action,
  .btn-print,
  button,
  .tooltip-trigger,
  .peer-search-container {
    display: none !important;
  }

  /* Print header band: small logo + title + rule, on the handicap block */
  .handicap-section {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 4pt 16pt;
    margin: 0 0 8pt 0 !important;
    text-align: center;
  }

  .handicap-section::before {
    content: url("https://dev-brd-shg.pantheonsite.io/wp-content/uploads/2026/01/SHG-Full-Color-1200x1200-4-96x96.png") "\A SoHG Handicap";
    white-space: pre-line;
    flex: 0 0 100%;
    text-align: center;
    font-family: var(--font-display);
    font-size: 15pt;
    font-weight: 700;
    color: #000;
    line-height: 1.1;
    padding-bottom: 6pt;
    margin-bottom: 6pt;
    border-bottom: 1.5pt solid #000;
  }

  /* Drop avatars; name and handicap share one centered line */
  .user-greeting .user-avatar,
  .peer-profile-section .user-avatar {
    display: none !important;
  }

  .user-greeting,
  .peer-profile-section {
    display: inline-flex;
    margin: 0 !important;
  }

  .user-greeting .user-name,
  .peer-profile-section .user-name {
    font-size: 12pt;
    font-weight: 700;
    color: #000;
  }

  /* Hide disabled handicap cards entirely */
  .handicap-cards h5.handicap-card-disabled {
    display: none !important;
  }

  /* Active handicap as plain inline text, not a boxed card */
  .handicap-cards {
    display: inline-flex;
    gap: 16pt;
    margin: 0 !important;
  }

  .handicap-cards h5 {
    flex: 0 0 auto;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    border: none !important;
    border-radius: 0;
    box-shadow: none !important;
    background: none !important;
    font-size: 13pt;
    font-weight: 400;
    line-height: 1.2;
  }

  .handicap-cards h5 br {
    display: none;
  }

  .handicap-cards h5 .score {
    font-size: 12pt !important;
    font-weight: 700;
    color: #000 !important;
  }

  /* Peer page: name lives in its own block before the cards.
     Put the header band there instead, and suppress the duplicate. */
  .peer-profile-section::before {
    content: url("https://dev-brd-shg.pantheonsite.io/wp-content/uploads/2026/01/SHG-Full-Color-1200x1200-4-96x96.png") "\A SoHG Handicap";
    white-space: pre-line;
    display: block;
    text-align: center;
    font-family: var(--font-display);
    font-size: 15pt;
    font-weight: 700;
    color: #000;
    line-height: 1.1;
    padding-bottom: 6pt;
    margin-bottom: 6pt;
    border-bottom: 1.5pt solid #000;
  }

  .peer-profile-section {
    display: block;
    text-align: center;
    margin: 0 0 6pt 0 !important;
  }

  body:has(.peer-profile-section) .handicap-section::before {
    content: none !important;
  }

  body:has(.peer-profile-section) .handicap-section {
    border: none;
    padding-top: 0;
  }

  /* Center the numeric columns for readability */
  table.handicap-table td[data-label="Rating / Slope"],
  table.handicap-table td[data-label="Score"],
  table.handicap-table th:nth-child(4),
  table.handicap-table th:nth-child(5) {
    text-align: center;
  }

  /* Form wrapper: no card chrome on print */
  form {
    background: none !important;
    box-shadow: none !important;
    border: none !important;
  }

  /* Compact scores table — fit 40+ rows */
  table.handicap-table {
    width: 100%;
    table-layout: auto !important;
    border-collapse: collapse;
    font-size: 8pt;
  }

  /* Kill the fixed pixel column widths so columns size to content */
  table.handicap-table th,
  table.handicap-table td {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 3pt 6pt !important;
    border: 1px solid #999 !important;
    text-align: left;
    white-space: nowrap;
    color: #000;
    vertical-align: middle;
  }

  table.handicap-table th {
    background: #eee !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    font-size: 7pt;
    text-transform: uppercase;
  }

  /* Hide Update/Delete column on the personal table only (peer has none) */
  table.personal-handicap th:last-child,
  table.personal-handicap td:last-child {
    display: none !important;
  }

  /* Avoid breaking a row across pages */
  table.handicap-table tr {
    page-break-inside: avoid;
  }

  /* Peer scores table: fixed layout with capped proportions so every column —
     including Era of Play — fits the page. Course/Tee wrap instead of forcing
     the table wider than the printable width. */
  table.peer-handicap {
    table-layout: fixed !important;
    width: 100% !important;
    font-size: 7pt;
  }

  table.peer-handicap th:nth-child(1),
  table.peer-handicap td:nth-child(1) { width: 16% !important; white-space: nowrap; } /* Date */

  table.peer-handicap th:nth-child(2),
  table.peer-handicap td:nth-child(2) {
    width: 25% !important;                /* Course — capped, allowed to wrap */
    white-space: normal !important;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  table.peer-handicap th:nth-child(3),
  table.peer-handicap td:nth-child(3) {
    width: 15% !important;                /* Tee — allowed to wrap */
    white-space: normal !important;
    overflow-wrap: break-word;
  }

  table.peer-handicap th:nth-child(4),
  table.peer-handicap td:nth-child(4) { width: 16% !important; text-align: center; } /* Rating/Slope */

  table.peer-handicap th:nth-child(5),
  table.peer-handicap td:nth-child(5) { width: 12% !important; text-align: center; } /* Score */

  table.peer-handicap th:nth-child(6),
  table.peer-handicap td:nth-child(6) { width: 16% !important; text-align: center; } /* Era of Play */
}

/* Default table styling */
table.handicap-table {
    width: 100%;
    table-layout: fixed;
}

/* Personal Handicap specific column widths */
table.personal-handicap th:nth-child(1), 
table.personal-handicap td:nth-child(1) {
    width: 140px; /* Date column - narrow */
    white-space: nowrap;
}

table.personal-handicap th:nth-child(2), 
table.personal-handicap td:nth-child(2) {
    width: auto; /* Course - takes remaining space */
}

table.personal-handicap th:nth-child(3), 
table.personal-handicap td:nth-child(3) {
    width: 90px; /* Tee */
}

table.personal-handicap th:nth-child(4), 
table.personal-handicap td:nth-child(4) {
    width: 150px; /* Rating/Slope */
}

table.personal-handicap th:nth-child(5), 
table.personal-handicap td:nth-child(5) {
    width: 110px; /* Score */
    text-align: center;
    white-space: nowrap;
}

table.personal-handicap th:nth-child(6), 
table.personal-handicap td:nth-child(6) {
    width: 130px; /* Era of Play */
    text-align: center;
}

table.personal-handicap th:nth-child(7), 
table.personal-handicap td:nth-child(7) {
    width: 130px; /* Update/Delete */
    text-align: center;
}

/* Peer Table specific column widths (no Update/Delete column) */
table.peer-handicap {
    width: 100%;
    table-layout: fixed;
}

table.peer-handicap th:nth-child(1), 
table.peer-handicap td:nth-child(1) {
    width: 160px; /* Date column - narrow */
    white-space: nowrap;
}

table.peer-handicap th:nth-child(2), 
table.peer-handicap td:nth-child(2) {
    width: auto; /* Course - takes remaining space */
}

table.peer-handicap th:nth-child(3), 
table.peer-handicap td:nth-child(3) {
    width: 140px; /* Tee */
}

table.peer-handicap th:nth-child(4), 
table.peer-handicap td:nth-child(4) {
    width: 140px; /* Rating/Slope */
}

table.peer-handicap th:nth-child(5), 
table.peer-handicap td:nth-child(5) {
    width: 110px; /* Score */
    text-align: center;
    white-space: nowrap;
}

table.peer-handicap th:nth-child(6), 
table.peer-handicap td:nth-child(6) {
    width: 170px; /* Era of Play */
    text-align: center;
}
