/* ============================================================
   Golf Guest Passes — tool-specific styles
   Inherits buttons, inputs, labels, .card, .eyebrow,
   .page-header, .topbar, .footer, .toast from ../../css/theme.css.
   Tool-specific classes are prefixed gp- to avoid collisions.
   ============================================================ */

/* -------- Required asterisk -------- */
.req { color: var(--danger); margin-left: 2px; }
.gp-optional {
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--ink-muted);
  margin-left: 4px;
}

/* -------- Form grid -------- */
.gp-form-card .gp-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4) var(--s-6);
  margin-top: var(--s-2);
}
.gp-field-full { grid-column: 1 / -1; }

.gp-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-3);
  margin-top: var(--s-6);
  padding-top: var(--s-6);
  border-top: 1px solid var(--rule-soft);
}

.gp-form-status {
  margin-top: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: 3px;
  font-size: 0.875rem;
  line-height: 1.5;
}
.gp-form-status.success {
  background: #eef5ef;
  color: var(--green-deep);
  border: 1px solid #c5dcc7;
}
.gp-form-status.error {
  background: #f7e9e9;
  color: var(--danger);
  border: 1px solid #e0bcbc;
}
.gp-form-status.working {
  background: #eef1f8;
  color: var(--navy);
  border: 1px solid #c8d1e4;
}

/* -------- History card -------- */
.gp-history-card {
  margin-top: var(--s-6);
}
.gp-card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin-bottom: var(--s-6);
}
.gp-history-controls {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.gp-history-controls input[type="search"] {
  width: 260px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}
.gp-history-controls select {
  width: auto;
  min-width: 140px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}
.gp-btn-small {
  padding: 0.5rem 0.85rem !important;
  font-size: 0.72rem !important;
}

/* -------- Table -------- */
.gp-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
}
.gp-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.gp-history-table th,
.gp-history-table td {
  padding: 0.75rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: middle;
}
.gp-history-table th {
  background: var(--cream);
  color: var(--ink-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  border-bottom-width: 2px;
  border-bottom-color: var(--rule);
}
.gp-history-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.gp-history-table th.sortable:hover { color: var(--navy); }
.sort-ind {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.65rem;
  color: var(--rule);
}
.gp-num { text-align: center !important; }
.gp-history-table tbody tr:hover { background: var(--cream-light); }
.gp-history-table tbody tr:last-child td { border-bottom: none; }
.gp-empty-row {
  text-align: center;
  color: var(--ink-muted);
  padding: var(--s-8) var(--s-4) !important;
  font-style: italic;
}
.gp-serial-list {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.75rem;
  color: var(--ink-muted);
  line-height: 1.45;
}
.gp-sub-label {
  font-size: 0.7rem;
  color: var(--ink-muted);
  margin-top: 2px;
}
.gp-email-flag-ok    { color: var(--green); font-size: 0.7rem; }
.gp-email-flag-fail  { color: var(--danger); font-size: 0.7rem; }
.gp-row-bold { font-weight: 600; color: var(--ink); }

/* -------- Status pills (reuse .pill but specialized) -------- */
.gp-status-active   { background: #e6ecf5; color: var(--navy); }
.gp-status-expiring { background: #f4ecd6; color: #8a6510; }
.gp-status-expired  { background: var(--rule-soft); color: var(--ink-muted); }

/* -------- Row actions -------- */
.gp-row-actions {
  display: flex;
  gap: 2px;
  white-space: nowrap;
}
.gp-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--navy);
  font-family: inherit;
  transition: background 120ms ease, border-color 120ms ease;
}
.gp-icon-btn:hover {
  background: var(--cream);
  border-color: var(--rule);
}
.gp-icon-btn.danger { color: var(--danger); }
.gp-icon-btn.danger:hover {
  background: #f7e9e9;
  border-color: #e0bcbc;
}
.gp-icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* -------- History footer -------- */
.gp-history-footer {
  padding: var(--s-3) var(--s-2) 0;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

/* -------- Modal -------- */
.gp-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gp-modal[hidden] { display: none; }
.gp-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 35, 73, 0.55);
}
.gp-modal-panel {
  position: relative;
  background: var(--paper);
  border-radius: 3px;
  width: min(900px, 92vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.gp-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-4) var(--s-6);
  border-bottom: 1px solid var(--rule-soft);
}
.gp-modal-title {
  margin: 0;
  font-family: 'Lora', serif;
  font-size: 1.2rem;
  color: var(--navy);
}
.gp-modal-close {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0 0.4rem;
}
.gp-modal-close:hover { color: var(--navy); }
.gp-modal-body {
  flex: 1;
  padding: var(--s-4) var(--s-6);
  overflow: hidden;
  background: var(--cream);
}
.gp-modal-body iframe {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper);
}
.gp-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-6);
  border-top: 1px solid var(--rule-soft);
}

/* -------- Toast container (matches theme but scoped) -------- */
#gp-toast-container {
  position: fixed;
  bottom: var(--s-6);
  right: var(--s-6);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.gp-toast {
  background: var(--navy);
  color: var(--cream-light);
  padding: 0.8rem 1.2rem;
  border-radius: 3px;
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-left: 3px solid var(--green);
  min-width: 260px;
  animation: gp-slide-in 200ms ease;
}
.gp-toast.success { border-left-color: var(--green); }
.gp-toast.error   { border-left-color: var(--danger); }
@keyframes gp-slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* -------- Edit modal (narrower than preview) -------- */
.gp-modal-panel-narrow {
  width: min(640px, 92vw);
}
.gp-modal-body-pad {
  padding: var(--s-6);
  background: var(--paper);
}
.gp-edit-meta {
  background: var(--cream);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-6);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--ink-muted);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px var(--s-6);
}
.gp-edit-meta > div:first-child {
  grid-column: 1 / -1;
}
.gp-edit-label {
  font-weight: 600;
  color: var(--navy);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: var(--s-2);
}
.gp-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}

/* -------- Responsive -------- */
@media (max-width: 900px) {
  .gp-form-card .gp-form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .gp-form-card .gp-form-grid { grid-template-columns: 1fr; gap: var(--s-3); }
  .gp-form-actions { flex-direction: column-reverse; }
  .gp-form-actions .btn { width: 100%; }
  .gp-card-header-row { flex-direction: column; align-items: stretch; }
  .gp-history-controls { width: 100%; }
  .gp-history-controls input[type="search"] { width: 100%; flex: 1 1 200px; }
  .gp-history-table { font-size: 0.8rem; }
  .gp-history-table th,
  .gp-history-table td { padding: 0.55rem 0.5rem; }
  .gp-edit-grid { grid-template-columns: 1fr; }
  .gp-edit-meta { grid-template-columns: 1fr; }
  .gp-modal-footer { flex-wrap: wrap; }
  .gp-modal-footer .btn { flex: 1 1 calc(50% - var(--s-2)); }
  #gp-toast-container {
    left: var(--s-4);
    right: var(--s-4);
    bottom: var(--s-4);
  }
  .gp-toast { min-width: auto; width: 100%; }
}
