/* ========================================
   Sering Project Tracker — Base Styles
   Brand: De Sering Brand Guidelines 2026
   Font: Overused Grotesk (matching desering.org)
   ======================================== */

/* ---- Font ---- */
@font-face {
  font-family: 'Overused Grotesk';
  src: url('/fonts/OverusedGroteskRoman-VF.woff2') format('woff2-variations');
  font-weight: 300 900;
  font-display: swap;
}

:root {
  /* Brand colours */
  --sering-red: #FF3F00;
  --sering-off-white: #F3F1EC;
  --sering-olive: #494C1A;
  --sering-yellow: #ECEB01;
  --sering-black: #000000;
  --sering-burgundy: #8F0500;

  /* Functional colours — matching desering.org */
  --bg-primary: var(--sering-off-white);
  --bg-card: #FFFFFF;
  --bg-card-hover: #FAFAF7;
  --text-primary: var(--sering-olive);
  --text-secondary: rgba(73, 76, 26, 0.7);
  --text-muted: rgba(73, 76, 26, 0.65);
  --accent: var(--sering-red);
  --accent-hover: #E63800;
  --success: var(--sering-olive);
  --highlight: var(--sering-yellow);
  --border: #E0DDD6;
  --border-light: #ECEAE4;
  --color-danger: #cc0000;

  /* Status colours */
  --status-todo: rgba(73, 76, 26, 0.6);
  --status-progress: var(--sering-red);
  --status-done: var(--sering-olive);

  /* Typography — Overused Grotesk to match desering.org */
  --font-family: 'Overused Grotesk', 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-size-base: 16px;
  --font-size-sm: 14px;
  --font-size-xs: 12px;
  --font-size-lg: 18px;
  --font-size-xl: 24px;
  --font-size-2xl: 32px;
  --font-size-3xl: 46px;
  --font-size-subtitle: 20px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;

  /* Layout */
  --max-width: 960px;
  --nav-height: 60px;

  /* Borders — matching desering.org rounded style */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 999px;

  /* Shadows — subtle, warm */
  --shadow-sm: 0 1px 3px rgba(73, 76, 26, 0.06);
  --shadow-md: 0 4px 12px rgba(73, 76, 26, 0.08);
  --shadow-lg: 0 8px 24px rgba(73, 76, 26, 0.12);
}

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

html {
  font-size: var(--font-size-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
}

/* ---- Typography ---- */
h1 { font-size: var(--font-size-2xl); font-weight: 600; line-height: 1.2; color: var(--text-primary); }
h2 { font-size: var(--font-size-xl); font-weight: 600; line-height: 1.3; color: var(--text-primary); }
h3 { font-size: var(--font-size-lg); font-weight: 500; line-height: 1.4; color: var(--text-primary); }
p { color: var(--text-secondary); }
a { color: var(--accent); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

/* ---- Layout ---- */
#app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
  padding-top: calc(var(--nav-height) + var(--space-lg));
  min-height: 100vh;
}

/* ---- Loading state ---- */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
  font-size: var(--font-size-lg);
}

.loading-spinner::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin-right: var(--space-sm);
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Navigation — matching desering.org pill style ---- */
#top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: #FFFFFF;
  color: var(--text-primary);
  z-index: 100;
  border-bottom: 1px solid var(--border-light);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
  gap: var(--space-sm);
}

.nav-logo {
  font-weight: 600;
  font-size: var(--font-size-xl);
  color: var(--accent) !important;
  text-decoration: none !important;
  white-space: nowrap;
  margin-right: var(--space-sm);
}

#nav-links {
  display: flex;
  gap: 6px;
  flex: 1;
}

#nav-links a {
  color: var(--text-primary);
  text-decoration: none;
  padding: 4px 14px 6px;
  border-radius: 10px;
  font-size: var(--font-size-base);
  font-weight: 400;
  background: var(--sering-off-white);
  transition: background 0.15s, color 0.15s;
}

#nav-links a:hover {
  background: var(--border);
  text-decoration: none;
}

#nav-links a.active {
  color: var(--sering-off-white);
  background: var(--accent);
}

#nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

#user-name {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* ---- Buttons — rounder, matching desering.org ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover { background: #D5D2CB; }

.btn-small {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
  background: var(--sering-off-white);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-small:hover { background: var(--border); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-card-hover); border-color: var(--text-muted); }

.btn-danger {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}
.btn-danger:hover { background: var(--color-danger); color: white; }

/* ---- Cards — warm, less corporate ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  border: 1px solid var(--border-light);
  transition: border-color 0.15s;
}

.card:hover {
  border-color: var(--border);
}

.card-clickable {
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.card-clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* ---- Tags / Pills ---- */
.tag {
  display: inline-block;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 500;
  line-height: 1.5;
}

.tag-group {
  background: var(--sering-olive);
  color: white;
}

.tag-status-todo { background: var(--sering-off-white); color: var(--status-todo); }
.tag-status-in_progress { background: #FFF0EB; color: var(--status-progress); }
.tag-status-done { background: #EEF3E5; color: var(--status-done); }

.tag-join-open { background: #EEF3E5; color: var(--status-done); }
.tag-join-contact { background: #FFF0EB; color: var(--accent); }
.tag-join-closed { background: var(--border); color: var(--text-secondary); }

/* ---- Forms ---- */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 10px var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 63, 0, 0.1);
}

textarea { resize: vertical; min-height: 80px; }

label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.form-group { margin-bottom: var(--space-md); }
.form-row { display: flex; gap: var(--space-md); }
.form-row > * { flex: 1; }

/* ---- Overlay (name entry) ---- */
.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.overlay-card h1 {
  font-size: var(--font-size-xl);
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.overlay-card p {
  margin-bottom: var(--space-lg);
}

.overlay-warning {
  display: inline-block;
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--sering-olive);
  background: var(--sering-yellow);
  border-radius: var(--radius-full);
  padding: var(--space-xs) var(--space-md);
  margin-bottom: var(--space-lg);
}

.overlay-card input {
  margin-bottom: var(--space-md);
  text-align: center;
  font-size: var(--font-size-lg);
}

.overlay-card .btn {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-size: var(--font-size-base);
  font-weight: 600;
  border-radius: var(--radius-full);
  justify-content: center;
}

/* ---- Progress bar ---- */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--success);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ---- Toast notifications ---- */
#toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--sering-olive);
  color: white;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease;
}

.toast-error { background: var(--color-danger); }
.toast-success { background: var(--success); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(73, 76, 26, 0.4);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 { margin-bottom: var(--space-lg); }

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-lg);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---- Utility ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

/* ---- Rich content (from Quill editor) ---- */
.rich-content {
  line-height: 1.6;
  color: var(--text-primary);
}

.rich-content h2 {
  font-size: var(--font-size-xl);
  margin: var(--space-md) 0 var(--space-sm);
}

.rich-content h3 {
  font-size: var(--font-size-lg);
  margin: var(--space-md) 0 var(--space-sm);
}

.rich-content p {
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.rich-content ul,
.rich-content ol {
  margin: var(--space-sm) 0;
  padding-left: var(--space-lg);
}

.rich-content li {
  margin-bottom: var(--space-xs);
}

.rich-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-md);
  margin: var(--space-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}

.rich-content a {
  color: var(--accent);
  text-decoration: underline;
}

/* ---- Quill editor overrides ---- */
.ql-container {
  font-family: var(--font-family) !important;
  font-size: var(--font-size-base) !important;
  border-color: var(--border) !important;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
  background: var(--bg-card);
}

.ql-toolbar {
  border-color: var(--border) !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
  background: var(--bg-card-hover);
}

.ql-editor {
  min-height: 80px;
  max-height: 300px;
  overflow-y: auto;
}

.ql-editor.ql-blank::before {
  font-style: normal !important;
  color: var(--text-muted) !important;
}

.ql-snow .ql-stroke {
  stroke: var(--text-secondary) !important;
}

.ql-snow .ql-fill {
  fill: var(--text-secondary) !important;
}

.ql-snow .ql-picker {
  color: var(--text-secondary) !important;
}

.ql-editor:focus {
  outline: none;
}

.ql-container:focus-within {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(255, 63, 0, 0.1);
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-muted);
}

.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

/* ---- Screen transition ---- */
#app {
  animation: screen-in 0.15s ease;
}

@keyframes screen-in {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* ---- Focus-visible for keyboard accessibility ---- */
.btn:focus-visible,
.btn-small:focus-visible,
.btn-ghost:focus-visible,
.btn-danger:focus-visible,
.btn-icon:focus-visible,
.card-clickable:focus-visible,
#nav-links a:focus-visible,
.task-status-btn:focus-visible,
.carousel-btn:focus-visible,
.voice-note-btn:focus-visible,
.media-delete-btn:focus-visible,
.tag:focus-visible,
.budget-project-header:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

/* ---- Modal ARIA ---- */
.modal-backdrop[role="dialog"] {
  /* Ensure focus trapping styles */
}

/* ---- Disabled button state ---- */
.btn:disabled, .btn-primary:disabled, .btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
