/* ============================================================
   HOOTIFY — DESIGN SYSTEM
   Identity Partners Brand · Teal-Forward · ND-Friendly
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@600;700&family=Merriweather:ital,wght@0,400;0,700;1,400&family=JetBrains+Mono:wght@400;500&family=DM+Sans:wght@400;500;600&display=swap');

/* ── CSS Custom Properties — Identity Partners Default ── */
:root {
  /* Core Palette */
  --bg-primary:    #f7f3e9;
  --bg-surface:    #efe8dd;
  --fg-primary:    #5b2c3e;
  --fg-muted:      #a88792;
  --border:        #7a4254;
  --accent:        #0f3b3a;
  --accent-light:  #3f6f6a;
  --accent-soft:   #6fa7a3;
  --accent-hover:  #1a5550;

  /* Semantic */
  --success:       #5a7a4f;
  --warning:       #c4925a;
  --danger:        #8b3a3a;
  --info:          #3f6f6a;

  /* Surfaces */
  --surface-1:     #f7f3e9;
  --surface-2:     #efe8dd;
  --surface-3:     #e6ddd2;
  --surface-raised: #faf7f2;

  /* Typography */
  --font-ui:       'Inter', 'DM Sans', system-ui, sans-serif;
  --font-editorial:'Playfair Display', Georgia, serif;
  --font-quote:    'Merriweather', Georgia, serif;
  --font-code:     'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing (4pt grid) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Radius */
  --r-sm:  4px;
  --r-md:  6px;
  --r-lg:  8px;
  --r-xl:  12px;
  --r-2xl: 16px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(15,59,58,0.06), 0 1px 2px rgba(15,59,58,0.04);
  --shadow-md:  0 4px 12px rgba(15,59,58,0.08), 0 2px 4px rgba(15,59,58,0.05);
  --shadow-lg:  0 8px 24px rgba(15,59,58,0.10), 0 4px 8px rgba(15,59,58,0.06);
  --shadow-xl:  0 16px 40px rgba(15,59,58,0.12), 0 8px 16px rgba(15,59,58,0.07);

  /* Transitions */
  --t-fast:   150ms ease;
  --t-base:   250ms ease;
  --t-slow:   400ms ease;
  --t-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --sidebar-w:     240px;
  --sidebar-w-sm:  64px;
  --topbar-h:      56px;
  --panel-w:       320px;
  --content-max:   900px;

  /* Z-index */
  --z-base:    1;
  --z-raised:  10;
  --z-overlay: 100;
  --z-modal:   200;
  --z-toast:   300;
  --z-tooltip: 400;
}

/* ── Theme Variants ── */
[data-theme="teal-rose"] {
  --bg-primary:  #f7f3e9;
  --fg-primary:  #0f3b3a;
  --accent:      #7a4254;
  --accent-hover:#5b2c3e;
}
[data-theme="olive-cream"] {
  --bg-primary:  #f8f6ef;
  --bg-surface:  #eeeadf;
  --fg-primary:  #3d3d2a;
  --accent:      #7a6a3a;
  --accent-hover:#5a4e2a;
}
[data-theme="faded-blue"] {
  --bg-primary:  #f5f4f0;
  --bg-surface:  #eceae4;
  --fg-primary:  #2a3a52;
  --accent:      #c4925a;
  --accent-hover:#a87848;
}
[data-theme="amber-stone"] {
  --bg-primary:  #faf6f0;
  --bg-surface:  #f0e9df;
  --fg-primary:  #4a3a2a;
  --accent:      #b87a3a;
  --accent-hover:#9a6428;
}
[data-theme="sunwashed"] {
  --bg-primary:  #fef9f5;
  --bg-surface:  #f5ede4;
  --fg-primary:  #4a3a4a;
  --accent:      #6ed3cf;
  --accent-hover:#4ab8b4;
}
[data-theme="iced-matcha"] {
  --bg-primary:  #fdfcf8;
  --bg-surface:  #f2f0ea;
  --fg-primary:  #2d2d2d;
  --accent:      #6a8a5a;
  --accent-hover:#527044;
}
[data-theme="dark"] {
  --bg-primary:  #1a1210;
  --bg-surface:  #231815;
  --fg-primary:  #f0e8df;
  --fg-muted:    #9a8080;
  --border:      #4a2a35;
  --accent:      #6fa7a3;
  --accent-light:#8fc4c0;
  --accent-soft: #3f6f6a;
  --accent-hover:#8fc4c0;
  --surface-1:   #1a1210;
  --surface-2:   #231815;
  --surface-3:   #2e201c;
  --surface-raised:#201614;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg:   0 8px 24px rgba(0,0,0,0.4);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--fg-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
}

/* ── Typography Scale ── */
h1, .h1 { font-family: var(--font-editorial); font-size: 2rem;    font-weight: 700; line-height: 1.2; }
h2, .h2 { font-family: var(--font-editorial); font-size: 1.5rem;  font-weight: 600; line-height: 1.3; }
h3, .h3 { font-family: var(--font-ui);        font-size: 1.125rem;font-weight: 600; line-height: 1.4; }
h4, .h4 { font-family: var(--font-ui);        font-size: 1rem;    font-weight: 600; line-height: 1.4; }
h5, .h5 { font-family: var(--font-ui);        font-size: 0.875rem;font-weight: 600; line-height: 1.4; }

p { margin-bottom: var(--sp-4); }
p:last-child { margin-bottom: 0; }

a { color: var(--accent-light); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent-hover); }

code, kbd, samp {
  font-family: var(--font-code);
  font-size: 0.85em;
  background: var(--surface-3);
  padding: 0.1em 0.35em;
  border-radius: var(--r-sm);
  color: var(--accent);
}

pre {
  font-family: var(--font-code);
  font-size: 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  overflow-x: auto;
  line-height: 1.5;
}

pre code { background: none; padding: 0; border-radius: 0; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-full); opacity: 0.5; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-light); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #f7f3e9;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #f7f3e9;
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--fg-primary);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-primary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-surface);
}

.btn-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-light);
}
.btn-accent:hover:not(:disabled) {
  background: var(--accent-light);
  color: #f7f3e9;
}

.btn-danger {
  background: var(--danger);
  color: #f7f3e9;
  border-color: var(--danger);
}

.btn-sm { padding: var(--sp-1) var(--sp-3); font-size: 0.8125rem; }
.btn-lg { padding: var(--sp-3) var(--sp-6); font-size: 1rem; }
.btn-icon { padding: var(--sp-2); aspect-ratio: 1; justify-content: center; }
.btn-icon.btn-sm { padding: var(--sp-1); }

/* ── Form Elements ── */
.input, .textarea, .select {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-raised);
  color: var(--fg-primary);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(63,111,106,0.15);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-muted); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a4254' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

.label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-primary);
  margin-bottom: var(--sp-1);
}

.form-group { margin-bottom: var(--sp-4); }

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-base);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-raised {
  background: var(--surface-raised);
  box-shadow: var(--shadow-md);
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
}
.badge-accent  { background: rgba(15,59,58,0.1);  color: var(--accent); }
.badge-success { background: rgba(90,122,79,0.12); color: var(--success); }
.badge-warning { background: rgba(196,146,90,0.15);color: var(--warning); }
.badge-danger  { background: rgba(139,58,58,0.12); color: var(--danger); }
.badge-muted   { background: var(--surface-3);     color: var(--fg-muted); }
.badge-teal    { background: rgba(111,167,163,0.2); color: var(--accent-light); }

/* ── Dividers ── */
.divider {
  height: 1px;
  background: var(--border);
  opacity: 0.4;
  margin: var(--sp-4) 0;
}

/* ── Tooltips ── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #f7f3e9;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast);
  z-index: var(--z-tooltip);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── Gradients ── */
.gradient-teal    { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%); }
.gradient-rose    { background: linear-gradient(135deg, var(--fg-primary) 0%, var(--fg-muted) 100%); }
.gradient-warm    { background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-surface) 100%); }
.gradient-hero    { background: linear-gradient(135deg, #0f3b3a 0%, #3f6f6a 50%, #6fa7a3 100%); }

/* ── Animations ── */
@keyframes fadeIn    { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn   { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes slideUp   { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse     { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin      { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes shimmer   { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes blink     { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes owlBob    { 0%,100% { transform: translateY(0) rotate(0deg); } 25% { transform: translateY(-3px) rotate(-2deg); } 75% { transform: translateY(-1px) rotate(2deg); } }

.animate-fade-in  { animation: fadeIn  var(--t-base) ease both; }
.animate-slide-up { animation: slideUp var(--t-base) ease both; }
.animate-pulse    { animation: pulse 2s ease infinite; }
.animate-spin     { animation: spin 1s linear infinite; }

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-md);
}

/* ── Utility Classes ── */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center{ align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.w-full { width: 100%; }
.h-full { height: 100%; }
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.text-sm   { font-size: 0.875rem; }
.text-xs   { font-size: 0.75rem; }
.text-muted{ color: var(--fg-muted); }
.text-accent{ color: var(--accent-light); }
.font-mono { font-family: var(--font-code); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only   { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.relative  { position: relative; }
.absolute  { position: absolute; }
.fixed     { position: fixed; }
.inset-0   { inset: 0; }
.z-modal   { z-index: var(--z-modal); }
.rounded   { border-radius: var(--r-lg); }
.rounded-full { border-radius: var(--r-full); }
.border    { border: 1px solid var(--border); }
.p-2 { padding: var(--sp-2); }
.p-3 { padding: var(--sp-3); }
.p-4 { padding: var(--sp-4); }
.p-6 { padding: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.ml-auto { margin-left: auto; }
.opacity-50 { opacity: 0.5; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.pointer-events-none { pointer-events: none; }

/* ── Markdown Content ── */
.prose { max-width: 72ch; line-height: 1.7; }
.prose h1,.prose h2,.prose h3,.prose h4 { margin-top: 1.5em; margin-bottom: 0.5em; }
.prose p { margin-bottom: 1em; }
.prose ul,.prose ol { padding-left: 1.5em; margin-bottom: 1em; }
.prose li { margin-bottom: 0.25em; }
.prose blockquote { border-left: 3px solid var(--accent-soft); padding-left: 1em; color: var(--fg-muted); font-style: italic; margin: 1em 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 0.9em; }
.prose th { background: var(--surface-2); padding: 8px 12px; text-align: left; font-weight: 600; border: 1px solid var(--border); }
.prose td { padding: 8px 12px; border: 1px solid var(--border); }
.prose tr:nth-child(even) td { background: var(--surface-2); }
.prose strong { font-weight: 600; color: var(--fg-primary); }
.prose em { font-style: italic; color: var(--fg-primary); }
.prose code { font-family: var(--font-code); font-size: 0.85em; background: var(--surface-3); padding: 0.1em 0.35em; border-radius: var(--r-sm); }
.prose pre { margin: 1em 0; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; opacity: 0.4; }

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  z-index: var(--z-toast);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  pointer-events: all;
  animation: slideUp var(--t-base) ease both;
  max-width: 360px;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--accent-light); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,59,58,0.3);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--t-fast) ease;
}
.modal {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp var(--t-base) ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--border);
}
.modal-body { padding: var(--sp-6); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
}

/* ── Tabs ── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--sp-4); }
.tab {
  padding: var(--sp-2) var(--sp-4);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.tab:hover { color: var(--fg-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Progress ── */
.progress-bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
  border-radius: var(--r-full);
  transition: width var(--t-slow);
}

/* ── Collapsible ── */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  transition: background var(--t-fast);
  user-select: none;
}
.collapsible-header:hover { background: var(--surface-2); }
.collapsible-content { overflow: hidden; transition: max-height var(--t-slow); }
.collapsible-icon { transition: transform var(--t-base); }
.collapsible-icon.open { transform: rotate(180deg); }

/* ── Responsive ── */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
    --topbar-h: 52px;
  }
  .hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
  .show-mobile { display: none !important; }
}