﻿/* PawHaven customer portal. Warm, mobile-friendly, dark-mode aware. */

:root {
  --coral-50:  #fff5f1;
  --coral-100: #ffe1d3;
  --coral-200: #ffc4a7;
  --coral-500: #ff7a59;
  --coral-600: #f25e3c;
  --coral-700: #c8482a;

  --teal-600:  #0e7c86;
  --teal-700:  #0a5e66;

  --cream-50:  #fff8f0;
  --cream-100: #fdefdb;
  --cream-200: #f9e3bf;

  --ink-900:   #2a1f1a;
  --ink-700:   #4a3a32;
  --ink-500:   #7a6a60;
  --ink-300:   #b8a89d;
  --ink-200:   #e0d4c8;
  --ink-100:   #ede4d8;

  --leaf-500:  #6fa678;
  --leaf-600:  #4d8a57;
  --sun-400:   #fcd34d;

  --shadow-sm: 0 1px 2px rgba(58, 33, 21, 0.06);
  --shadow-md: 0 4px 16px rgba(58, 33, 21, 0.08);
  --shadow-lg: 0 12px 40px rgba(58, 33, 21, 0.12);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  color: var(--ink-900);
  background: var(--cream-50);
}

/* ---------- Soft, scattered background ----------
   .portal-bg is sized to the full body (which extends to the full
   document height) instead of being fixed to the viewport, so the
   repeating paw print tile and the warm radial gradients cover the
   entire page top to bottom. */
.portal-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 8% 14%, var(--coral-100) 0, transparent 28%),
    radial-gradient(circle at 92% 88%, var(--cream-200) 0, transparent 32%),
    radial-gradient(circle at 50% 50%, transparent 0, var(--cream-50) 70%);
  min-height: 100%;
}
.portal-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../img/animals-tile.png');
  background-size: 540px 320px;
  background-repeat: repeat;
  background-position: top left;
  opacity: 0.18;
}

/* ---------- Shell ---------- */
.portal-shell {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.portal-view { display: block; }

/* ---------- Login ---------- */
.portal-card-login {
  max-width: 460px;
  margin: 48px auto;
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 36px 32px;
}
.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.portal-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--coral-500);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
}
.portal-mark-sm { width: 36px; height: 36px; font-size: 14px; border-radius: 10px; }
.portal-brand-name { font-family: 'Fraunces', Georgia, serif; font-size: 20px; font-weight: 600; color: var(--ink-900); }
.portal-brand-tag { font-size: 12px; color: var(--ink-500); }

.portal-h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  margin: 0 0 8px;
  line-height: 1.2;
}
.portal-sub { color: var(--ink-700); font-size: 14px; line-height: 1.5; margin: 0 0 20px; }

.portal-form { display: flex; flex-direction: column; gap: 14px; }
.portal-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.portal-form-grid .field.full { grid-column: 1 / -1; }
.portal-form-actions { display: flex; gap: 8px; margin-top: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--ink-700); }
.field input, .field select, .field textarea {
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-900);
  transition: border-color 120ms;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--coral-500);
  box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.18);
}
.field textarea { resize: vertical; }

.portal-btn { width: 100%; padding: 12px 16px; }

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 3px solid #b91c1c;
  color: #7f1d1d;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.portal-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 12px;
  color: var(--ink-500);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.portal-divider::before, .portal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ink-200);
}

.demo-owners {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.demo-owner-btn {
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
  font-family: inherit;
}
.demo-owner-btn:hover { background: var(--coral-50); border-color: var(--coral-500); }
.demo-owner-name { font-weight: 600; color: var(--ink-900); font-size: 14px; }
.demo-owner-email { color: var(--ink-500); font-size: 12px; }

.portal-foot { margin-top: 24px; text-align: center; font-size: 13px; color: var(--ink-500); }
.portal-foot a { color: var(--coral-600); text-decoration: none; }
.portal-foot a:hover { text-decoration: underline; }

/* ---------- Dashboard ---------- */
.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.portal-topbar-left { display: flex; align-items: center; gap: 12px; }
.portal-topbar-hi { font-family: 'Fraunces', Georgia, serif; font-size: 24px; font-weight: 600; color: var(--ink-900); }
.portal-topbar-sub { color: var(--ink-500); font-size: 13px; }
.portal-topbar-right { display: flex; align-items: center; gap: 8px; }
.portal-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--ink-200);
  background: var(--surface);
  color: var(--ink-700);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 120ms;
}
.portal-icon-btn:hover { background: var(--bg); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 600;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  padding: 10px 18px;
  transition: background 120ms, transform 120ms, color 120ms;
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-primary { background: var(--coral-500); color: #fff; }
.btn-primary:hover { background: var(--coral-600); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--ink-700); border: 1.5px solid var(--ink-200); }
.btn-outline:hover { border-color: var(--coral-500); color: var(--coral-600); }

.portal-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

.portal-card {
  background: var(--surface);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 0;
  overflow: hidden;
}
.portal-card-stay { grid-column: 1 / -1; }
.portal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--ink-100);
  flex-wrap: wrap;
}
.portal-card-head h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-900);
  margin: 0;
}
.portal-card-sub { color: var(--ink-500); font-size: 12px; }
.portal-card-body { padding: 18px 22px 22px; }

.portal-empty {
  text-align: center;
  color: var(--ink-500);
  padding: 24px 12px;
  font-size: 14px;
}
.portal-empty p { margin: 0 0 10px; }
.portal-empty .btn { margin-top: 8px; }

.portal-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 16px 0 4px;
  font-size: 13px;
  color: var(--ink-500);
}
.portal-footer a {
  color: var(--ink-700);
  text-decoration: none;
}
.portal-footer a:hover { color: var(--coral-500); }
.portal-footer-sep { color: var(--ink-300); }

/* Stay card content */
.stay-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.stay-status-active { background: #dcfce7; color: #15803d; }
.stay-status-upcoming { background: var(--coral-50); color: var(--coral-700); }
.stay-pet { font-size: 16px; color: var(--ink-700); margin-bottom: 4px; }
.stay-pet strong { color: var(--ink-900); }
.stay-dates { font-size: 18px; font-family: 'Fraunces', Georgia, serif; color: var(--ink-900); margin-bottom: 6px; font-weight: 600; }
.stay-kennel { font-size: 13px; color: var(--ink-700); margin-bottom: 10px; }
.stay-services { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.svc-pill {
  display: inline-block;
  background: var(--coral-50);
  color: var(--coral-700);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}
.stay-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--ink-100);
}
.stay-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-700);
}
.stay-meta-row .mono { font-family: 'JetBrains Mono', Menlo, monospace; font-size: 12px; }
.stay-meta-row > span:last-child { color: var(--ink-900); font-weight: 500; }

/* Pets grid */
.portal-pets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.pet-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-md);
  padding: 12px;
}
.pet-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.pet-avatar-dog { background: var(--coral-500); }
.pet-avatar-cat { background: var(--teal-600); }
.pet-avatar-hamster { background: var(--sun-400); color: var(--ink-900); }
.pet-avatar-rabbit { background: #a78bfa; }
.pet-avatar-bird { background: #60a5fa; }
.pet-avatar-other { background: var(--ink-500); }
.pet-body { min-width: 0; }
.pet-name { font-weight: 600; font-size: 14px; color: var(--ink-900); }
.pet-sub { font-size: 11px; color: var(--ink-500); margin-top: 2px; }
.pet-vax-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 999px;
  margin-top: 4px;
}
.pet-vax-badge.ok { background: #dcfce7; color: #15803d; }
.pet-vax-badge.warn { background: #fef3c7; color: #92400e; }
.pet-vax-badge.bad { background: #fee2e2; color: #b91c1c; }

/* Photos */
.portal-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.portal-photo {
  background: var(--bg);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.portal-photo img { width: 100%; height: 160px; object-fit: cover; display: block; }
.portal-photo-meta { padding: 8px 10px; }
.portal-photo-cap { font-size: 12px; color: var(--ink-900); margin-bottom: 2px; }
.portal-photo-when { font-size: 10px; color: var(--ink-500); }

/* History rows */
.hist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ink-100);
}
.hist-row:last-child { border-bottom: 0; }
.hist-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}
.hist-tag-active { background: #dcfce7; color: #15803d; }
.hist-tag-upcoming { background: var(--coral-50); color: var(--coral-700); }
.hist-tag-past { background: var(--ink-100); color: var(--ink-500); }
.hist-tag-cancelled { background: #fee2e2; color: #b91c1c; }
.hist-body { flex: 1; min-width: 0; }
.hist-pet { font-weight: 500; font-size: 14px; color: var(--ink-900); }
.hist-dates { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.hist-amt { font-family: 'Fraunces', Georgia, serif; font-size: 15px; color: var(--ink-900); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-900);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  animation: toastIn 200ms ease-out;
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Mobile ---------- */
@media (max-width: 800px) {
  .portal-grid { grid-template-columns: 1fr; }
  .portal-card-stay { grid-column: 1; }
  .portal-form-grid { grid-template-columns: 1fr; }
  .portal-card-login { padding: 28px 22px; margin: 24px auto; }
  .portal-h1 { font-size: 24px; }
}
@media (max-width: 480px) {
  .portal-shell { padding: 16px 12px 48px; }
  .portal-topbar-hi { font-size: 20px; }
  .portal-photo img { height: 130px; }
}

/* ---------- Dark mode ---------- */
html[data-theme="dark"] {
  --surface: #1a1f2e;
  --bg: #11151f;
  --ink-100: #232a3d;
  --ink-200: #2d3548;
  --ink-300: #5a6378;
  --ink-500: #8a93a8;
  --ink-700: #b8c0d0;
  --ink-900: #e8ecf3;
}
html[data-theme="dark"] body { background: #0f1320; color: var(--ink-900); }

/* ---------- Cancellation modal ---------- */
#cancel-modal.hidden { display: none; }
#cancel-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 31, 26, 0.5);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(58, 33, 21, 0.2);
}
.modal-card h3 { margin: 0 0 8px; font-size: 18px; }
.modal-card p { font-size: 13px; color: #5a5048; margin: 0 0 14px; line-height: 1.5; }
.modal-card .field { display: flex; flex-direction: column; gap: 4px; }
.modal-card textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid #eadfd2;
  border-radius: 6px;
  resize: vertical;
  font-size: 14px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #5a5048;
  line-height: 1;
  padding: 4px 10px;
}
.modal-close:hover { color: #2a1f1a; }
html[data-theme="dark"] .modal-card { background: #1a1f2e; color: var(--ink-900); }
html[data-theme="dark"] .modal-card textarea { background: #11151f; color: var(--ink-900); border-color: #2d3548; }
html[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.7); }

/* ---------- Portal pet documents ---------- */
.pet-docs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.pet-doc {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: #fdf6ec;
  border: 1px solid #eadfd2;
  border-radius: 6px;
  font-size: 12px;
}
.pet-doc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2a1f1a; }
.pet-doc-size { color: #7a6a60; font-size: 11px; }
.pet-doc-upload { margin-top: 8px; }
.pet-doc-upload label.btn { display: inline-block; cursor: pointer; }
html[data-theme="dark"] .pet-doc { background: #11151f; border-color: #2d3548; }
html[data-theme="dark"] .pet-doc-name { color: var(--ink-900); }
html[data-theme="dark"] .pet-doc-size { color: var(--ink-500); }

/* ---------- Portal cancellation status badges ---------- */
.hist-cancel-pending {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  color: #c8482a;
  background: #fff5f1;
  padding: 3px 8px;
  border-radius: 999px;
}
.hist-cancel-decided {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
}
.hist-cancel-decided.approved { color: #14532d; background: #d1e7dd; }
.hist-cancel-decided.denied { color: #c8482a; background: #fff5f1; }
html[data-theme="dark"] .hist-cancel-pending { background: #3a1a1a; color: #fecaca; }
html[data-theme="dark"] .hist-cancel-decided.approved { background: #1a3a2a; color: #b6e4c5; }

/* ---------- Portal toast (success notifications) ---------- */
.portal-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #2a1f1a;
  color: #fff8f0;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  animation: portal-toast-in 0.3s ease;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}
.portal-toast strong { display: block; font-size: 14px; }
.portal-toast span { display: block; font-size: 13px; opacity: 0.9; }
.portal-toast-success {
  background: #14532d;
  color: #fff8f0;
  border: 1px solid #bbf7d0;
}
.portal-toast.hide { opacity: 0; transition: opacity 600ms ease; }
@keyframes portal-toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
html[data-theme="dark"] .portal-bg {
  background:
    radial-gradient(circle at 8% 14%, rgba(255, 122, 89, 0.15) 0, transparent 28%),
    radial-gradient(circle at 92% 88%, rgba(14, 124, 134, 0.18) 0, transparent 32%),
    radial-gradient(circle at 50% 50%, transparent 0, #0f1320 70%);
}
html[data-theme="dark"] .login-error { background: #3a1a1a; border-color: #b91c1c; color: #fecaca; }
html[data-theme="dark"] .field input, html[data-theme="dark"] .field select, html[data-theme="dark"] .field textarea {
  background: var(--bg);
  color: var(--ink-900);
  border-color: var(--ink-200);
}
html[data-theme="dark"] .demo-owner-btn { background: var(--bg); border-color: var(--ink-200); }
html[data-theme="dark"] .demo-owner-btn:hover { background: rgba(255, 122, 89, 0.1); }
html[data-theme="dark"] .portal-icon-btn { background: var(--bg); border-color: var(--ink-200); color: var(--ink-900); }
html[data-theme="dark"] .pet-card { background: var(--bg); border-color: var(--ink-200); }
html[data-theme="dark"] .portal-photo { background: var(--bg); border-color: var(--ink-200); }
html[data-theme="dark"] .hist-row { border-color: var(--ink-200); }
html[data-theme="dark"] .btn-outline { color: var(--ink-900); border-color: var(--ink-300); }
html[data-theme="dark"] .btn-outline:hover { border-color: var(--coral-500); color: var(--coral-500); }
html[data-theme="dark"] .stay-status-upcoming { background: rgba(255, 122, 89, 0.18); color: var(--coral-500); }
html[data-theme="dark"] .svc-pill { background: rgba(255, 122, 89, 0.18); color: var(--coral-500); }
html[data-theme="dark"] .pet-vax-badge.warn { background: rgba(251, 191, 36, 0.18); color: #fbbf24; }
html[data-theme="dark"] .pet-vax-badge.bad { background: rgba(248, 113, 113, 0.18); color: #f87171; }
html[data-theme="dark"] .hist-tag-upcoming { background: rgba(255, 122, 89, 0.18); color: var(--coral-500); }
html[data-theme="dark"] .hist-tag-past { background: var(--ink-200); color: var(--ink-500); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* === Portal pet card: "Book a stay" action (v12) === */
.pet-card-actions { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); display: flex; gap: 8px; flex-wrap: wrap; }
.pet-card-actions .btn { width: auto; }
