/* components.css — Buttons, Forms, Toggle, Progress, Tables */

/* ═══════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sys);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.1px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--transition-hover),
    border-color var(--transition-hover),
    box-shadow var(--transition-hover),
    transform var(--transition-expand);
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary */
.btn-primary {
  background: var(--text-primary);
  color: #fff;
  border: 1px solid transparent;
}

.btn-primary:hover {
  background: #1a2540;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Outline */
.btn-outline {
  background: var(--surface-base);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.btn-outline:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* Ghost */
.btn-ghost {
  background: var(--surface-sunken);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.05);
  color: var(--text-primary);
}

/* Danger */
.btn-danger {
  background: var(--surface-base);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
  background: #fff5f5;
  border-color: rgba(220, 38, 38, 0.4);
}

/* Sizes */
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  gap: 5px;
}

.btn-xs {
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  gap: 4px;
}

.btn-icon {
  padding: 7px 9px;
  gap: 0;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-sm svg { width: 12px; height: 12px; }
.btn-xs svg { width: 11px; height: 11px; }

/* Loading state */
.btn.loading::after {
  content: '';
  width: 12px;
  height: 12px;
  border: 1.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 4px;
}

/* ═══════════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════════ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1;
}

.form-label.required::after {
  content: ' *';
  color: #dc2626;
}

.form-input,
.form-select,
.form-textarea {
  background: var(--surface-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-family: var(--font-sys);
  font-size: 13px;
  color: var(--text-primary);
  padding: 8px 10px;
  box-shadow: var(--shadow-inset);
  transition:
    border-color var(--transition-hover),
    box-shadow var(--transition-hover);
  width: 100%;
  outline: none;
  -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-disabled);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

.form-textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238898AA' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.form-error {
  font-size: 11px;
  color: #dc2626;
  margin-top: 2px;
}

/* Form row (inline fields) */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

/* Tags Input */
.tags-input-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 38px;
  background: var(--surface-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  cursor: text;
  transition: border-color var(--transition-hover);
  align-items: center;
  box-shadow: var(--shadow-inset);
}

.tags-input-container:focus-within {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.tag-remove {
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1;
  padding: 0 1px;
  transition: color var(--transition-hover);
}

.tag-remove:hover { color: #dc2626; }

.tags-input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-sys);
  font-size: 12px;
  color: var(--text-primary);
  flex: 1;
  min-width: 80px;
}

.tags-input::placeholder { color: var(--text-disabled); }

/* ═══════════════════════════════════════════════════════════
   TOGGLE SWITCH
═══════════════════════════════════════════════════════════ */

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #D1D5DB;
  border-radius: 10px;
  transition: background 0.2s cubic-bezier(0.4,0,0.2,1);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  top: 3px;
  left: 3px;
  transition: transform 0.2s cubic-bezier(0.4,0,0.2,1);
}

.toggle input:checked + .toggle-slider {
  background: var(--text-primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

.toggle-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════
   SLIDER (Range Input)
═══════════════════════════════════════════════════════════ */

.slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border-default);
  border-radius: 2px;
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--text-primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: transform var(--transition-hover);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.slider-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
  font-weight: 600;
  min-width: 20px;
  text-align: right;
}

/* ═══════════════════════════════════════════════════════════
   TABLE
═══════════════════════════════════════════════════════════ */

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: var(--surface-raised);
}

.data-table th {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 16px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

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

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .td-truncate {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table .td-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Checkbox */
.data-table input[type='checkbox'] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════
   PROGRESS BAR
═══════════════════════════════════════════════════════════ */

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--surface-sunken);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.pf-purple { background: var(--grad-authority); }
.pf-green  { background: var(--grad-casual); }
.pf-blue   { background: linear-gradient(90deg, #2563eb, #0ea5e9); }
.pf-pink   { background: var(--grad-pink); }

/* ═══════════════════════════════════════════════════════════
   SYSTEM NOTICE
═══════════════════════════════════════════════════════════ */

.system-notice {
  background: rgba(37, 99, 235, 0.04);
  border-left: 2px solid #2563eb;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.system-notice svg {
  width: 14px;
  height: 14px;
  color: #2563eb;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ═══════════════════════════════════════════════════════════
   CHIP
═══════════════════════════════════════════════════════════ */

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  white-space: nowrap;
  cursor: default;
}

/* ═══════════════════════════════════════════════════════════
   TABS
═══════════════════════════════════════════════════════════ */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.tab {
  font-family: var(--font-sys);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: 8px 14px;
  cursor: pointer;
  position: relative;
  transition: color var(--transition-hover);
  user-select: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover { color: var(--text-primary); }

.tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════
   MODAL / SLIDE PANEL
═══════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(2px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--surface-base);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

.modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.modal-close {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: background var(--transition-hover), color var(--transition-hover);
  font-size: 16px;
  line-height: 1;
}

.modal-close:hover {
  background: var(--surface-sunken);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════════
   TOAST / NOTIFICATION
═══════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text-primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
}

.toast.toast-success { background: var(--status-approved); }
.toast.toast-error   { background: var(--status-live); }
.toast.toast-info    { background: #2563eb; }

/* ═══════════════════════════════════════════════════════════
   INLINE SVG ICONS (replacing emoji)
═══════════════════════════════════════════════════════════ */

/* Chip icon — inside tone-chip and similar small elements */
.chip-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  vertical-align: middle;
  display: inline-block;
  position: relative;
  top: -1px;
}

/* Comment type icon — in seeding type list */
.ct-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

/* Tone icon — in badge pills */
.tone-icon,
.inline-icon {
  display: inline-flex;
  flex-shrink: 0;
  vertical-align: middle;
}

.inline-icon svg {
  width: 100%;
  height: 100%;
}

