/* ============================================================
   ClickBid Admin Enhancements CSS
   Shared across ALL admin pages. Drop this into your <head>.
   Requires: styles.css (design system base) already loaded.
   ============================================================ */

/* ---- Page Header ---- */
.settings-page-header { margin-bottom: 1.5rem; }
.settings-title { font-size: 1.5rem; font-weight: 700; color: #22262A; margin: 0; }
.settings-subtitle { font-size: 0.875rem; color: #767676; line-height: 1.6; margin: 0.25rem 0 0; }
.settings-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.settings-header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-shrink: 0;
}

/* ---- Breadcrumbs ---- */
.cb-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}
.cb-breadcrumb-link { color: #687582; text-decoration: none; transition: color 0.15s; }
.cb-breadcrumb-link:hover { color: #07529C; }
.cb-breadcrumb-sep { color: #CBD5E1; font-size: 0.625rem; }
.cb-breadcrumb-current { color: #22262A; font-weight: 500; }

/* ---- Sticky Section Navigation ---- */
.cb-section-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: white;
  border-bottom: 1px solid #E5E7EB;
  border-radius: 8px 8px 0 0;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.cb-section-nav-inner {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0 0.5rem;
}
.cb-section-nav-inner::-webkit-scrollbar { display: none; }
.cb-section-nav-link {
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #687582;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.cb-section-nav-link:hover { color: #07529C; background: #F9FAFB; }
.cb-section-nav-link.active {
  color: #07529C;
  border-bottom-color: #07529C;
}

/* ---- Collapsible Settings Sections ---- */
.settings-section {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
  box-shadow: 0 1px 3px rgba(7, 82, 156, 0.08);
  margin-bottom: 1rem;
}
.settings-section:hover {
  box-shadow: 0 4px 16px -1px rgba(0, 0, 0, 0.06),
              0 2px 8px -1px rgba(0, 0, 0, 0.04);
}
.settings-section-header {
  width: 100%;
  padding: 1.125rem 1.5rem;
  background: white;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
  font-family: inherit;
}
.settings-section-header:hover { background-color: #F9FAFB; }
.section-header-content { display: flex; align-items: center; gap: 0.75rem; }
.section-icon { color: #07529C; font-size: 1.125rem; width: 1.25rem; text-align: center; }
.settings-section-header h2 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  color: #22262A;
}
.section-header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section-badge {
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background: #E5F6D2;
  color: #456813;
}
.section-badge-warning {
  background: #FEF9C3;
  color: #854D0E;
}
.section-toggle {
  color: #687582;
  transition: transform 0.3s ease;
  font-size: 0.875rem;
}
.settings-section-header[aria-expanded="true"] .section-toggle {
  transform: rotate(180deg);
}
.settings-section-content {
  padding: 1.5rem;
  border-top: 1px solid #E5E7EB;
  background: white;
}
.settings-section.collapsed .settings-section-content { display: none; }

/* ---- Form Layout ---- */
.form-group { margin-bottom: 1.25rem; }
.form-group:last-child { margin-bottom: 0; }
.form-hint {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: #687582;
  line-height: 1.4;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* Input with icon */
.input-with-icon { position: relative; }
.input-with-icon .form-input { padding-right: 2.5rem; }
.input-with-icon .input-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #687582;
  pointer-events: none;
}

/* Input with prefix ($, https://, etc.) */
.input-with-prefix {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid #D1D5DB;
  border-radius: 0.5rem;
  overflow: hidden;
}
.input-prefix {
  padding: 0 0.75rem;
  color: #687582;
  font-weight: 500;
  font-size: 0.875rem;
  border-right: 1px solid #D1D5DB;
  background: #F9FAFB;
  align-self: stretch;
  display: flex;
  align-items: center;
}
.input-with-prefix .form-input { border: none; flex: 1; }

/* Input + toggle side-by-side */
.input-with-toggle {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.input-with-toggle .form-input { flex: 1; min-width: 250px; }

/* ---- Toggle Switch ---- */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
}
.toggle-switch input { display: none; }
.toggle-slider {
  width: 2.5rem;
  height: 1.5rem;
  background-color: #CBD5E1;
  border-radius: 9999px;
  position: relative;
  transition: background-color 0.2s;
  flex-shrink: 0;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
  background: white;
  border-radius: 50%;
  top: 0.125rem;
  left: 0.125rem;
  transition: transform 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.toggle-switch input:checked + .toggle-slider { background-color: #7BC122; }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(1rem); }
.toggle-label { font-size: 0.875rem; color: #22262A; }

/* ---- Checkbox Group ---- */
.checkbox-group { display: flex; flex-direction: column; gap: 0.75rem; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: #22262A;
}
.checkbox-label input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: #07529C;
}

/* ---- Collapsible Alert / Info Box ---- */
.cb-collapsible-alert { align-items: center; }
.cb-alert-details { margin-top: 0.5rem; }
.cb-alert-details p { margin: 0 0 0.5rem; }
.cb-alert-details p:last-child { margin-bottom: 0; }
.cb-alert-toggle {
  background: none;
  border: none;
  color: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0;
  margin-top: 0.25rem;
  opacity: 0.8;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.cb-alert-toggle:hover { opacity: 1; }
.cb-alert-toggle i { font-size: 0.625rem; }

/* Dismissible alerts */
.cb-dismissible { position: relative; padding-right: 2.5rem; }
.cb-alert-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
  font-size: 0.875rem;
  transition: opacity 0.15s;
}
.cb-alert-close:hover { opacity: 1; }

/* ---- Contextual Help Tooltip ---- */
.cb-help-trigger {
  background: none;
  border: none;
  color: #07529C;
  cursor: pointer;
  font-size: 0.8125rem;
  padding: 0;
  margin-left: 0.25rem;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  vertical-align: middle;
  margin-top: -2px;
  transition: color 0.15s;
}
.cb-help-trigger:hover { color: #05417A; }
.cb-help-tooltip {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: 30;
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 0.5rem;
  padding: 1rem;
  width: 320px;
  max-width: calc(100vw - 2rem);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.cb-help-tooltip p {
  font-size: 0.8125rem;
  color: #687582;
  margin: 0 0 0.75rem;
  font-weight: 400;
  line-height: 1.5;
}
.cb-help-tooltip p:last-of-type { margin-bottom: 0.5rem; }
.cb-help-close {
  background: none;
  border: none;
  color: #07529C;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.cb-help-close:hover { text-decoration: underline; }

/* ---- Sticky Save Bar ---- */
.cb-sticky-save {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: white;
  border-top: 1px solid #E5E7EB;
  padding: 0.75rem 1.5rem;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  transition: opacity 0.3s;
}
.cb-sticky-save:not(.has-changes) { opacity: 0.5; pointer-events: none; }
.cb-sticky-save.has-changes { opacity: 1; pointer-events: auto; }
.cb-sticky-save-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}
.cb-save-status {
  font-size: 0.875rem;
  color: #687582;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cb-save-actions { display: flex; gap: 0.75rem; }

/* ---- File Upload Zone ---- */
.file-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border: 2px dashed #D1D5DB;
  border-radius: 0.5rem;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}
.file-upload-area:hover,
.file-upload-area.dragover {
  border-color: #07529C;
  background: #E6F0FB;
}
.file-upload-area i { font-size: 2rem; color: #687582; margin-bottom: 0.5rem; }
.file-upload-area p { margin: 0; font-size: 0.875rem; color: #22262A; }
.file-hint { font-size: 0.75rem !important; color: #687582 !important; margin-top: 0.25rem !important; }

/* ---- Notification / Toggle List ---- */
.notification-settings { display: flex; flex-direction: column; gap: 0.75rem; }
.notification-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: #F9FAFB;
  border-radius: 0.5rem;
  border: 1px solid #E5E7EB;
}
.notification-info h4 { margin: 0; font-size: 0.875rem; font-weight: 600; color: #22262A; }
.notification-info p { margin: 0.25rem 0 0; font-size: 0.75rem; color: #687582; }

/* ---- Phone Mockup Preview ---- */
.cb-phone-preview {
  position: sticky;
  top: 5rem;
  width: 280px;
  flex-shrink: 0;
}
.cb-phone-frame {
  background: #F9FAFB;
  border: 2px solid #E5E7EB;
  border-radius: 2rem;
  padding: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
.cb-phone-frame-header {
  text-align: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #E5E7EB;
  margin-bottom: 0.75rem;
}
.cb-phone-frame-header span {
  font-size: 0.75rem;
  color: #687582;
  font-weight: 500;
}

/* ---- Section with Side Preview ---- */
.settings-section-split {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.settings-section-split-main { flex: 1; min-width: 0; }
@media (max-width: 1024px) {
  .settings-section-split { flex-direction: column; }
  .cb-phone-preview { position: static; width: 100%; max-width: 300px; margin: 0 auto; }
}

/* ---- Icon Buttons ---- */
.btn-icon,
.btn-icon-danger {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
  color: #687582;
}
.btn-icon:hover { background: #F3F4F6; color: #22262A; }
.btn-icon-danger { color: #EF4444; }
.btn-icon-danger:hover { background: #FEE2E2; color: #DC2626; }

/* ---- Enhanced Data Table ---- */
.cb-table-wrap {
  overflow-x: auto;
  border: 1px solid #E5E7EB;
  border-radius: 0.5rem;
}
.cb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.cb-table thead { background: #F9FAFB; }
.cb-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #F9FAFB;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  color: #687582;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid #E5E7EB;
  white-space: nowrap;
}
.cb-table thead th.sortable { cursor: pointer; user-select: none; }
.cb-table thead th.sortable:hover { color: #07529C; }
.cb-table thead th .sort-icon { margin-left: 0.25rem; font-size: 0.625rem; opacity: 0.4; }
.cb-table thead th.sorted-asc .sort-icon,
.cb-table thead th.sorted-desc .sort-icon { opacity: 1; color: #07529C; }
.cb-table tbody tr { border-bottom: 1px solid #F3F4F6; transition: background-color 0.1s; }
.cb-table tbody tr:last-child { border-bottom: none; }
.cb-table tbody tr:hover { background-color: #F9FAFB; }
.cb-table tbody tr.selected { background-color: #E6F0FB; }
.cb-table tbody td { padding: 0.75rem 1rem; color: #22262A; vertical-align: middle; }
.cb-table .col-checkbox { width: 2.5rem; text-align: center; }
.cb-table .col-checkbox input[type="checkbox"] {
  width: 1rem; height: 1rem; accent-color: #07529C; cursor: pointer;
}
.cb-table .col-actions { width: 5rem; text-align: right; }
.cb-table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: #687582;
  border-top: 1px solid #E5E7EB;
  background: #F9FAFB;
}
.cb-table-pagination { display: flex; gap: 0.25rem; }
.cb-table-pagination button {
  width: 2rem; height: 2rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #E5E7EB; border-radius: 0.375rem;
  background: white; color: #687582; cursor: pointer;
  font-size: 0.75rem; transition: all 0.15s;
}
.cb-table-pagination button:hover { border-color: #07529C; color: #07529C; }
.cb-table-pagination button.active {
  background: #07529C; color: white; border-color: #07529C;
}

/* ---- Batch Actions Bar ---- */
.cb-batch-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #E6F0FB;
  border: 1px solid #B8D4F0;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.cb-batch-bar[hidden] { display: none; }
.cb-batch-count { font-weight: 600; color: #07529C; white-space: nowrap; }
.cb-batch-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---- Filter Tabs ---- */
.cb-filter-tabs { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.cb-filter-tab {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #687582;
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s;
}
.cb-filter-tab:hover { border-color: #07529C; color: #07529C; }
.cb-filter-tab.active { background: #07529C; color: white; border-color: #07529C; }

/* ---- Tag Input ---- */
.cb-tag-list { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cb-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  background: #E6F0FB;
  color: #07529C;
}
.cb-tag-remove {
  background: none; border: none; cursor: pointer; color: inherit;
  font-size: 0.625rem; opacity: 0.6; padding: 0; line-height: 1;
}
.cb-tag-remove:hover { opacity: 1; }

/* ---- Utility ---- */
.mr-2 { margin-right: 0.5rem; }
.mr-1 { margin-right: 0.25rem; }
.mb-4 { margin-bottom: 1rem; }
.text-xs { font-size: 0.75rem; }

/* ---- Settings Form Container ---- */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 6rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .settings-header-row { flex-direction: column; }
  .settings-header-actions { width: 100%; justify-content: flex-end; }
  .cb-section-nav-link { padding: 0.625rem 0.75rem; font-size: 0.75rem; }
  .settings-section-content { padding: 1rem; }
  .settings-grid { grid-template-columns: 1fr; }
  .cb-sticky-save-inner { flex-direction: column; gap: 0.5rem; text-align: center; }
}
