/* Craftplan Style Guide - CSS Variables */
:root {
  /* Brand */
  --color-brand: #FD4F00;

  /* Stone palette */
  --background: #fafaf9;      /* stone-50 */
  --foreground: #292524;      /* stone-800 */
  --muted: #57534e;           /* stone-600 */
  --subtle: #78716c;          /* stone-500 */
  --border: #d6d3d0;          /* stone-300 */
  --border-subtle: #e7e5e4;   /* stone-200 */
  --card: #ffffff;
  --accent: #4f46e5;          /* indigo-600 */
  --accent-hover: #6366f1;    /* indigo-500 */
  --accent-active: #4338ca;   /* indigo-700 */
  --accent-foreground: #ffffff;

  /* Radius - Style guide uses rounded-md (6px) as primary */
  --radius: 6px;
  --radius-lg: 8px;
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--foreground);
}

/* Navigation Links */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.15s ease;
}

.nav-link:hover,
.nav-link:focus {
  color: #1c1917; /* stone-900 */
  background: rgba(231, 229, 228, 0.5); /* stone-200/50 */
}

.nav-link-active {
  background: rgba(231, 229, 228, 0.7); /* stone-200/70 */
  color: #1c1917; /* stone-900 */
}

/* Headlines */
.headline {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 600;
  line-height: 1.2;
  color: #1c1917; /* stone-900 */
}

.headline-small {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 600;
  color: #1c1917; /* stone-900 */
}

/* Text styles */
.lede {
  color: var(--subtle);
  font-size: 1rem;
  max-width: 52ch;
}

.eyebrow {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}

/* Muted/subtle text */
.muted {
  color: var(--muted);
}

.subtle {
  color: var(--subtle);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0 0.5rem;
  background: #f5f5f4; /* stone-100 */
  color: #44403c; /* stone-700 */
  font-weight: 400;
  font-size: 0.75rem;
  line-height: 1.25rem;
  text-transform: capitalize;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  height: 2.25rem; /* h-9 */
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-foreground);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

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

.btn:active {
  background: var(--accent-active);
  border-color: var(--accent-active);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--border), 0 0 0 3px white;
}

.btn.secondary {
  background: rgba(231, 229, 228, 0.5); /* stone-200/50 */
  color: var(--foreground);
  border-color: var(--border);
}

.btn.secondary:hover {
  background: #e7e5e4; /* stone-200 */
  color: #1f2937; /* gray-800 */
}

/* Form inputs */
.input {
  display: block;
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--foreground);
  font-size: 0.875rem;
  transition: border-color 0.15s ease;
}

.input::placeholder {
  color: #a8a29e; /* stone-400 */
}

.input:focus {
  border-color: #a8a29e; /* stone-400 */
  outline: none;
}

/* List rows */
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

/* Tables */
table {
  border-collapse: collapse;
}

th,
td {
  padding: 0.6rem 0.35rem;
}

thead tr {
  border-bottom: 1px solid var(--border);
}

tbody tr:hover {
  background: rgba(231, 229, 228, 0.4); /* stone-200/40 */
}

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  background: rgba(231, 229, 228, 0.5); /* stone-200/50 */
  color: var(--foreground);
  font-weight: 500;
  font-size: 0.875rem;
  transition: background 0.15s ease;
}

.pill:hover {
  background: #e7e5e4; /* stone-200 */
}

.pill strong {
  color: var(--foreground);
}

/* Focus ring utility */
.focus-ring:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--border), 0 0 0 3px white;
}

/* Sidebar */
.sidebar {
  background: rgba(250, 250, 249, 0.9); /* stone-50/90 */
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: 16rem; /* w-64 */
  border-right: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 40;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
}

.nav-section {
  margin-bottom: 1.5rem;
}

.nav-section-label {
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--subtle);
}

/* Sub navigation link */
.nav-sublink {
  display: flex;
  width: 100%;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
  transition: all 0.15s ease;
}

.nav-sublink:hover {
  background: rgba(231, 229, 228, 0.5);
  color: #1c1917;
}

.nav-sublink-active {
  background: rgba(231, 229, 228, 0.7);
  font-weight: 500;
  color: #1c1917;
}

/* Main content with sidebar */
.main-with-sidebar {
  margin-left: 16rem; /* w-64 */
}

@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-with-sidebar {
    margin-left: 0;
  }
}

/* Mobile header */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 3.5rem;
  background: rgba(250, 250, 249, 0.9);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0 1rem;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 1023px) {
  .mobile-header {
    display: flex;
  }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.5); /* stone-900/50 */
  z-index: 35;
}

.sidebar-overlay.open {
  display: block;
}

/* Force filter panel visible on desktop */
@media (min-width: 1024px) {
  .filter-panel {
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
