/* ============================================================
   styles.css — WIP Tracking System
   Design tokens from design.md + custom utilities
   ============================================================ */

/* ------- CSS Custom Properties (Design Tokens) ------- */
:root {
  /* Backgrounds */
  --bg-primary: #212121;
  --bg-surface: #333333;
  --bg-panel: #1A1A1A;
  --bg-table-header: #000000;
  --bg-row-even: #1A1A1A;
  --bg-row-odd: #2A2A2A;

  /* Card gradients */
  --card-gradient-start: #E0E0E0;
  --card-gradient-end: #A0A0A0;

  /* Text */
  --text-primary: #FFFFFF;
  --text-secondary: #B0B0B0;
  --text-inverse: #000000;
  --accent-green: #4ADE80;
  --accent-red: #D32F2F;

  /* Status colors */
  --status-wip: #F39C12;
  --status-complete: #3498DB;
  --status-target: #9B59B6;

  /* Spacing */
  --container-padding: 24px;
  --card-gap: 16px;
  --cell-padding: 8px 12px;

  /* Radius */
  --radius-card: 20px;
  --radius-panel: 12px;
  --radius-input: 4px;

  /* Shadows */
  --shadow-card: 0px 4px 10px rgba(0, 0, 0, 0.5);
  --shadow-inner-glow: inset 0px 1px 3px rgba(255, 255, 255, 0.2);

  /* Typography */
  --font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  --font-h1: 36px;
  --font-h2: 48px;
  --font-h3: 18px;
  --font-body: 14px;
  --font-small: 11px;
}

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

html, body {
  font-family: var(--font-family);
  font-size: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ------- Scrollbar Styling ------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-panel);
}

::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* ------- Title Glow Effect ------- */
.title-glow {
  text-shadow:
    0 0 10px rgba(74, 222, 128, 0.6),
    0 0 20px rgba(74, 222, 128, 0.4),
    0 0 40px rgba(74, 222, 128, 0.2);
}

/* ------- Summary Cards ------- */
.summary-card {
  background: linear-gradient(135deg, var(--card-gradient-start), var(--card-gradient-end));
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  color: var(--text-inverse);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0px 6px 16px rgba(0, 0, 0, 0.6);
}

/* ------- Filter Panel ------- */
.filter-panel {
  background-color: var(--bg-panel);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-inner-glow);
}

.filter-select {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid #444;
  border-radius: var(--radius-input);
  padding: 8px 12px;
  font-size: var(--font-body);
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  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='%23B0B0B0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--accent-green);
}

.search-input {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid #444;
  border-radius: var(--radius-input);
  padding: 8px 12px 8px 36px;
  font-size: var(--font-body);
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--accent-green);
}

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

/* ------- Data Grid Table ------- */
.wip-table-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
  border-radius: var(--radius-panel);
  background-color: var(--bg-panel);
}

.wip-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1200px;
}

.wip-table thead {
  position: sticky;
  top: 0;
  z-index: 20;
}

.wip-table thead th {
  background-color: var(--bg-table-header);
  color: var(--accent-green);
  font-size: var(--font-small);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 6px;
  text-align: center;
  border-bottom: 2px solid #333;
  border-right: 1px solid #222;
  white-space: nowrap;
  vertical-align: bottom;
}

/* Sticky NO and PROJECT columns */
.wip-table thead th:first-child,
.wip-table thead th:nth-child(2) {
  text-align: left;
  position: sticky;
  z-index: 25;
  background-color: var(--bg-table-header);
}

.wip-table thead th:first-child {
  left: 0;
  min-width: 40px;
}

.wip-table thead th:nth-child(2) {
  left: 40px;
  min-width: 320px;
  border-right: 2px solid #444;
}

.wip-table tbody tr:nth-child(even) {
  background-color: var(--bg-row-even);
}

.wip-table tbody tr:nth-child(odd) {
  background-color: var(--bg-row-odd);
}

.wip-table tbody tr:hover {
  background-color: #363636;
}

.wip-table tbody td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid #2a2a2a;
  border-right: 1px solid #222;
  white-space: nowrap;
  font-size: var(--font-body);
}

.wip-table tbody td.station-cell:hover {
  background-color: rgba(74, 222, 128, 0.12);
  cursor: pointer;
}

.wip-table tbody td:first-child,
.wip-table tbody td:nth-child(2) {
  text-align: left;
  position: sticky;
  z-index: 10;
}

.wip-table tbody tr:nth-child(even) td:first-child,
.wip-table tbody tr:nth-child(even) td:nth-child(2) {
  background-color: var(--bg-row-even);
}

.wip-table tbody tr:nth-child(odd) td:first-child,
.wip-table tbody tr:nth-child(odd) td:nth-child(2) {
  background-color: var(--bg-row-odd);
}

.wip-table tbody tr:hover td:first-child,
.wip-table tbody tr:hover td:nth-child(2) {
  background-color: #363636;
}

.wip-table tbody td:first-child {
  left: 0;
  min-width: 40px;
  color: var(--text-secondary);
}

.wip-table tbody td:nth-child(2) {
  left: 40px;
  min-width: 320px;
  border-right: 2px solid #444;
}

/* ------- Status Indicators ------- */
.status-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.status-dot:hover {
  transform: scale(1.3);
}

.status-dot.wip {
  background-color: var(--status-wip);
  box-shadow: 0 0 8px rgba(243, 156, 18, 0.6);
}

.status-dot.empty {
  background-color: transparent;
  border: 1px dashed #444;
}

.status-dot.empty:hover {
  border-color: var(--accent-green);
}

/* Checkmark icon for COC complete status */
.status-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--status-complete);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.status-check:hover {
  transform: scale(1.2);
}

/* Target badge */
.status-target-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background-color: var(--status-complete);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.status-target-badge:hover {
  transform: scale(1.2);
}

/* ------- Status Dropdown / Popover ------- */
.status-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  z-index: 100;
  background: var(--bg-surface);
  border: 1px solid #555;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  min-width: 160px;
}

.status-dropdown-option {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: var(--font-body);
  color: var(--text-secondary);
  transition: background-color 0.15s, color 0.15s;
}

.status-dropdown-option:hover {
  background-color: #444;
  color: var(--text-primary);
}

.status-dropdown-option.active {
  color: var(--text-primary);
  font-weight: 600;
}

/* ------- Toast Notification ------- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: var(--font-body);
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.3s ease-out;
  max-width: 360px;
}

.toast.success {
  background-color: #065F46;
  color: #A7F3D0;
  border-left: 4px solid var(--accent-green);
}

.toast.error {
  background-color: #7F1D1D;
  color: #FECACA;
  border-left: 4px solid var(--accent-red);
}

.toast.info {
  background-color: #1E3A5F;
  color: #BAE6FD;
  border-left: 4px solid #3498DB;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ------- Skeleton Loading ------- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-panel) 25%, #2a2a2a 50%, var(--bg-panel) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  height: 100px;
  border-radius: var(--radius-card);
}

.skeleton-row {
  height: 40px;
  margin-bottom: 4px;
}

/* ------- Mobile Project Cards ------- */
.project-card {
  background-color: var(--bg-panel);
  border-radius: var(--radius-panel);
  border: 1px solid #333;
  box-shadow: var(--shadow-inner-glow);
  transition: border-color 0.2s;
}

.project-card:hover {
  border-color: #555;
}

/* ------- Refresh Button ------- */
.refresh-btn {
  transition: transform 0.3s ease;
}

.refresh-btn.spinning {
  animation: spin 0.8s linear infinite;
}

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

/* ------- Responsive ------- */
@media (max-width: 768px) {
  :root {
    --container-padding: 12px;
  }

  .wip-table-container {
    max-height: none;
  }
}
