/* unified-system.css - Consistent sizing and spacing system */

/* === UNIFIED SPACING SYSTEM === */
:root {
  --header-height: 32px;
  --header-padding: 6px 12px;
  --button-padding: 4px 10px;
  --button-height: 24px;
  --button-font: 10px;
  --button-gap: 6px;
  --card-margin: 16px;
  --card-padding: 16px;
  --border-radius-sm: 6px;
  --border-radius-md: 8px;
}

/* === RESET ALL HEADERS TO UNIFIED SIZE === */
.panel__head,
.panel-header,
.panel-header--compact,
.image-swatches__head {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: var(--header-padding) !important;
  min-height: var(--header-height) !important;
  height: var(--header-height) !important;
  background: rgba(255,255,255,.02);
  border-bottom: 1px solid var(--line);
  font-size: var(--button-font) !important;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  cursor: default;
  flex-shrink: 0 !important;
  flex-wrap: nowrap !important;
  overflow: visible !important;
}

.panel__head .title,
.panel-header span,
.panel-header--compact span,
.image-swatches__head h3 {
  font-size: var(--button-font) !important;
  font-weight: 600 !important;
  margin: 0 !important;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.image-swatches__head small {
  font-size: 9px !important;
  opacity: 0.7;
}

/* === UNIFIED BUTTONS === */
.btn,
.btn-xs,
.btn-sm,
.btn--primary,
.btn--secondary {
  padding: var(--button-padding) !important;
  min-height: var(--button-height) !important;
  height: var(--button-height) !important;
  font-size: var(--button-font) !important;
  border-radius: var(--border-radius-md) !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  white-space: nowrap;
}

.btn svg,
.btn-xs svg {
  width: 12px !important;
  height: 12px !important;
}

/* === UNIFIED SEGMENTED CONTROLS === */
.seg,
.seg--compact {
  display: inline-flex !important;
  padding: 2px !important;
  border-radius: var(--border-radius-md) !important;
  gap: 2px !important;
  height: var(--button-height) !important;
  align-items: center;
}

.seg__btn,
.seg--compact .seg__btn {
  padding: var(--button-padding) !important;
  font-size: var(--button-font) !important;
  border-radius: var(--border-radius-sm) !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  height: 20px !important;
}

/* === UNIFIED ACTIONS CONTAINER === */
.palette-actions,
.panel .actions,
.actions {
  display: flex !important;
  flex-direction: row !important;
  gap: var(--button-gap) !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  overflow: visible !important;
}

.palette-actions > *,
.panel .actions > *,
.actions > * {
  flex-shrink: 0 !important;
}

/* === UNIFIED CARD SPACING === */
.panel .card {
  margin: var(--card-margin) !important;
  padding: 0 !important;
}

.panel .card.glass {
  padding: var(--card-padding) !important;
}

.panel .card:first-child {
  margin-top: var(--card-margin) !important;
}

/* === SPECIFIC OVERRIDES FOR CONSISTENCY === */
#gradient {
  margin: var(--card-padding) !important;
  margin-top: 0 !important;
}

.gradient-controls,
.row {
  padding: 12px var(--card-padding) !important;
}

/* === IMAGE SWATCHES HEADER === */
.image-swatches {
  padding: var(--card-padding) !important;
}

.image-swatches__head {
  margin-bottom: 12px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  height: auto !important;
  min-height: auto !important;
}

/* === COMMUNITY FILTERS === */
.community-filters {
  display: flex;
  gap: var(--button-gap) !important;
  padding: var(--card-padding) !important;
}

.filter-btn {
  padding: var(--button-padding) !important;
  height: var(--button-height) !important;
  font-size: var(--button-font) !important;
  border-radius: var(--border-radius-md) !important;
  font-weight: 600 !important;
}

/* === PREVIEW TABS === */
.preview-tabs {
  display: flex !important;
  gap: 2px !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
}

.preview-tabs::-webkit-scrollbar {
  display: none !important;
}

.preview-tab {
  appearance: none !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--text) !important;
  padding: 4px 10px !important;
  border-radius: 6px !important;
  font-size: 9px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
  text-transform: uppercase !important;
  letter-spacing: 0.3px !important;
  opacity: 0.6 !important;
}

.preview-tab:hover {
  background: rgba(255,255,255,.08) !important;
  opacity: 1 !important;
}

.preview-tab.is-active {
  background: linear-gradient(135deg, var(--gradA), var(--gradB)) !important;
  color: #fff !important;
  opacity: 1 !important;
  box-shadow: 0 2px 8px rgba(91,140,255,.3) !important;
}

/* === PROFILE TABS === */
.profile-tab {
  padding: var(--button-padding) !important;
  font-size: var(--button-font) !important;
  gap: 6px !important;
}

.tab-count {
  padding: 2px 6px !important;
  font-size: 9px !important;
  border-radius: 10px !important;
}

/* === OVERRIDE ANY VERTICAL STACKING FROM OLD CSS === */
.palette-actions,
.panel .actions,
.actions,
.panel__head .actions,
.panel-header .palette-actions,
.panel-header--compact .palette-actions,
div.palette-actions,
section .palette-actions,
.card .palette-actions {
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
}

/* Kill any media query overrides */
@media (max-width: 768px) {
  .palette-actions,
  .panel .actions,
  .actions,
  .panel__head .actions,
  .panel-header .palette-actions,
  .panel-header--compact .palette-actions {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
  }
}

/* === RESPONSIVE UNIFIED === */
@media (max-width: 768px) {
  :root {
    --button-padding: 4px 8px;
    --button-gap: 4px;
    --card-margin: 12px;
  }

  /* Force horizontal layout on tablets */
  .palette-actions,
  .panel .actions,
  .actions {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
  }
}

@media (max-width: 600px) {
  :root {
    --button-padding: 3px 6px;
    --button-font: 9px;
    --button-height: 20px;
    --header-height: 28px;
    --header-padding: 4px 8px;
    --button-gap: 3px;
  }

  /* Force horizontal layout on mobile */
  .palette-actions,
  .panel .actions,
  .actions {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 3px !important;
  }

  /* Smaller segmented control text on mobile */
  .seg__btn,
  .seg--compact .seg__btn {
    font-size: 8px !important;
    padding: 3px 6px !important;
  }
}
