/*
  Property Shoot Log — "even better" refinement layer
  ====================================================
  Loaded after style.css. Keeps the original look (system SF Pro type,
  iOS blue #0a84ff, the same greens / oranges / reds and card shapes) and
  refines it. Nothing here changes app logic.

  Contents
  1. Missing tokens (fixes four variables the original used but never defined)
  2. Hero card tokens (so the banner can follow the theme)
  3. Dark mode (automatic, or forced from Settings → Appearance)
  4. Typography polish (tabular numbers, balanced headings, smoothing)
  5. Fixes (Company dropdown alignment)
  6. Cards (two-line property titles, hero illustration)
  7. Interaction (focus rings, press feedback, reduced motion)
  8. Appearance control (Settings)
  9. Wide screens (tablet / desktop layout)
*/

/* 1. Missing tokens ------------------------------------------------------ */
:root {
  --fw-title: var(--fw-page-title, 600);
  --ink: var(--color-text);
  --soft: var(--color-surface-soft);
  --surface-muted: var(--color-surface-muted);
  --eb-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* 2. Hero tokens (light) ---------------------------------------------- */
:root {
  --eb-chevron: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.5 7.5L10 12L14.5 7.5' stroke='%23111827' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --eb-hero-bg:
    radial-gradient(circle at 92% 18%, rgba(255, 255, 255, 0.76) 0 16%, rgba(255, 255, 255, 0) 17%),
    linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(125, 211, 252, 0.28) 48%, rgba(240, 253, 250, 0.92));
  --eb-hero-image-fade:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.9) 34%, rgba(255, 255, 255, 0.54) 58%, rgba(255, 255, 255, 0.16) 100%);
  --eb-hero-mark: rgba(10, 132, 255, 0.22);
}

.booking-next-card,
.booking-next-card.has-banner-image {
  background: var(--eb-hero-bg);
}

.booking-next-image::after {
  background: var(--eb-hero-image-fade);
}

/* 3. Dark mode ------------------------------------------------------------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #000000;
  --color-surface: #1c1c1e;
  --color-surface-soft: #232326;
  --color-surface-muted: #2c2c2e;
  --color-border: #38383a;
  --color-divider: #2c2c2e;
  --color-divider-strong: #323235;
  --color-text: #f5f5f7;
  --color-text-muted: #a1a1a6;
  --color-text-light: #6e6e73;
  --color-primary: #0a84ff;
  --color-primary-soft: rgba(10, 132, 255, 0.18);
  --color-primary-soft-2: rgba(10, 132, 255, 0.2);
  --color-primary-soft-3: rgba(10, 132, 255, 0.26);
  --color-primary-bg: rgba(10, 132, 255, 0.14);
  --color-primary-border: rgba(10, 132, 255, 0.3);
  --color-primary-border-strong: rgba(10, 132, 255, 0.36);
  --color-primary-icon-border: rgba(10, 132, 255, 0.12);
  --color-primary-tint: rgba(10, 132, 255, 0.16);
  --color-primary-glow: rgba(10, 132, 255, 0.22);
  --color-success: #30d158;
  --color-success-text: #4ade80;
  --color-success-dark: #30d158;
  --color-success-soft: rgba(48, 209, 88, 0.16);
  --color-success-soft-2: rgba(48, 209, 88, 0.14);
  --color-success-border: rgba(48, 209, 88, 0.3);
  --color-warning: #ff9f0a;
  --color-warning-text: #ffb340;
  --color-warning-dark: #ffb340;
  --color-warning-deep: #ffc266;
  --color-warning-soft: rgba(255, 159, 10, 0.16);
  --color-warning-bg: rgba(255, 159, 10, 0.12);
  --color-warning-border: rgba(255, 159, 10, 0.3);
  --color-warning-border-strong: rgba(255, 159, 10, 0.36);
  --color-danger: #ff453a;
  --color-danger-dark: #ff6961;
  --color-danger-text: #ff6961;
  --color-danger-text-2: #ff6961;
  --color-danger-soft: rgba(255, 69, 58, 0.18);
  --color-danger-soft-2: rgba(255, 69, 58, 0.13);
  --color-danger-border: rgba(255, 69, 58, 0.3);
  --color-danger-border-soft: rgba(255, 69, 58, 0.18);
  --color-danger-border-strong: rgba(255, 69, 58, 0.36);
  --color-muted-pill: #2c2c2e;
  --color-disabled-bg: #2c2c2e;
  --color-grabber: #48484a;
  --color-neutral-text: #a1a1a6;
  --color-neutral-border: #48484a;
  --color-neutral-soft: #8e8e93;
  --color-backdrop: rgba(0, 0, 0, 0.56);
  --color-sheet-bg: rgba(28, 28, 30, 0.97);
  --color-nav-bg: rgba(28, 28, 30, 0.82);
  --color-toast-bg: rgba(58, 58, 60, 0.96);
  --focus-border: rgba(10, 132, 255, 0.7);
  --focus-border-strong: rgba(10, 132, 255, 0.85);
  --focus-ring: rgba(10, 132, 255, 0.28);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --shadow-card-strong: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --shadow-soft: 0 6px 20px rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 18px 55px rgba(0, 0, 0, 0.6);
  --shadow-nav: 0 8px 28px rgba(0, 0, 0, 0.55);
  --shadow-toast: 0 12px 30px rgba(0, 0, 0, 0.5);
  --shadow-button: none;
  --shadow-sticky: 0 -10px 24px rgba(0, 0, 0, 0.5);
  --eb-chevron: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.5 7.5L10 12L14.5 7.5' stroke='%23f5f5f7' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --eb-hero-bg:
    radial-gradient(circle at 92% 18%, rgba(10, 132, 255, 0.22) 0 16%, rgba(10, 132, 255, 0) 17%),
    linear-gradient(135deg, rgba(10, 132, 255, 0.28), rgba(56, 189, 248, 0.14) 52%, rgba(28, 28, 30, 0.96));
  --eb-hero-image-fade:
    linear-gradient(90deg, rgba(28, 28, 30, 0.96) 0%, rgba(28, 28, 30, 0.88) 36%, rgba(28, 28, 30, 0.5) 62%, rgba(28, 28, 30, 0.12) 100%);
  --eb-hero-mark: rgba(255, 255, 255, 0.16);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  color-scheme: dark;
  --color-bg: #000000;
  --color-surface: #1c1c1e;
  --color-surface-soft: #232326;
  --color-surface-muted: #2c2c2e;
  --color-border: #38383a;
  --color-divider: #2c2c2e;
  --color-divider-strong: #323235;
  --color-text: #f5f5f7;
  --color-text-muted: #a1a1a6;
  --color-text-light: #6e6e73;
  --color-primary: #0a84ff;
  --color-primary-soft: rgba(10, 132, 255, 0.18);
  --color-primary-soft-2: rgba(10, 132, 255, 0.2);
  --color-primary-soft-3: rgba(10, 132, 255, 0.26);
  --color-primary-bg: rgba(10, 132, 255, 0.14);
  --color-primary-border: rgba(10, 132, 255, 0.3);
  --color-primary-border-strong: rgba(10, 132, 255, 0.36);
  --color-primary-icon-border: rgba(10, 132, 255, 0.12);
  --color-primary-tint: rgba(10, 132, 255, 0.16);
  --color-primary-glow: rgba(10, 132, 255, 0.22);
  --color-success: #30d158;
  --color-success-text: #4ade80;
  --color-success-dark: #30d158;
  --color-success-soft: rgba(48, 209, 88, 0.16);
  --color-success-soft-2: rgba(48, 209, 88, 0.14);
  --color-success-border: rgba(48, 209, 88, 0.3);
  --color-warning: #ff9f0a;
  --color-warning-text: #ffb340;
  --color-warning-dark: #ffb340;
  --color-warning-deep: #ffc266;
  --color-warning-soft: rgba(255, 159, 10, 0.16);
  --color-warning-bg: rgba(255, 159, 10, 0.12);
  --color-warning-border: rgba(255, 159, 10, 0.3);
  --color-warning-border-strong: rgba(255, 159, 10, 0.36);
  --color-danger: #ff453a;
  --color-danger-dark: #ff6961;
  --color-danger-text: #ff6961;
  --color-danger-text-2: #ff6961;
  --color-danger-soft: rgba(255, 69, 58, 0.18);
  --color-danger-soft-2: rgba(255, 69, 58, 0.13);
  --color-danger-border: rgba(255, 69, 58, 0.3);
  --color-danger-border-soft: rgba(255, 69, 58, 0.18);
  --color-danger-border-strong: rgba(255, 69, 58, 0.36);
  --color-muted-pill: #2c2c2e;
  --color-disabled-bg: #2c2c2e;
  --color-grabber: #48484a;
  --color-neutral-text: #a1a1a6;
  --color-neutral-border: #48484a;
  --color-neutral-soft: #8e8e93;
  --color-backdrop: rgba(0, 0, 0, 0.56);
  --color-sheet-bg: rgba(28, 28, 30, 0.97);
  --color-nav-bg: rgba(28, 28, 30, 0.82);
  --color-toast-bg: rgba(58, 58, 60, 0.96);
  --focus-border: rgba(10, 132, 255, 0.7);
  --focus-border-strong: rgba(10, 132, 255, 0.85);
  --focus-ring: rgba(10, 132, 255, 0.28);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --shadow-card-strong: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --shadow-soft: 0 6px 20px rgba(0, 0, 0, 0.5);
  --shadow-elevated: 0 18px 55px rgba(0, 0, 0, 0.6);
  --shadow-nav: 0 8px 28px rgba(0, 0, 0, 0.55);
  --shadow-toast: 0 12px 30px rgba(0, 0, 0, 0.5);
  --shadow-button: none;
  --shadow-sticky: 0 -10px 24px rgba(0, 0, 0, 0.5);
  --eb-chevron: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.5 7.5L10 12L14.5 7.5' stroke='%23f5f5f7' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --eb-hero-bg:
    radial-gradient(circle at 92% 18%, rgba(10, 132, 255, 0.22) 0 16%, rgba(10, 132, 255, 0) 17%),
    linear-gradient(135deg, rgba(10, 132, 255, 0.28), rgba(56, 189, 248, 0.14) 52%, rgba(28, 28, 30, 0.96));
  --eb-hero-image-fade:
    linear-gradient(90deg, rgba(28, 28, 30, 0.96) 0%, rgba(28, 28, 30, 0.88) 36%, rgba(28, 28, 30, 0.5) 62%, rgba(28, 28, 30, 0.12) 100%);
  --eb-hero-mark: rgba(255, 255, 255, 0.16);
}

/* Surfaces that used literal white in the original */
:root:not([data-theme="light"]) input:focus,
:root:not([data-theme="light"]) textarea:focus,
:root:not([data-theme="light"]) select:focus {
  background-color: var(--surface);
}

:root:not([data-theme="light"]) select {
  background-image: var(--eb-chevron) !important;
}

:root:not([data-theme="light"]) .view-toggle,
:root:not([data-theme="light"]) .portal-user-row,
:root:not([data-theme="light"]) #bookingPhotographerOverlay .portal-active-toggle input[type="checkbox"] {
  background-color: var(--surface);
}

:root:not([data-theme="light"]) input[type="date"]::-webkit-calendar-picker-indicator,
:root:not([data-theme="light"]) input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.4);
}

:root:not([data-theme="light"]) .bottom-nav button:not(.active) {
  color: var(--muted);
}

:root:not([data-theme="light"]) .app-toast {
  color: #ffffff;
}

}

/* Surfaces that used literal white in the original */
:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] textarea:focus,
:root[data-theme="dark"] select:focus {
  background-color: var(--surface);
}

:root[data-theme="dark"] select {
  background-image: var(--eb-chevron) !important;
}

:root[data-theme="dark"] .view-toggle,
:root[data-theme="dark"] .portal-user-row,
:root[data-theme="dark"] #bookingPhotographerOverlay .portal-active-toggle input[type="checkbox"] {
  background-color: var(--surface);
}

:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.4);
}

:root[data-theme="dark"] .bottom-nav button:not(.active) {
  color: var(--muted);
}

:root[data-theme="dark"] .app-toast {
  color: #ffffff;
}


html,
body {
  background-color: var(--bg);
}

/* 4. Typography polish ----------------------------------------------- */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3,
.booking-next-property,
.settings-menu-text strong {
  text-wrap: balance;
}

.stats span,
.report-summary strong,
.card-top,
.booking-date-block,
.booking-compact-time,
.booking-next-time-group strong,
.booking-section-head span,
.log-result-pill,
.settings-menu-text small,
table td,
#pinInput {
  font-variant-numeric: tabular-nums;
}

::selection {
  background: var(--color-primary-soft-3);
}

/* 5. Fixes ---------------------------------------------------------------- */

/* Agent Name and Company sat 4px apart (52px vs 48px controls). */
#formOverlay .shoot-agent-company-row {
  align-items: start;
}

#formOverlay .shoot-agent-company-row select {
  height: 52px;
  min-height: 52px;
}

/* The floating tab bar is already lifted above the home indicator (bottom: max(14px, safe area));
   the original also padded its inside by the same amount, leaving an empty band under the buttons
   on Face ID iPhones (Home Screen web app and the native app). */
.bottom-nav {
  padding-bottom: 5px;
}

/* 6. Cards -------------------------------------------------------------- */

/* Property names wrap to two lines instead of cutting off after one. */
.shoot-list:not(.list-view) .property {
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  white-space: normal !important;
  text-overflow: clip !important;
}

.booking-compact-card h3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

/* The empty translucent box on the Next Booking card becomes a camera mark. */
.booking-next-card::after {
  width: 76px;
  height: 76px;
  right: 22px;
  bottom: 50%;
  transform: translateY(50%);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--eb-hero-mark);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z'/%3E%3Ccircle cx='12' cy='13' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z'/%3E%3Ccircle cx='12' cy='13' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* 7. Interaction ---------------------------------------------------------- */
:where(button, a, select, input, textarea, [role="button"], [tabindex]):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none; /* fields already show the blue focus ring */
}

.sheet:focus {
  outline: none;
}

.shoot-card,
.booking-compact-card,
.booking-next-card {
  transition: transform 0.16s var(--eb-ease), box-shadow 0.16s var(--eb-ease), border-color 0.16s var(--eb-ease);
}

.shoot-card:active,
.booking-compact-card:active,
.booking-next-card:active {
  transform: scale(0.985);
}

@media (hover: hover) and (pointer: fine) {
  .shoot-card:hover,
  .booking-compact-card:hover,
  .settings-menu-card:not(.appearance-card):hover {
    border-color: var(--color-primary-border-strong);
    box-shadow: var(--shadow-soft);
  }
}

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

/* 8. Appearance control ----------------------------------------------------- */
.appearance-card {
  cursor: default;
  display: grid !important;
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr);
  row-gap: 12px;
}

.appearance-card:active {
  transform: none;
}

.theme-segmented {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--color-surface-muted);
}

.theme-segmented button {
  min-height: 36px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: var(--fw-button);
}

.theme-segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

:root[data-theme="dark"] .theme-segmented button.active {
  background: #48484a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-segmented button.active {
    background: #48484a;
  }
}

/* 9. Wide screens ------------------------------------------------------- */
@media (min-width: 900px) {
  .app {
    max-width: 1080px;
    margin-inline: auto;
  }

  .booking-section-list,
  .shoot-list:not(.list-view) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .booking-section-list > *,
  .shoot-list:not(.list-view) > * {
    margin: 0 !important;
  }

  .settings-menu,
  .settings-detail {
    max-width: 720px;
  }
}

/* 10. Print: always print on a light page -------------------------------- */
@media print {
  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
    --color-bg: #ffffff;
    --color-surface: #ffffff;
    --color-surface-soft: #fbfbfc;
    --color-surface-muted: #f3f4f6;
    --color-border: #e5e7eb;
    --color-divider: #eef0f2;
    --color-text: #111827;
    --color-text-muted: #6b7280;
    --color-text-light: #9ca3af;
  }

  .bottom-nav,
  .sync-cluster,
  .report-controls {
    display: none !important;
  }
}
