/* ═══════════════════════════════════════════════════════════
   JEFFREY DESIGN SYSTEM — jeffrey-style.css
   Shared styles across all Jeffrey Cockpit modules
   ═══════════════════════════════════════════════════════════ */

/* ── COLOR TOKENS ── */
:root {
  /* Core palette */
  --bg: #f8f5f0;
  --card: #ffffff;
  --bark: #3d2e1e;
  --clay: #c4845a;
  --moss: #5a6b4a;
  --water: #5a8fa0;
  --sand: #e8dfd0;
  --gold: #b89050;

  /* Text hierarchy */
  --text: #3d2e1e;
  --text-mid: #7a6a58;
  --text-soft: #9a8878;

  /* Surfaces */
  --border: rgba(61,46,30,0.08);
  --shadow-sm: 0 1px 3px rgba(61,46,30,0.04), 0 1px 2px rgba(61,46,30,0.06);
  --shadow-md: 0 4px 12px rgba(61,46,30,0.06), 0 1px 3px rgba(61,46,30,0.04);
  --shadow-lg: 0 8px 24px rgba(61,46,30,0.08), 0 2px 6px rgba(61,46,30,0.04);

  /* Page accent — overridden per page */
  --accent: var(--clay);
  --accent-soft: rgba(196,132,90,0.1);

  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius scale */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 99px;

  /* Transitions */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --duration-fast: 0.15s;
  --duration-normal: 0.25s;

  /* Login gradient */
  --login-gradient: linear-gradient(160deg, #d4e8d0 0%, #e8dfd0 45%, #f0e8dc 100%);
}

/* ── DARK MODE ── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18130e;
    --card: #241c14;
    --bark: #f0e4d4;
    --text: #f0e8d8;
    --text-mid: #b09080;
    --text-soft: #7a6858;
    --border: rgba(240,228,212,0.07);
    --sand: #2e2318;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.2), 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.3), 0 2px 6px rgba(0,0,0,0.1);
    --login-gradient: linear-gradient(160deg, #1a2415 0%, #241c14 45%, #2a2018 100%);
  }
}

/* ── RESET ── */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── TYPOGRAPHY ── */
h1, h2, h3, .heading {
  font-family: 'Fraunces', serif;
  font-weight: 300;
  line-height: 1.1;
}
em, .italic { font-style: italic; }
.accent-text { color: var(--accent); }

/* ── SCREENS ── */
.screen { display: none; }
.screen.active { display: block; }

/* ═══════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════ */
#loginScreen {
  min-height: 100dvh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: var(--login-gradient);
}
#loginScreen.active { display: flex; }

.login-box {
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-logo {
  font-size: 48px;
  margin-bottom: 8px;
  line-height: 1.2;
}
.login-title {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 300;
  color: var(--text);
}
.login-title em {
  font-style: italic;
  color: var(--accent);
}
.login-sub {
  font-size: 14px;
  color: var(--text-mid);
  margin: 10px 0 36px;
  line-height: 1.6;
}
.login-input {
  width: 100%;
  padding: 15px 18px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--card);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  color: var(--text);
  outline: none;
  margin-bottom: 12px;
  transition: border-color var(--duration-normal), box-shadow var(--duration-normal);
}
.login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-input::placeholder {
  color: var(--text-soft);
}
.login-btn {
  width: 100%;
  padding: 15px;
  border-radius: var(--radius-md);
  background: var(--bark);
  color: #fff;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--duration-fast), transform var(--duration-fast);
}
@media (prefers-color-scheme: dark) {
  .login-btn { background: var(--accent); }
}
.login-btn:active { transform: scale(0.98); opacity: 0.85; }
.login-btn:disabled { opacity: 0.5; cursor: default; }
.login-msg {
  font-size: 13px;
  color: var(--text-mid);
  margin-top: 14px;
  line-height: 1.5;
  min-height: 18px;
}
.login-msg.ok { color: var(--moss); }
.login-msg.err { color: #c05050; }

/* ═══════════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════════ */
#appScreen {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 20px 80px;
}
#appScreen.wide { max-width: 680px; }

/* ── TOP BAR ── */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 52px;
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeUp 0.5s var(--ease-out) forwards 0.05s;
}
.top-bar a {
  font-size: 12px;
  color: var(--text-soft);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity var(--duration-fast);
}
.top-bar a:hover { opacity: 1; }
.logout-btn {
  font-size: 12px;
  color: var(--text-soft);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  padding: 0;
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  transition: opacity var(--duration-fast);
}
.logout-btn:hover { opacity: 1; }

/* ── HEADER ── */
.hdr {
  padding: 16px 0 24px;
}
.hdr-eye {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
  opacity: 0;
  animation: fadeUp 0.5s var(--ease-out) forwards 0.08s;
}
.hdr-title {
  font-family: 'Fraunces', serif;
  font-size: 34px;
  font-weight: 300;
  line-height: 1.1;
  opacity: 0;
  animation: fadeUp 0.5s var(--ease-out) forwards 0.14s;
}
.hdr-title em {
  font-style: italic;
  color: var(--accent);
}
.hdr-sub {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 6px;
  opacity: 0;
  animation: fadeUp 0.5s var(--ease-out) forwards 0.2s;
}

/* ═══════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════ */
.tab-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--sand);
  border-radius: var(--radius-md);
  opacity: 0;
  animation: fadeUp 0.4s var(--ease-out) forwards 0.2s;
}
.tab-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-mid);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  white-space: nowrap;
}
.tab-btn.active {
  background: var(--card);
  color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.tab-btn:not(.active):hover {
  color: var(--text);
  background: rgba(255,255,255,0.4);
}
@media (prefers-color-scheme: dark) {
  .tab-btn:not(.active):hover {
    background: rgba(255,255,255,0.05);
  }
}

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-normal);
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card.interactive {
  cursor: pointer;
}
.card.interactive:active {
  transform: scale(0.985);
}

/* Card label (eyebrow text) */
.card-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.card-title {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.2;
}
.card-sub {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform var(--duration-fast), opacity var(--duration-fast), box-shadow var(--duration-normal);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { box-shadow: var(--shadow-md); }

.btn-secondary {
  background: var(--sand);
  color: var(--text);
}
.btn-bark {
  background: var(--bark);
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .btn-bark { background: var(--accent); }
}

.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}
.btn-full { width: 100%; }
.btn-pill { border-radius: var(--radius-pill); }

/* Icon-only button */
.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   INPUTS & FORMS
   ═══════════════════════════════════════════════════════════ */
.input, .textarea, .select {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 300;
  color: var(--text);
  outline: none;
  transition: border-color var(--duration-normal), box-shadow var(--duration-normal);
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder {
  color: var(--text-soft);
}
.textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.6;
}
.select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239a8878' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.form-group {
  margin-bottom: 16px;
}
.form-row {
  display: flex;
  gap: 10px;
}

/* ═══════════════════════════════════════════════════════════
   PILLS / TAGS / BADGES
   ═══════════════════════════════════════════════════════════ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill-default {
  background: var(--sand);
  color: var(--text-mid);
}
.pill-accent {
  background: var(--accent-soft);
  color: var(--accent);
}
.pill-moss {
  background: rgba(90,107,74,0.1);
  color: var(--moss);
}
.pill-water {
  background: rgba(90,143,160,0.1);
  color: var(--water);
}

/* ═══════════════════════════════════════════════════════════
   FILTER PILLS (clickable)
   ═══════════════════════════════════════════════════════════ */
.filter-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-pill {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-mid);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.filter-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.filter-pill:not(.active):hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   MODALS / OVERLAYS
   ═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal);
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-panel {
  background: var(--card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px 32px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s var(--ease-out);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.active .modal-panel {
  transform: translateY(0);
}
.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.modal-title {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 300;
  margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-soft);
}
.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-state-text {
  font-size: 14px;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════
   LOADING / SPINNER
   ═══════════════════════════════════════════════════════════ */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.loading-text {
  font-size: 13px;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════════
   SECTION DIVIDERS
   ═══════════════════════════════════════════════════════════ */
.section-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 24px 0 12px;
}
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */
.app-footer {
  text-align: center;
  padding: 24px 0 32px;
}
.footer-logo {
  font-family: 'Fraunces', serif;
  font-size: 13px;
  font-style: italic;
  color: var(--text-soft);
  opacity: 0.4;
}

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════ */
.text-center { text-align: center; }
.text-soft { color: var(--text-soft); }
.text-mid { color: var(--text-mid); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 10px; letter-spacing: 0.08em; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  #appScreen { padding-left: 32px; padding-right: 32px; }
}

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }

/* ═══════════════════════════════════════════════════════════
   TOAST / NOTIFICATIONS
   ═══════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bark);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 400;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  transition: all 0.3s var(--ease-out);
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
