/* ============================================
   Kanban Board - Styles
   ============================================ */

/* ------ CSS Variables ------ */
:root {
  --bg-body: #f1f5f9;
  --bg-column: #f8fafc;
  --bg-card: #ffffff;
  --bg-header: #0f172a;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-header: #ffffff;
  --border-color: #e2e8f0;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;

  --label-red: #ef4444;
  --label-orange: #f97316;
  --label-yellow: #eab308;
  --label-green: #22c55e;
  --label-blue: #3b82f6;
  --label-purple: #a855f7;
  --label-pink: #ec4899;
  --label-teal: #14b8a6;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.15);
  --shadow-drag: 0 12px 36px rgba(0, 0, 0, 0.2);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --column-width: 320px;
  --column-gap: 16px;
  --header-height: 60px;

  --transition-fast: 150ms ease;
  --transition: 250ms ease;
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

input,
textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ------ Header ------ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 24px;
  background: var(--bg-header);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.app-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-header);
  letter-spacing: -0.3px;
}

/* ------ Board Switcher ------ */
.board-switcher {
  position: relative;
}

.board-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  transition: background var(--transition-fast);
  color: var(--text-header);
}

.board-switcher-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.board-switcher-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.board-switcher-chevron {
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.board-switcher-btn .board-switcher-chevron {
  opacity: 0.6;
}

.board-dropdown.open .board-switcher-chevron {
  transform: rotate(180deg);
}

.board-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 200;
}

.board-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.board-dropdown-list {
  padding: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.board-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  transition: background var(--transition-fast);
}

.board-dropdown-item:hover {
  background: var(--bg-body);
}

.board-dropdown-item.active {
  background: rgba(59, 130, 246, 0.08);
}

.board-dropdown-item-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-dropdown-item.active .board-dropdown-item-name {
  color: var(--accent);
  font-weight: 600;
}

.board-dropdown-item-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.board-dropdown-item:hover .board-dropdown-item-actions {
  opacity: 1;
}

.board-dropdown-footer {
  padding: 6px;
  border-top: 1px solid var(--border-color);
}

.btn-board-new {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  border-radius: var(--radius-xs);
  transition: background var(--transition-fast);
}

.btn-board-new:hover {
  background: rgba(59, 130, 246, 0.08);
}

.btn-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-header);
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xs);
  transition: background var(--transition-fast);
}

.btn-header:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ------ Board Layout ------ */
.board {
  display: flex;
  align-items: flex-start;
  gap: var(--column-gap);
  height: calc(100vh - var(--header-height));
  padding: 20px;
  overflow-x: auto;
  overflow-y: hidden;
}

/* ------ Column ------ */
.column {
  flex: 0 0 var(--column-width);
  display: flex;
  flex-direction: column;
  max-height: 100%;
  background: var(--bg-column);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.column.drag-over {
  border-color: var(--accent);
  background: #eff6ff;
}

.column.dragging {
  opacity: 0.4;
  transform: rotate(1deg);
  box-shadow: var(--shadow-drag);
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  flex-shrink: 0;
}

.column-grip {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  cursor: grab;
  opacity: 0;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.column-grip:active {
  cursor: grabbing;
}

.column-header:hover .column-grip {
  opacity: 1;
}

.column-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.column-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--border-color);
  border-radius: 100px;
  flex-shrink: 0;
}

.column-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.column-header:hover .column-actions {
  opacity: 1;
}

/* ------ Card List ------ */
.card-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px 12px;
  overflow-y: auto;
  min-height: 8px;
}

.card-list-empty {
  padding: 20px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ------ Card ------ */
.card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: #cbd5e1;
}

.card:active {
  cursor: grabbing;
}

.card.dragging {
  opacity: 0.4;
  transform: rotate(2deg);
  box-shadow: var(--shadow-drag);
}

.card-label {
  height: 4px;
  width: 100%;
  flex-shrink: 0;
}

.card-content {
  padding: 10px 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  word-wrap: break-word;
}

.card-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
}

.card-desc.expanded {
  display: block;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
  overflow: visible;
}

.card-stamps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 6px;
}

.card-stamp {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.card-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.card:hover .card-actions {
  opacity: 1;
}

/* ------ Drop Placeholder ------ */
.drop-placeholder {
  height: 4px;
  margin: -2px 0;
  background: var(--accent);
  border-radius: 100px;
  flex-shrink: 0;
  transition: opacity var(--transition-fast);
}

/* ------ Column Drop Placeholder ------ */
.column-drop-placeholder {
  flex: 0 0 6px;
  align-self: stretch;
  background: var(--accent);
  border-radius: 100px;
  margin: 0 -3px;
  z-index: 1;
}

/* ------ Icon Button ------ */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.btn-icon:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.06);
}

.btn-icon.btn-delete:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

/* ------ Add Card Button ------ */
.btn-add-card {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 12px 12px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-add-card:hover {
  color: var(--accent);
  border-color: var(--accent);
  border-style: solid;
  background: rgba(59, 130, 246, 0.04);
}

/* ------ Add Column Placeholder ------ */
.add-column-placeholder {
  flex: 0 0 var(--column-width);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 100px;
  background: transparent;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.add-column-placeholder:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59, 130, 246, 0.04);
}

/* ------ Modals ------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 90%;
  max-width: 480px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(8px);
  transition: transform var(--transition-slow);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-sm {
  max-width: 380px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 20px;
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.btn-close:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.06);
}

.confirm-message {
  padding: 16px 24px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px 20px;
}

/* ------ Forms ------ */
.form-group {
  padding: 0 24px;
  margin-top: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.label-optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  resize: vertical;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ------ Color Picker ------ */
.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.selected {
  border-color: var(--text-primary);
  transform: scale(1.1);
}

.color-swatch.selected::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: translate(-50%, -60%) rotate(-45deg);
}

/* ------ Buttons ------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

.btn-primary {
  color: #fff;
  background: var(--accent);
}

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

.btn-secondary {
  color: var(--text-secondary);
  background: var(--bg-body);
  border: 1px solid var(--border-color);
}

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

.btn-danger {
  color: #fff;
  background: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-hover);
}

/* ------ Scrollbar ------ */
.board::-webkit-scrollbar,
.card-list::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.board::-webkit-scrollbar-track,
.card-list::-webkit-scrollbar-track {
  background: transparent;
}

.board::-webkit-scrollbar-thumb,
.card-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 100px;
}

.board::-webkit-scrollbar-thumb:hover,
.card-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.board {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.card-list {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

/* ------ Login ------ */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.login-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 28px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform: translateY(8px);
  transition: transform var(--transition-slow);
}

.login-overlay.active .login-card {
  transform: translateY(0);
}

.login-header {
  margin-bottom: 20px;
  text-align: center;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.login-subtitle {
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-secondary);
}

.login-error {
  min-height: 20px;
  margin: 12px 24px 0;
  font-size: 13px;
  color: var(--danger);
  text-align: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.login-error.active {
  opacity: 1;
}

.login-submit {
  width: calc(100% - 48px);
  margin: 16px 24px 0;
}

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

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

/* ------ Responsive ------ */
@media (max-width: 768px) {
  :root {
    --column-width: 280px;
  }

  .app-header {
    padding: 0 16px;
  }

  .board {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  :root {
    --column-width: calc(100vw - 32px);
  }

  .board {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    align-items: stretch;
  }

  .column {
    max-height: none;
    flex: 0 0 auto;
  }

  .card-list {
    overflow-y: visible;
  }

  .add-column-placeholder {
    flex: 0 0 auto;
    min-height: 60px;
  }
}
