/* ── Reset & Base ─────────────────────────────────────────────────── */

:root {
  --bg: #0c0c14;
  --surface: #12121c;
  --surface-raised: #1a1a28;
  --surface-hover: #222236;
  --border: #262640;
  --border-hover: #36365a;

  --text: #e4e4f0;
  --text-secondary: #8e8ea8;
  --text-muted: #56566e;

  --queued: #60a5fa;
  --working: #fbbf24;
  --ready: #34d399;
  --published: #a78bfa;
  --cancelled: #f87171;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-xs: 4px;
  --transition: 150ms ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────────── */

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.logo svg {
  opacity: 0.6;
}

.logo h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.stats {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stat::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-color);
}

.stat-sep {
  margin: 0 4px;
  color: var(--text-muted);
}

/* ── Sync / Logout Buttons ───────────────────────────────────────── */

.sync-btn,
.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  text-decoration: none;
}

.sync-btn:hover,
.logout-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-hover);
}

.sync-btn.syncing {
  pointer-events: none;
  opacity: 0.7;
}

.sync-btn.syncing .sync-icon {
  animation: spin 1s linear infinite;
}

.logout-btn {
  padding: 5px 10px;
}

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

/* ── Search ──────────────────────────────────────────────────────── */

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition);
}

.search-wrapper:focus-within .search-icon {
  color: var(--text-secondary);
}

.search-input {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  padding: 6px 32px 6px 32px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  width: 200px;
  transition: all var(--transition);
  outline: none;
}

.search-input:focus {
  width: 280px;
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-shortcut {
  position: absolute;
  right: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-family: inherit;
  padding: 1px 5px;
  border-radius: 3px;
  pointer-events: none;
  line-height: 1.4;
}

.search-input:focus ~ .search-shortcut {
  display: none;
}

.search-result-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
  white-space: nowrap;
}

/* ── View Toggle ─────────────────────────────────────────────────── */

.view-toggle {
  display: flex;
  background: var(--surface-raised);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.view-toggle button {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
}

.view-toggle button:hover {
  color: var(--text);
}

.view-toggle button.active {
  background: var(--surface-hover);
  color: var(--text);
}

/* ── Main Content ────────────────────────────────────────────────── */

#main {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.view {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 24px;
}

.view.hidden {
  display: none;
}

/* ── Board View (Kanban) ─────────────────────────────────────────── */

.board {
  display: flex;
  gap: 16px;
  height: 100%;
  min-width: min-content;
}

.board-column {
  flex: 1;
  min-width: 260px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 2px solid var(--col-color);
  margin-bottom: 4px;
}

.column-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--col-color);
}

.column-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.column-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.column-cards {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px;
  min-height: 60px;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.column-cards.drag-over {
  background: var(--surface-raised);
  outline: 2px dashed var(--border-hover);
  outline-offset: -2px;
}

/* ── Request Card ────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

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

.card.dragging {
  opacity: 0.4;
}

.card-inner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.card-text {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 6px;
  color: var(--text);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.content-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.content-dot.has-content {
  background: var(--ready);
}

.content-dot.no-content {
  background: var(--text-muted);
  opacity: 0.5;
}

.card-status-badge {
  display: none;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calendar-day .card-status-badge,
.unscheduled-cards .card-status-badge,
.list-status .card-status-badge {
  display: inline-block;
}

/* ── Calendar View ───────────────────────────────────────────────── */

#calendar-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-nav button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
}

.calendar-nav button:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.calendar-month-label {
  font-size: 16px;
  font-weight: 600;
  min-width: 180px;
  text-align: center;
}

.calendar-today-btn {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
  font-size: 12px !important;
  width: auto !important;
  padding: 0 12px !important;
  font-weight: 500 !important;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.calendar-weekday {
  background: var(--surface);
  padding: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.calendar-day {
  background: var(--surface);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background var(--transition);
  overflow: hidden;
  min-height: 0;
}

.day-cards {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.calendar-day.other-month {
  opacity: 0.35;
}

.calendar-day.today {
  background: var(--surface-raised);
}

.calendar-day.today .day-number {
  background: var(--published);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-day.drag-over {
  background: var(--surface-hover);
  outline: 2px dashed var(--border-hover);
  outline-offset: -2px;
}

.day-number {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 2px;
  padding: 0 2px;
}

.calendar-day .card {
  padding: 5px 8px;
  border-left: 3px solid var(--card-status-color, var(--text-muted));
}

.calendar-day .card-title {
  font-size: 11px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-day .card-meta {
  font-size: 10px;
}

.day-overflow {
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 4px;
  cursor: pointer;
}

.day-overflow:hover {
  color: var(--text-secondary);
}

/* ── Unscheduled Tray ────────────────────────────────────────────── */

.unscheduled-tray {
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px;
  transition: background var(--transition);
  flex-shrink: 0;
  max-height: 120px;
  overflow-y: auto;
}

.unscheduled-tray.drag-over {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.unscheduled-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.unscheduled-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.unscheduled-cards .card {
  width: 220px;
  flex-shrink: 0;
}

/* ── List View ───────────────────────────────────────────────────── */

.list-table {
  width: 100%;
  border-collapse: collapse;
}

.list-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.list-table th:hover {
  color: var(--text-secondary);
}

.list-table th .sort-arrow {
  margin-left: 4px;
  opacity: 0.4;
}

.list-table th.sorted .sort-arrow {
  opacity: 1;
}

.list-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.list-table tr {
  cursor: pointer;
  transition: background var(--transition);
}

.list-table tbody tr:hover {
  background: var(--surface-raised);
}

.list-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.list-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.list-content-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── Detail Panel ────────────────────────────────────────────────── */

.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  opacity: 0;
  transition: opacity 200ms ease;
}

.detail-overlay.visible {
  opacity: 1;
}

.detail-overlay.hidden {
  display: none;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  max-width: 90vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 100;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1);
  padding: 24px;
}

.detail-panel.visible {
  transform: translateX(0);
}

.detail-panel.hidden {
  display: none;
}

.detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
}

.detail-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.detail-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-right: 40px;
  line-height: 1.3;
}

.detail-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.detail-field {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
}

.detail-label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 80px;
  flex-shrink: 0;
}

.detail-value {
  font-size: 13px;
  color: var(--text);
}

.detail-value a {
  color: var(--published);
  text-decoration: none;
}

.detail-value a:hover {
  text-decoration: underline;
}

.detail-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 12px;
  background: var(--surface-raised);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.detail-actions .btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-hover);
}

.detail-actions .btn svg {
  width: 14px;
  height: 14px;
}

/* ── Status Editing ──────────────────────────────────────────────── */

.status-select {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-family: inherit;
}

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

.date-input {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  font-family: inherit;
  color-scheme: dark;
}

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

/* ── Toast ────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 300;
  opacity: 0;
  transition: all 250ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.hidden {
  display: none;
}

/* ── Empty State ─────────────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
  gap: 8px;
}

.empty-state-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
}

.empty-state-sub {
  font-size: 12px;
}

/* ── Scrollbar ───────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ── Utility ─────────────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ── Loading Spinner ─────────────────────────────────────────────── */

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--published);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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