/* ============================================
   PAJARA OS — Component Library
   ============================================ */

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
}
.btn-primary:hover { background: var(--primary-container); }

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--outline-variant);
}
.btn-secondary:hover { background: var(--surface-container-low); }

.btn-ghost {
  background: transparent;
  color: var(--on-surface-variant);
}
.btn-ghost:hover { background: var(--surface-container); }

.btn-danger {
  background: var(--error);
  color: var(--on-primary);
}
.btn-danger:hover { opacity: 0.9; }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-icon {
  padding: 8px;
  border-radius: var(--radius);
}

/* ── Cards ── */
.card {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

.card-flat {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  border: 1px solid var(--outline-variant);
}

.card-dark {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

/* ── Metric Card ── */
.metric-card {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
}
.metric-card .metric-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  margin-bottom: 8px;
}
.metric-card .metric-number {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--on-surface);
}
.metric-card .metric-sub {
  font-size: 13px;
  color: var(--on-surface-variant);
  margin-top: 4px;
}

/* ── Status Chips ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.chip-success { background: var(--success-bg); color: var(--success-text); }
.chip-warning { background: var(--warning-bg); color: var(--warning-text); }
.chip-error   { background: var(--error-bg);   color: var(--error-text); }
.chip-info    { background: var(--info-bg);     color: var(--info-text); }
.chip-neutral { background: var(--surface-container); color: var(--on-surface-variant); }

/* ── Input Fields ── */
.input-group { margin-bottom: 16px; }
.input-group label {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  margin-bottom: 6px;
}
.input {
  width: 100%;
  padding: 10px 14px;
  background: #f1f5f9;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--on-surface);
  transition: all var(--transition-fast);
  outline: none;
}
.input:focus {
  border-color: var(--primary);
  background: var(--surface-container-lowest);
}
.input::placeholder { color: var(--outline); }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2374777d' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* ── Tables ── */
.table-wrapper { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  border-bottom: 1px solid var(--outline-variant);
}
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--surface-container);
  color: var(--on-surface);
}
.table tr:hover td { background: var(--surface-container-low); }

/* ── Progress Bar ── */
.progress {
  height: 6px;
  background: var(--surface-container);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width var(--transition-slow);
}
.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.error   { background: var(--error); }

/* ── Kanban Board ── */
.kanban { display: flex; gap: var(--space-md); overflow-x: auto; }
.kanban-column {
  min-width: 300px;
  flex: 1;
}
.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 12px;
}
.kanban-card {
  background: var(--surface-container-lowest);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  border-left: 3px solid transparent;
  transition: box-shadow var(--transition-fast);
}
.kanban-card:hover { box-shadow: var(--shadow); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--outline-variant);
  margin-bottom: var(--space-md);
}
.tab {
  padding: 10px 20px;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface-variant);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}
.tab:hover { color: var(--on-surface); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Badge / Counter ── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--primary);
  color: var(--on-primary);
}
.badge-sm { min-width: 16px; height: 16px; font-size: 10px; }
.badge-success { background: var(--success); }
.badge-error { background: var(--error); }

/* ── Avatar ── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--surface-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--primary);
}
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,28,48,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface-container-lowest);
  border-radius: var(--radius-xl);
  padding: var(--space-md);
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--outline-variant);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--on-primary);
  background: var(--inverse-surface);
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--error); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  color: var(--on-surface-variant);
}
.empty-state svg { opacity: 0.4; margin-bottom: var(--space-sm); }

/* ── Loading ── */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--surface-container);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface-container) 25%, var(--surface-container-low) 50%, var(--surface-container) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Utility Classes ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.text-muted { color: var(--on-surface-variant); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
