/* Malia - Kamaole Beach Club Dashboard */
/* Lonely Pine AI palette */

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

:root {
  --navy: #0F2340;
  --gold: #C9A961;
  --gold-dark: #a88a45;
  --bg: #F7F5F0;
  --white: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e0d8;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning-bg: #fffbeb;
  --warning-border: #C9A961;
  --needs-review-bg: #fdf9ec;
  --needs-review-border: #C9A961;
  --shadow: 0 1px 4px rgba(0,0,0,0.08), 0 2px 12px rgba(0,0,0,0.06);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ---- Header ---- */

.header {
  background: var(--navy);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  height: 32px;
  width: auto;
  flex-shrink: 0;
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-title {
  color: var(--gold);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-subtitle {
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  font-weight: 400;
}

/* ---- Main content ---- */

.main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---- Cards ---- */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.card-body {
  padding: 16px 20px 20px;
}

/* ---- Banner ---- */

#banner .card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.banner-week {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

.banner-count {
  font-size: 14px;
  color: var(--text-muted);
}

.banner-reassurance {
  font-size: 13px;
  color: #16a34a;
  font-weight: 500;
  margin-top: 2px;
}

.banner-empty {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---- Tables ---- */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: #f3f1ec;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody td {
  padding: 10px 12px;
  vertical-align: middle;
}

tbody tr:hover {
  background: #faf9f7;
}

/* Needs-review row highlight */
tbody tr.needs-review {
  background: var(--needs-review-bg);
  border-left: 3px solid var(--needs-review-border);
}

tbody tr.needs-review td:first-child {
  padding-left: 9px;
}

/* Editable table inputs */
.edit-input {
  width: 100%;
  min-width: 60px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 5px 7px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
}

.edit-input:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--white);
}

.edit-input.input-unit {
  min-width: 55px;
  max-width: 80px;
}

.edit-input.input-status {
  min-width: 80px;
}

.row-actions {
  white-space: nowrap;
  text-align: right;
}

.reviewed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-dark);
  cursor: pointer;
  margin-right: 8px;
  user-select: none;
  vertical-align: middle;
}

.reviewed-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
}

.btn-delete-row {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  vertical-align: middle;
}

.btn-delete-row:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 20px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--gold);
  color: var(--navy);
}

.btn-primary:hover:not(:disabled) {
  background: var(--gold-dark);
}

.btn-secondary {
  background: #f0ece4;
  color: var(--navy);
}

.btn-secondary:hover:not(:disabled) {
  background: #e5dfd5;
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-full {
  width: 100%;
}

/* ---- Upload zone ---- */

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--gold);
  background: var(--needs-review-bg);
}

.upload-zone-icon {
  font-size: 36px;
  line-height: 1;
  color: var(--gold);
}

.upload-zone-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}

.upload-zone-hint {
  font-size: 13px;
  color: var(--text-muted);
}

#file-input {
  display: none;
}

/* ---- Spinner / status ---- */

.spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Error / warning banners ---- */

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.alert-error {
  background: var(--danger-bg);
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: #92400e;
}

.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

/* ---- Needs-review legend ---- */

.needs-review-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 5px 10px;
  background: var(--needs-review-bg);
  border: 1px solid var(--needs-review-border);
  border-radius: 20px;
}

/* ---- Review layout ---- */

.review-photo-wrap {
  margin-bottom: 16px;
}

.review-photo {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  max-height: 320px;
  object-fit: contain;
  background: #f3f1ec;
}

.review-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}

/* ---- Carry-over panel ---- */

#carryover {
  margin-top: 16px;
}

.carryover-list {
  list-style: none;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.carryover-list li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 14px;
}

.carryover-unit {
  font-weight: 700;
  min-width: 50px;
  color: var(--navy);
}

.carryover-confirm-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* ---- History ---- */

.history-details {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.history-details summary {
  padding: 16px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.history-details summary::-webkit-details-marker { display: none; }

.history-details summary::after {
  content: "+";
  font-size: 18px;
  font-weight: 300;
  color: var(--text-muted);
}

.history-details[open] summary::after {
  content: "-";
}

.history-list {
  list-style: none;
  padding: 0 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-list li {
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-list li:last-child { border-bottom: none; }

.history-status-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  background: #e5e7eb;
  color: var(--text-muted);
}

.history-status-badge.published {
  background: #dcfce7;
  color: #166534;
}

.history-empty {
  padding: 12px 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* ---- Status pill on live table ---- */

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #e5e7eb;
  color: var(--text-muted);
}

.status-pill.confirmed {
  background: #dcfce7;
  color: #166534;
}

.status-pill.tentative {
  background: #fffbeb;
  color: #92400e;
}

/* ---- Hidden ---- */

.hidden { display: none !important; }

/* ---- Utilities ---- */

.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

/* ---- Tablet+ tweaks ---- */

@media (min-width: 600px) {
  .main {
    padding: 32px 24px 64px;
    gap: 24px;
  }

  .review-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
  }

  .review-photo-wrap {
    margin-bottom: 0;
    position: sticky;
    top: 16px;
  }
}

/* --- Magic-link account controls (added for the Pages deploy) --- */
.header-account { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.header-account-name { font-size: 12px; color: rgba(255,255,255,0.85); }
.header-logout { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.3);
  padding: 5px 10px; font-size: 12px; cursor: pointer; border-radius: 0; }
.header-logout:hover { background: rgba(255,255,255,0.28); }
