/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0a0a0a;
  --bg-2:         #141414;
  --bg-3:         #1c1c1e;
  --bg-4:         #2c2c2e;
  --border:       #2c2c2e;
  --border-light: #3a3a3c;
  --accent:       #f5a623;
  --accent-dim:   rgba(245,166,35,0.12);
  --accent-glow:  rgba(245,166,35,0.25);
  --green:        #30d158;
  --green-dim:    rgba(48,209,88,0.12);
  --red:          #ff453a;
  --red-dim:      rgba(255,69,58,0.12);
  --blue:         #0a84ff;
  --blue-dim:     rgba(10,132,255,0.12);
  --white:        #ffffff;
  --off-white:    #e5e5e7;
  --muted:        #8e8e93;
  --muted-2:      #636366;
  --font-main:    'Titillium Web', sans-serif;
  --font-mono:    'DM Mono', monospace;
  --safe-top:     env(safe-area-inset-top, 0px);
  --safe-bottom:  env(safe-area-inset-bottom, 0px);
  --header-h:     56px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--off-white);
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ── Screens ── */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.screen.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* ── Auth Screen ── */
.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.auth-glow {
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(245,166,35,0.15) 0%, transparent 70%);
  animation: pulse 4s ease-in-out infinite;
}
.auth-grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.4;
}
@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}
.auth-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px 24px;
  padding-top: calc(var(--safe-top) + 40px);
  gap: 32px;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
}
.logo-img.small {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.logo-text { display: flex; flex-direction: column; gap: 2px; }
.logo-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--white);
}
.logo-sub {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.auth-desc {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  line-height: 1.6;
}
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: var(--white);
  color: #1a1a1a;
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-google:active { opacity: 0.85; transform: scale(0.98); }
.auth-note {
  font-size: 12px;
  color: var(--muted-2);
  text-align: center;
  letter-spacing: 0.02em;
}

/* ── Project Screen ── */
.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 16px) 20px 16px;
  border-bottom: 1px solid var(--border);
}
.auth-logo.small { gap: 10px; }
.auth-logo.small .logo-title { font-size: 15px; }
.btn-signout {
  font-family: var(--font-main);
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.btn-signout:hover { color: var(--off-white); border-color: var(--muted); }
.project-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px;
  padding-bottom: calc(var(--safe-bottom) + 32px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}
.project-heading {
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.02em;
}
.project-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: -8px;
}
.input-group { display: flex; flex-direction: column; gap: 8px; }
.input-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}
.input-field {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--off-white);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.input-field:focus { border-color: var(--accent); }
.code-input {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: center;
}
.code-error {
  font-size: 12px;
  color: var(--red);
  text-align: center;
}
.input-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-2);
  font-size: 12px;
  letter-spacing: 0.05em;
}
.input-divider::before,
.input-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

/* ── Buttons ── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 24px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-primary:active { opacity: 0.85; transform: scale(0.98); }
.btn-primary.full { width: 100%; }
.btn-primary:disabled { opacity: 0.4; pointer-events: none; }

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 13px 24px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-secondary:active { color: var(--off-white); border-color: var(--muted); }

/* ── Recent Projects ── */
.recent-projects { display: flex; flex-direction: column; gap: 12px; }
.recent-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--muted-2);
  text-transform: uppercase;
}
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.recent-item:active { background: var(--bg-4); }
.recent-item-name { font-size: 14px; font-weight: 600; color: var(--off-white); }
.recent-item-id { font-size: 11px; color: var(--muted-2); font-family: var(--font-mono); }
.recent-arrow { color: var(--muted-2); }

/* ── App Header ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: calc(var(--header-h) + var(--safe-top));
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 8px; }
.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  color: var(--off-white);
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.btn-icon:active { background: var(--bg-4); }

/* Add Shot button — accent colored */
.btn-add {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: var(--bg);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.btn-add:active { opacity: 0.85; transform: scale(0.95); }

.header-project { display: flex; flex-direction: column; gap: 1px; }
.project-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.02em;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shot-count { font-size: 11px; color: var(--muted); }

.sync-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  transition: all 0.3s;
}
.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  transition: background 0.3s;
}
.sync-indicator.syncing { border-color: var(--accent); color: var(--accent); }
.sync-indicator.syncing .sync-dot { background: var(--accent); animation: blink 0.8s ease-in-out infinite; }
.sync-indicator.error { border-color: var(--red); color: var(--red); }
.sync-indicator.error .sync-dot { background: var(--red); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: calc(var(--header-h) + var(--safe-top));
  z-index: 99;
}
.search-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.search-add-row .search-wrap {
  flex: 1;
}
.search-add-row .btn-add {
  flex-shrink: 0;
}
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 12px;
  color: var(--muted-2);
  pointer-events: none;
}
.input-search {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 9px 12px 9px 36px;
  color: var(--off-white);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.input-search:focus { border-color: var(--accent); }
.input-search::placeholder { color: var(--muted-2); }

/* ── Results Count ── */
.results-count {
  display: none;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 2px 0;
}
.results-count.visible { display: flex; }
.rc-total    { color: var(--accent);  font-weight: 700; }
.rc-remaining{ color: var(--red);     font-weight: 700; }
.rc-complete { color: var(--green);   font-weight: 700; }
.rc-label    { color: var(--muted);   font-weight: 400; }
.rc-divider  { color: var(--muted-2); font-weight: 400; }

/* ── Filter Row ── */
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-row-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  flex-shrink: 0;
  width: 44px;
}

/* ── Filter Chips ── */
.filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 5px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  color: var(--muted);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.chip.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Priority chip colors when active */
.chip.priority-must.active {
  background: var(--red-dim);
  border-color: var(--red);
  color: var(--red);
}
.chip.priority-nice.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.chip.priority-broll.active {
  background: var(--blue-dim);
  border-color: var(--blue);
  color: var(--blue);
}

/* Camera type chip — multi-select: active = accent, selected = stronger */
.chip.type-selected {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Filter Selects ── */
.filter-selects {
  display: flex;
  gap: 8px;
}
.select-filter {
  flex: 1;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--off-white);
  font-family: var(--font-main);
  font-size: 13px;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.select-filter:focus { border-color: var(--accent); }

/* ── Shot List ── */
.shot-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  padding-bottom: calc(var(--safe-bottom) + 80px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 24px;
  color: var(--muted);
  font-size: 14px;
}
.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Shot Card ── */
.shot-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, background 0.2s;
  animation: fadeUp 0.25s ease both;
}
.shot-card.complete {
  background: var(--bg-2);
  border-color: var(--border);
  opacity: 0.6;
}
.shot-card.has-graphics { border-left: 3px solid var(--accent); }
.shot-card.is-new { border-color: var(--green); }

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

.shot-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.shot-checkbox {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  background: var(--bg-4);
  border: 2px solid var(--border-light);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 2px;
}
.shot-checkbox.checked {
  background: var(--green);
  border-color: var(--green);
}
.shot-checkbox svg { opacity: 0; transition: opacity 0.15s; }
.shot-checkbox.checked svg { opacity: 1; }

.shot-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.shot-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.shot-id {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.shot-lesson {
  font-size: 11px;
  color: var(--muted-2);
  background: var(--bg-4);
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
}
.shot-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Priority badge on card */
.shot-priority {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
}
.shot-priority.must-have {
  background: var(--red-dim);
  color: var(--red);
}
.shot-priority.nice-to-have {
  background: var(--accent-dim);
  color: var(--accent);
}
.shot-priority.b-roll {
  background: var(--blue-dim);
  color: var(--blue);
}

.shot-desc {
  font-size: 14px;
  font-weight: 600;
  color: var(--off-white);
  line-height: 1.4;
}
/* Outline description — replaces dialogue in scripted version */
.shot-outline {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  font-style: italic;
}
/* Scene / Location */
.shot-scene {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 2px;
}
.shot-scene svg { flex-shrink: 0; }

.shot-card.complete .shot-desc { text-decoration: line-through; color: var(--muted-2); }

/* ── Card bottom notes ── */
.shot-card-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.shot-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-4);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.shot-note-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  flex-shrink: 0;
  padding-top: 1px;
  min-width: 52px;
}
.shot-note.graphics .shot-note-label { color: var(--accent); }

/* ── Card actions ── */
.shot-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}
.btn-note {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-4);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.03em;
}
.btn-note:active { background: var(--border-light); }
.btn-note.has-content { border-color: var(--accent); color: var(--accent); }

/* ── Offline Banner ── */
.offline-banner {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  z-index: 200;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}
.modal-sheet {
  position: relative;
  z-index: 1;
  background: var(--bg-3);
  border-top: 1px solid var(--border-light);
  border-radius: 20px 20px 0 0;
  padding: 16px 20px calc(var(--safe-bottom) + 20px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
/* Taller sheet for add shot modal */
.modal-sheet-tall {
  max-height: 90vh;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  margin: 0 auto 4px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-shot-id {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.modal-body-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.modal-field { display: flex; flex-direction: column; gap: 8px; }
.modal-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.modal-required { color: var(--red); }
.modal-textarea {
  width: 100%;
  background: var(--bg-4);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--off-white);
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}
.modal-textarea:focus { border-color: var(--accent); }
.modal-input {
  width: 100%;
  background: var(--bg-4);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--off-white);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.modal-input:focus { border-color: var(--accent); }
.modal-select {
  width: 100%;
  background: var(--bg-4);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--off-white);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.modal-select:focus { border-color: var(--accent); }
.modal-row {
  display: flex;
  gap: 12px;
}
.modal-field-sm { flex: 1; }
.modal-footer { padding-top: 4px; }

.add-shot-error {
  font-size: 13px;
  color: var(--red);
  padding: 10px 14px;
  background: var(--red-dim);
  border-radius: 8px;
  border: 1px solid rgba(255,69,58,0.3);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 0; height: 0; }
