/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--sohar-gray-100); }

.btn-ghost {
  color: var(--color-text-muted);
}
.btn-ghost:hover { color: var(--color-text); background: var(--sohar-gray-100); }

.btn-danger {
  background: #FEE2E2;
  color: #B91C1C;
}
.btn-danger:hover { background: #FECACA; }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-icon { padding: 0.5rem; }

/* Cards */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-body { padding: 1.25rem; }

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.kpi-card__label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 0.375rem;
}

.kpi-card__value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--sohar-black);
  line-height: 1.1;
}

.kpi-card__sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.kpi-card--accent {
  border-left: 4px solid var(--color-primary);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-draft { background: #F3F4F6; color: var(--status-draft); }
.badge-submitted { background: #DBEAFE; color: var(--status-submitted); }
.badge-initial-screening { background: #EDE9FE; color: var(--status-screening); }
.badge-under-review { background: #FEF3C7; color: var(--status-review); }
.badge-more-information-required { background: #CFFAFE; color: var(--status-info); }
.badge-approved { background: #D1FAE5; color: var(--status-approved); }
.badge-published { background: #A7F3D0; color: var(--status-published); }
.badge-in-progress { background: #DBEAFE; color: var(--status-progress); }
.badge-closed { background: #F1F5F9; color: var(--status-closed); }
.badge-rejected { background: #FEE2E2; color: var(--status-rejected); }

.badge-challenge { background: var(--color-primary-light); color: var(--color-primary); }
.badge-idea { background: #E0E7FF; color: #4338CA; }

.badge-ai {
  background: #FEF3C7;
  color: #92400E;
  border: 1px dashed #F59E0B;
}

/* Forms */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--sohar-gray-700);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-error {
  font-size: 0.75rem;
  color: var(--status-rejected);
  margin-top: 0.25rem;
}

/* Tables */
.table-wrap { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data-table th,
table.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

table.data-table th {
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--sohar-gray-50);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

table.data-table tbody tr:hover { background: var(--sohar-gray-50); }

/* Wizard */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  overflow-x: auto;
}

.wizard-step {
  flex: 1;
  min-width: 120px;
  text-align: center;
  position: relative;
  padding-bottom: 0.5rem;
}

.wizard-step::after {
  content: '';
  position: absolute;
  top: 16px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.wizard-step:last-child::after { display: none; }

.wizard-step__num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sohar-gray-200);
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  position: relative;
  z-index: 1;
  margin-bottom: 0.5rem;
}

.wizard-step.active .wizard-step__num {
  background: var(--color-primary);
  color: white;
}

.wizard-step.completed .wizard-step__num {
  background: var(--status-approved);
  color: white;
}

.wizard-step__label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.wizard-step.active .wizard-step__label { color: var(--color-primary); font-weight: 600; }

#wizard-content { min-height: 280px; margin-bottom: 1rem; }

#wizard-footer {
  position: relative;
  z-index: 2;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.wizard-tags-select {
  height: 88px !important;
  max-height: 88px;
}

/* Kanban */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  align-items: start;
}

.kanban-column {
  background: var(--sohar-gray-100);
  border-radius: var(--radius-md);
  min-height: 200px;
}

.kanban-column__header {
  padding: 0.75rem 1rem;
  font-weight: 700;
  font-size: 0.8125rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kanban-column__count {
  background: var(--color-surface);
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.kanban-cards { padding: 0.5rem; display: flex; flex-direction: column; gap: 0.5rem; }

.kanban-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.kanban-card:hover { box-shadow: var(--shadow-md); }

.kanban-card__ref {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.kanban-card__title {
  font-size: 0.8125rem;
  font-weight: 600;
  margin: 0.25rem 0;
  line-height: 1.3;
}

/* Timeline */
.timeline { position: relative; padding-left: 1.5rem; }

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-primary);
}

.timeline-item__time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.timeline-item__text {
  font-size: 0.875rem;
  margin-top: 0.125rem;
}

/* Comments */
.comment-thread { display: flex; flex-direction: column; gap: 1rem; }

.comment {
  padding: 1rem;
  background: var(--sohar-gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.comment--internal {
  background: #FFFBEB;
  border-color: #FDE68A;
}

.comment__meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.comment__author { font-weight: 600; color: var(--color-text); }

/* AI Panel */
.ai-panel {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.ai-panel__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ai-panel__icon {
  width: 32px;
  height: 32px;
  background: #F59E0B;
  color: white;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
}

.ai-output {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.875rem;
  margin-bottom: 0.75rem;
}

.ai-output__label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.375rem;
}

.ai-output__content { font-size: 0.875rem; }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.toast-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.toast-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--sohar-gray-200);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--color-text-muted);
}

.empty-state__icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 { margin-bottom: 0.5rem; color: var(--color-text); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 1rem;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal__header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal__body { padding: 1.25rem; }

.modal__footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab {
  padding: 0.75rem 1.25rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab:hover { color: var(--color-text); }

.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Tag chips */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.375rem; }

.tag {
  padding: 0.2rem 0.6rem;
  background: var(--sohar-gray-100);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--sohar-gray-700);
}

/* Chart container */
.chart-container {
  position: relative;
  height: 280px;
}

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

.filter-bar .form-group { margin-bottom: 0; min-width: 140px; }

/* Page header */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header__subtitle {
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  margin-top: 0.25rem;
}

/* Detail grid */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.meta-item__label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.meta-item__value {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-top: 0.125rem;
}

/* Admin config list */
.config-list { display: flex; flex-direction: column; gap: 0.5rem; }

.config-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--sohar-gray-50);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.config-item__actions { display: flex; gap: 0.375rem; }

/* Attachment list */
.attachment-list { display: flex; flex-direction: column; gap: 0.5rem; }

.attachment-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--sohar-gray-50);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

/* Review summary box */
.review-box {
  background: var(--sohar-gray-50);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.review-box dt {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.review-box dd {
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
}

.review-box dd:last-child { margin-bottom: 0; }
