/* ==========================================================================
   UI COMPONENTS (OVERFLOW-SAFE, PRODUCTION READY)
   ========================================================================== */

/* 1. Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-900);
  color: #ffffff;
  border-color: var(--primary-900);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover, .btn-primary:active {
  background: var(--primary-800);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-gold-500), var(--accent-gold-700));
  color: var(--primary-950);
  border-color: var(--accent-gold-400);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(223, 154, 21, 0.25);
}

.btn-accent:hover, .btn-accent:active {
  background: var(--accent-gold-400);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover, .btn-secondary:active {
  background: var(--bg-subtle);
}

.btn-urgent {
  background: var(--status-urgent-bg);
  color: var(--status-urgent);
  border: 1px solid rgba(220, 38, 38, 0.3);
  font-weight: 600;
}

.btn-success {
  background: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid rgba(22, 163, 74, 0.3);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.76rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* 2. Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-urgent {
  background: var(--status-urgent-bg);
  color: var(--status-urgent);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.badge-gold {
  background: var(--accent-gold-100);
  color: var(--accent-gold-900);
  border: 1px solid rgba(228, 156, 12, 0.3);
}

.badge-active {
  background: var(--status-active-bg);
  color: var(--status-active);
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.badge-success {
  background: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.badge-neutral {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* 3. Filter Chips */
.chip-container {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chip-container::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  padding: 0.35rem 0.75rem;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.filter-chip:hover {
  border-color: var(--accent-gold-500);
  color: var(--text-main);
}

.filter-chip.active {
  background: var(--primary-900);
  color: #ffffff;
  border-color: var(--primary-900);
}

.filter-chip .chip-count {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  font-size: 0.65rem;
  padding: 0.08rem 0.3rem;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.filter-chip:not(.active) .chip-count {
  background: var(--bg-subtle);
  color: var(--text-muted);
}

/* 4. Form Inputs & Textareas */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
}

.form-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label .optional {
  font-size: 0.68rem;
  color: var(--text-subtle);
  font-weight: 400;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-gold-500);
  box-shadow: 0 0 0 3px rgba(223, 154, 21, 0.15);
}

.form-textarea {
  resize: vertical;
  min-height: 75px;
  line-height: 1.4;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.input-with-icon .form-input {
  padding-left: 2.1rem;
}

/* 5. Tab Bars */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: #ffffff;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  margin-bottom: 0.75rem;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  padding: 0.6rem 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--primary-900);
  border-bottom-color: var(--accent-gold-500);
}

/* 6. Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-strong);
}

.empty-icon {
  margin-bottom: 0.6rem;
  color: var(--text-muted);
}

.empty-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.empty-desc {
  font-size: 0.78rem;
  line-height: 1.4;
  max-width: 250px;
}

/* 7. Section Titles */
.section-title-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.75rem 0 0.45rem 0;
  gap: 0.5rem;
}

.section-title-strip h2 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary-900);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
