/* Buttons per DESIGN.md */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  user-select: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

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

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

.btn-primary:disabled,
.btn-primary.disabled {
  background-color: var(--color-primary-disabled);
  border-color: var(--color-primary-disabled);
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background-color: var(--color-surface-card);
  color: var(--color-ink);
  border: 1px solid var(--color-hairline);
}

.btn-secondary:hover {
  border-color: var(--color-border-strong);
  background-color: var(--color-surface-soft);
}

.btn-pill {
  border-radius: var(--radius-full);
}

.btn-pill-rausch {
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--radius-full);
  padding: 7px 16px;
  min-height: 36px;
  font-size: 13px;
}

.btn-pill-rausch:hover {
  background-color: var(--color-primary-active);
}

.btn-tertiary {
  background: transparent;
  color: var(--color-ink);
  border: none;
  padding: 6px 10px;
  min-height: auto;
}

.btn-tertiary:hover {
  text-decoration: underline;
}

.btn-success {
  background-color: #008a05;
  color: #fff;
  border-color: #008a05;
}

.btn-success:hover {
  background-color: #007004;
}

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

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

.btn-sm {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-full {
  width: 100%;
}

/* Pill Search Bar per DESIGN.md (Optimized for Mobile) */
.search-bar-container {
  margin-bottom: var(--spacing-md);
  width: 100%;
}

.search-bar-pill {
  background-color: var(--color-surface-card);
  border: 1px solid var(--color-hairline);
  box-shadow: var(--shadow-subtle);
  border-radius: var(--radius-full);
  height: 52px;
  display: flex;
  align-items: center;
  padding: 4px 6px 4px 16px;
  transition: all 0.2s ease;
  width: 100%;
}

.search-bar-pill:focus-within {
  border-color: var(--color-ink);
  box-shadow: var(--shadow-card);
}

.search-input-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.search-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-ink);
  letter-spacing: 0.5px;
  line-height: 1;
  margin-bottom: 2px;
}

.search-input {
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-family);
  font-size: 14px;
  color: var(--color-ink);
  width: 100%;
  padding: 0;
}

.search-input::placeholder {
  color: var(--color-muted);
  font-size: 13px;
}

.search-orb {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 6px;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.search-orb:active {
  transform: scale(0.92);
}

.search-orb svg {
  width: 16px;
  height: 16px;
  stroke: #fff;
  stroke-width: 2.5;
  fill: none;
}

/* Filter Strip & Tabs (Mobile Touch Scrollable) */
.filter-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: var(--spacing-sm);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  background-color: var(--color-surface-card);
  border: 1px solid var(--color-hairline);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.filter-tab.active {
  background-color: var(--color-ink);
  color: var(--color-on-dark);
  border-color: var(--color-ink);
}

.filter-tab .tab-count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.08);
}

.filter-tab.active .tab-count {
  background: rgba(255, 255, 255, 0.2);
}

/* Secondary Filter Bar */
.filters-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-sm);
}

.filters-panel {
  display: none;
  background-color: var(--color-surface-card);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-md);
  padding: var(--spacing-base);
  margin-bottom: var(--spacing-md);
  animation: fadeIn 0.15s ease-out;
  box-shadow: var(--shadow-subtle);
}

.filters-panel.open {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
}

@media (min-width: 640px) {
  .filters-panel.open {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Form Inputs per DESIGN.md */
.form-group {
  margin-bottom: var(--spacing-md);
  width: 100%;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
  margin-bottom: 5px;
}

.form-label .required {
  color: var(--color-primary);
}

.text-input,
.select-input,
.textarea-input {
  width: 100%;
  background-color: var(--color-surface-card);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-family: var(--font-family);
  font-size: 15px;
  color: var(--color-ink);
  outline: none;
  transition: border-color 0.15s ease;
  min-height: 46px;
}

.text-input:focus,
.select-input:focus,
.textarea-input:focus {
  border-color: var(--color-ink);
  border-width: 2px;
  padding: 10px 12px;
}

.textarea-input {
  min-height: 80px;
  resize: vertical;
}

.input-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.input-row > * {
  flex: 1;
  min-width: 0;
}

/* Switch / Toggle */
.toggle-switch-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background-color: var(--color-surface-soft);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-hairline);
  min-height: 46px;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-border-strong);
  transition: 0.2s;
  border-radius: var(--radius-full);
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: var(--radius-full);
}

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

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

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.status-badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.status-badge.DELIVERED {
  background-color: var(--status-delivered-bg);
  color: var(--status-delivered-text);
  border: 1px solid var(--status-delivered-border);
}
.status-badge.DELIVERED .badge-dot {
  background-color: var(--status-delivered-orb);
}

.status-badge.FAILED {
  background-color: var(--status-failed-bg);
  color: var(--status-failed-text);
  border: 1px solid var(--status-failed-border);
}
.status-badge.FAILED .badge-dot {
  background-color: var(--status-failed-orb);
}

.status-badge.PENDING {
  background-color: var(--status-pending-bg);
  color: var(--status-pending-text);
  border: 1px solid var(--status-pending-border);
}
.status-badge.PENDING .badge-dot {
  background-color: var(--status-pending-orb);
}

/* Chips */
.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background-color: var(--color-surface-soft);
  border: 1px solid var(--color-hairline);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-body);
  white-space: nowrap;
}

/* Modals and Scrim */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-scrim);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 12px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background-color: var(--color-surface-card);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: modalEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: var(--spacing-base);
  border-bottom: 1px solid var(--color-hairline-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: var(--spacing-base);
  flex: 1;
}

.modal-footer {
  padding: var(--spacing-md) var(--spacing-base);
  border-top: 1px solid var(--color-hairline-soft);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--spacing-sm);
  background-color: var(--color-surface-soft);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 24px);
  max-width: 380px;
}

.toast-pill {
  pointer-events: auto;
  background-color: var(--color-ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn 0.25s ease-out;
}

.toast-pill.success {
  background-color: #007a3d;
}

.toast-pill.error {
  background-color: var(--color-primary-error);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
