/**
 * Shared page polish — unified hero header (favorites/tags style)
 */

/* ---- Unified page hero ---- */
.dashboard-header,
.settings-header,
.profile-header,
.favorites-header,
.tags-header,
.help-header,
.admin-header {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem !important;
  padding: 1.35rem 1.5rem !important;
  background: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-xs) !important;
  border-radius: 16px !important;
  position: relative;
  overflow: hidden;
  transition: none !important;
}

.dashboard-header::before,
.settings-header::before,
.profile-header::before,
.favorites-header::before,
.tags-header::before,
.help-header::before,
.admin-header::before {
  content: '' !important;
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06) 0%, rgba(99, 102, 241, 0.04) 100%) !important;
  pointer-events: none;
  opacity: 1 !important;
  transform: none !important;
}

/* page-specific soft tints */
.favorites-header::before {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(251, 191, 36, 0.04) 100%) !important;
}
.tags-header::before {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(167, 139, 250, 0.04) 100%) !important;
}
.settings-header::before {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.07) 0%, rgba(96, 165, 250, 0.03) 100%) !important;
}
.profile-header::before {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.07) 0%, rgba(52, 211, 153, 0.03) 100%) !important;
}
.admin-header::before {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.06) 0%, rgba(248, 113, 113, 0.03) 100%) !important;
}

.page-hero-left,
.dashboard-header > div:first-child,
.settings-header > div:first-child,
.favorites-header > div:first-child,
.tags-header > div:first-child {
  position: relative;
  z-index: 1;
  min-width: 0;
  flex: 1 1 auto;
}

.dashboard-title,
.settings-title,
.profile-title,
.page-title,
.favorites-title,
.tags-title,
.help-title,
.admin-title {
  background: none !important;
  -webkit-text-fill-color: unset !important;
  color: var(--text-color) !important;
  letter-spacing: -0.03em;
  font-weight: 700 !important;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem) !important;
  margin: 0 0 4px !important;
  padding-bottom: 10px !important; /* room for underline */
  position: relative;
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  z-index: 1;
  line-height: 1.25;
}

.dashboard-title i,
.settings-title i,
.profile-title i,
.favorites-title i,
.tags-title i,
.help-title i,
.admin-title i {
  font-size: 1.05em;
  flex-shrink: 0;
}

/* accent underline under title */
.dashboard-title::after,
.settings-title::after,
.profile-title::after,
.favorites-title::after,
.tags-title::after,
.help-title::after,
.admin-title::after {
  content: '' !important;
  display: block !important;
  position: absolute;
  bottom: 0;
  left: 0;
  width: 44px;
  height: 3px;
  border-radius: 3px;
  background: var(--primary-color) !important;
}

.favorites-title::after { background: #f59e0b !important; }
.tags-title::after { background: #8b5cf6 !important; }
.profile-title::after { background: #10b981 !important; }
.admin-title::after { background: #ef4444 !important; }

.page-hero-sub,
.dashboard-header p,
.settings-header p,
.profile-header p,
.favorites-header p,
.tags-header p,
.admin-header p,
.help-subtitle {
  margin: 12px 0 0 !important;
  color: var(--text-light) !important;
  font-size: 0.9rem !important;
  position: relative;
  z-index: 1;
  line-height: 1.5;
}

/* right side: action pills / mini stats */
.page-hero-right,
.dashboard-actions,
.profile-actions,
.favorites-stats,
.tags-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: stretch;
  position: relative;
  z-index: 1;
}

.favorites-stat,
.tags-stat,
.page-hero-stat {
  text-align: center;
  padding: 0.65rem 0.9rem;
  min-width: 72px;
  background: var(--fill-tertiary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.favorites-stat {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.22);
}
.tags-stat {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.22);
}

@media (max-width: 768px) {
  .favorites-header,
  .tags-header {
    align-items: stretch !important;
  }

  .favorites-stats,
  .tags-stats {
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }

  .favorites-stat,
  .tags-stat {
    width: 100%;
    min-width: 0 !important;
    min-height: 64px;
    padding: 0.6rem 0.5rem;
  }

  .favorites-stat-value,
  .tags-stat-value {
    font-size: 1.05rem;
  }
}

.favorites-stat-value,
.tags-stat-value,
.page-hero-stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  letter-spacing: -0.02em;
}
.favorites-stat-value { color: #f59e0b; }
.tags-stat-value { color: #8b5cf6; }
.page-hero-stat-value { color: var(--primary-color); }

.favorites-stat-label,
.tags-stat-label,
.page-hero-stat-label {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* help header: stack search under title row */
.help-header {
  flex-direction: column !important;
  align-items: stretch !important;
}
.help-header .help-title {
  align-self: flex-start;
}
.help-search {
  position: relative;
  z-index: 1;
  margin-top: 0.75rem;
  max-width: 420px;
}

/* admin title sits inside .admin-header now */
.admin-header .admin-title {
  margin-bottom: 0 !important;
}

@media (max-width: 768px) {
  .dashboard-header,
  .settings-header,
  .profile-header,
  .favorites-header,
  .tags-header,
  .help-header,
  .admin-header {
    padding: 1.1rem 1rem !important;
  }

  .dashboard-actions,
  .profile-actions {
    width: 100%;
  }

  .dashboard-actions .upload-btn,
  .dashboard-actions .stats-toggle-btn,
  .profile-actions .action-btn {
    flex: 1;
    justify-content: center;
  }
}

/* search / filters: no rigid min-widths */
.search-bar,
.filter-options,
.dashboard-actions {
  max-width: 100%;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  min-width: 0 !important;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 4px 8px;
  box-shadow: none !important;
}

.search-input,
#searchInput {
  flex: 1;
  min-width: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 16px !important;
  color: var(--text-color);
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
  margin: 12px 0 20px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0 !important;
}

.filter-group select,
.sort-select,
.search-box,
.filter-select {
  min-width: 0 !important;
  max-width: 100%;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-color);
  padding: 8px 12px;
}

@media (max-width: 768px) {
  .filter-options {
    gap: 8px;
    align-items: center !important;
    flex-direction: row !important;
  }
}

/* image grid cards */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.image-card,
.image-card-enhanced {
  border-radius: 16px !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-xs) !important;
  background: var(--card-bg) !important;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.image-card:hover,
.image-card-enhanced:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm) !important;
}

/* action chips on cards: calmer, less pink neon */
.image-card .btn,
.image-card button,
.image-actions button,
.card-actions button {
  border-radius: 999px !important;
  font-weight: 500;
  min-height: 34px;
}

/* settings grid: avoid 400px min on phones */
.settings-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)) !important;
  gap: 16px !important;
}

.settings-card,
.profile-card {
  border-radius: 16px !important;
  box-shadow: var(--shadow-xs) !important;
  border: 1px solid var(--border-color) !important;
  transition: none !important;
}

.settings-card:hover,
.profile-card:hover {
  transform: none !important;
  box-shadow: var(--shadow-sm) !important;
}

.profile-content {
  gap: 16px !important;
}

@media (max-width: 768px) {
  .profile-content {
    grid-template-columns: 1fr !important;
  }

  .dashboard-header,
  .settings-header,
  .profile-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
  }

  .dashboard-actions {
    width: 100%;
    justify-content: stretch;
  }

  .dashboard-actions .upload-btn,
  .dashboard-actions .stats-toggle-btn {
    flex: 1;
  }

  .filter-options {
    gap: 8px;
  }

  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
}

/* admin tables stay scrollable, chrome softer */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.admin-stat-card {
  border-radius: 14px !important;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  box-shadow: var(--shadow-xs);
}

/* help content readable width */
.help-container,
.help-content {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

/* list view mobile safety (dashboard) */
.image-grid.list-view {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.image-grid.list-view .image-card,
.image-grid.list-view .image-card-enhanced {
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

@media (max-width: 768px) {
  .image-grid.list-view .image-preview-enhanced,
  .image-grid.list-view .image-preview {
    max-height: 88px !important;
  }

  .image-grid.list-view .image-preview-enhanced img,
  .image-grid.list-view .image-preview img {
    object-fit: cover !important;
    max-height: 100%;
  }
}
.image-card .image-actions,
.image-card-enhanced .image-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  padding: 0.55rem 0.65rem;
  border-top: 1px solid var(--border-color);
  background: transparent;
  /* lock row height so copy success text never reflows the card */
  min-height: 46px;
  box-sizing: border-box;
}

.image-card .image-btn,
.image-card-enhanced .image-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--fill-tertiary);
  color: var(--text-color);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  line-height: 1;
  transition: opacity 0.15s ease, transform 80ms ease-out, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.image-card .image-btn svg,
.image-card-enhanced .image-btn svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.image-card .copy-btn,
.image-card-enhanced .copy-btn {
  background: var(--fill-tertiary);
  color: var(--text-color);
}

.image-card .copy-btn.is-copied,
.image-card-enhanced .copy-btn.is-copied {
  background: color-mix(in srgb, #34c759 14%, transparent);
  color: #34c759;
  border-color: color-mix(in srgb, #34c759 35%, transparent);
}

@media (max-width: 420px) {
  /* ultra-narrow: icon only keeps equal chips */
  .image-card .image-btn,
  .image-card-enhanced .image-btn {
    font-size: 0;
    gap: 0;
    padding: 0;
  }
  .image-card .image-btn svg,
  .image-card-enhanced .image-btn svg {
    font-size: 14px;
  }
}

.image-card .edit-btn,
.image-card-enhanced .edit-btn {
  background: color-mix(in srgb, var(--primary-color) 12%, transparent);
  color: var(--primary-color);
  border-color: color-mix(in srgb, var(--primary-color) 28%, transparent);
}

.image-card .delete-btn,
.image-card-enhanced .delete-btn {
  background: color-mix(in srgb, #ff3b30 10%, transparent);
  color: #ff3b30;
  border-color: color-mix(in srgb, #ff3b30 28%, transparent);
}

.image-card .image-btn:active,
.image-card-enhanced .image-btn:active {
  transform: scale(0.97);
}
.premium-btn,
.btn-beauty,
.btn-beauty-accent,
.btn-beauty-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--fill-tertiary);
  color: var(--text-color);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  transition: opacity 0.15s ease, transform 80ms ease-out, background 0.15s ease;
}

.premium-btn:active,
.btn-beauty:active {
  transform: scale(0.97);
}

.premium-btn-primary,
.btn-beauty-accent,
.upload-btn.premium-btn-primary {
  background: var(--primary-color) !important;
  border-color: transparent !important;
  color: #fff !important;
}

.premium-btn-primary:hover,
.btn-beauty-accent:hover {
  opacity: 0.92;
}

.premium-btn-outline-primary,
.premium-btn-outline-secondary,
.stats-toggle-btn {
  background: var(--fill-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

.premium-btn-error,
.premium-btn-danger {
  background: #ff3b30 !important;
  border-color: transparent !important;
  color: #fff !important;
}

.premium-btn-sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 0.8125rem;
}

.premium-input,
.input-beauty {
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-color);
  color: var(--text-color);
  padding: 10px 12px;
  box-sizing: border-box;
}

.premium-img,
.premium-img-rounded {
  max-width: 100%;
  display: block;
}

.premium-img-rounded {
  border-radius: 12px;
}

.premium-img-shadow {
  box-shadow: var(--shadow-sm);
}

.premium-img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
