/* ── Carlo OS / Life OS Platform — UI Foundation (3E.6B) ── */

@tailwind base;
@tailwind components;
@tailwind utilities;

/* ── Custom Properties ── */
:root {
  --bg-base: #09090b;
  --bg-surface: #18181b;
  --bg-elevated: #27272a;
  --bg-hover: #1f1f23;
  --border: #27272a;
  --border-light: #3f3f46;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #52525b;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-subtle: #292524;
  --status-active: #22c55e;
  --status-pending: #eab308;
  --status-blocked: #ef4444;
  --status-draft: #64748b;
  --status-done: #3b82f6;
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ── Base ── */
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #52525b; }

/* ── Typography ── */
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
code, pre { font-family: var(--font-mono); font-size: 0.8125rem; }

/* ── Layout: sidebar ── */
.sidebar { width: 240px; min-width: 240px; }
@media (max-width: 767px) {
  .sidebar { position: fixed; inset: 0; z-index: 50; transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 40; }
}

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { border-color: var(--border-light); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.card-header { padding: 16px 20px 0; }
.card-body { padding: 16px 20px; }

/* ── Stat cards ── */
.stat-card { padding: 20px; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.stat-label { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 4px; }

/* ── Status badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px;
  font-size: 0.75rem; font-weight: 500; line-height: 1.25rem;
}
.badge-active { background: #052e16; color: #4ade80; }
.badge-pending { background: #2e1f05; color: #facc15; }
.badge-blocked { background: #2e0505; color: #f87171; }
.badge-draft { background: #1e1e2e; color: #94a3b8; }
.badge-done { background: #0a1e3d; color: #60a5fa; }
.badge-p0 { background: #2e0505; color: #f87171; }
.badge-p1 { background: #2e1f05; color: #fbbf24; }
.badge-p2 { background: #0a1e3d; color: #60a5fa; }
.badge-p3 { background: #1e1e2e; color: #94a3b8; }

/* ── Status dot ── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.active { background: var(--status-active); }
.status-dot.pending { background: var(--status-pending); }
.status-dot.blocked { background: var(--status-blocked); }
.status-dot.draft { background: var(--status-draft); }
.status-dot.done { background: var(--status-done); }

/* ── Inputs ── */
.input-dark {
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text-primary); border-radius: 8px; padding: 8px 12px;
  font-size: 0.875rem; outline: none; width: 100%;
  transition: border-color 0.15s ease;
}
.input-dark:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle); }
.input-dark::placeholder { color: var(--text-muted); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 0.875rem; font-weight: 500;
  transition: all 0.15s ease; cursor: pointer; border: none; }
.btn-accent { background: var(--accent); color: #09090b; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { background: var(--bg-hover); border-color: var(--border-light); color: var(--text-primary); }
.btn-sm { padding: 4px 10px; font-size: 0.8125rem; border-radius: 6px; }
.btn-icon { padding: 6px; border-radius: 6px; }

/* ── Tables ── */
.table-dark { width: 100%; border-collapse: collapse; }
.table-dark th { text-align: left; padding: 10px 12px; font-size: 0.75rem;
  font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border); }
.table-dark td { padding: 10px 12px; border-bottom: 1px solid var(--border);
  font-size: 0.875rem; color: var(--text-primary); vertical-align: middle; }
.table-dark tr:last-child td { border-bottom: none; }
.table-dark tr:hover td { background: var(--bg-hover); }

/* ── Links ── */
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
.link-subtle { color: var(--text-secondary); }
.link-subtle:hover { color: var(--text-primary); }

/* ── HTMX loading states ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.htmx-request .skeleton-show { display: block; }
.htmx-request .skeleton-hide { display: none; }
.htmx-request.skeleton-show { display: block; }
.htmx-request.skeleton-hide { display: none; }

/* ── Breadcrumb ── */
.breadcrumb { display: flex; align-items: center; gap: 8px;
  font-size: 0.8125rem; color: var(--text-muted); }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb .sep { color: var(--border-light); }

/* ── Filters bar ── */
.filters-bar { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 0; }
.filters-bar select, .filters-bar input { min-width: 140px; }

/* ── Kanban ── */
.kanban-col { min-width: 240px; flex: 1; }
.kanban-card { padding: 12px; cursor: pointer; }
.kanban-card:hover { border-color: var(--border-light); }

/* ── Follow-up cards ── */
.fu-card { padding: 14px 16px; }
.fu-card.overdue { border-left: 3px solid var(--status-blocked); }
.fu-card.due-soon { border-left: 3px solid var(--status-pending); }
.fu-card.normal { border-left: 3px solid transparent; }

/* ── Detail layout ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 767px) { .detail-grid { grid-template-columns: 1fr; } }
.info-row { display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); }
.info-value { color: var(--text-primary); text-align: right; }

/* ── Login ── */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-base); padding: 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 16px; padding: 32px; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.login-logo p { font-size: 0.8125rem; color: var(--text-muted); margin-top: 4px; }

/* ── Empty states ── */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state-text { color: var(--text-secondary); font-size: 0.875rem; }

/* ── Error states ── */
.error-card { background: #2e0505; border: 1px solid #450a0a; border-radius: 8px;
  padding: 16px; display: flex; align-items: center; gap: 12px; color: #fca5a5;
  font-size: 0.875rem; }
.error-card button { color: var(--accent); background: none; border: none;
  cursor: pointer; text-decoration: underline; font-size: 0.875rem; }

/* ── Loading indicator ── */
.loading-dots::after { content: ''; animation: dots 1.5s steps(4, end) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
