/* ============================================
   Dashboard Layout Styles
   ============================================ */

/* Dashboard Container */
.dashboard {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background: var(--slate-50);
}

/* ============ Sidebar ============ */
.sidebar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid var(--slate-200);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: var(--shadow-soft);
}

.sidebar-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--slate-200);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-violet) 50%, var(--brand-pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}

.sidebar-brand i {
  font-size: 1.5rem;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-lg) 0;
}

.nav-section {
  margin-bottom: var(--space-xl);
}

.nav-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 0 var(--space-lg);
  margin-bottom: var(--space-sm);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0.75rem var(--space-lg);
  color: var(--slate-600);
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.938rem;
  font-weight: 500;
  position: relative;
  border-radius: var(--radius-lg);
  margin: 0 var(--space-sm);
}

.nav-link:hover {
  background: var(--slate-50);
  color: var(--slate-900);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(124, 58, 237, 0.1) 100%);
  color: var(--brand-blue);
  font-weight: 600;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--brand-blue) 0%, var(--brand-violet) 100%);
  border-radius: 0 4px 4px 0;
}

.nav-link i {
  font-size: 1.125rem;
  width: 1.25rem;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  padding: 0.125rem 0.5rem;
  background: var(--primary);
  color: white;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.sidebar-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--slate-200);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--slate-50);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-profile:hover {
  background: var(--slate-100);
}

.user-avatar {
  width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-violet) 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-plan {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* ============ Main Content Area ============ */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--slate-200);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(2, 6, 23, 0.05);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--slate-900);
  cursor: pointer;
  padding: var(--space-sm);
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--slate-900);
  margin: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.search-box {
  position: relative;
  max-width: 300px;
}

.search-box input {
  padding-left: 2.5rem;
  padding-right: var(--space-md);
  width: 250px;
}

.search-box i {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

.topbar-icon-btn {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--slate-100);
  border: none;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-700);
  cursor: pointer;
  transition: all 0.2s ease;
}

.topbar-icon-btn:hover {
  background: var(--slate-200);
  color: var(--slate-900);
}

.topbar-icon-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 1.125rem;
  height: 1.125rem;
  background: var(--error);
  color: white;
  border-radius: 50%;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Credits Badge in Topbar */
.topbar-credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.825rem;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(250, 112, 154, 0.30);
  cursor: default;
  transition: opacity 0.2s;
}

.topbar-credits-badge i {
  font-size: 0.8rem;
  opacity: 0.92;
}

.topbar-credits-label {
  font-weight: 500;
  font-size: 0.75rem;
  opacity: 0.92;
}

/* Content Area */
.content {
  flex: 1;
  padding: var(--space-xl);
}

.content-header {
  margin-bottom: var(--space-xl);
}

.content-title {
  font-size: 1.875rem;
  font-weight: 800;
  margin-bottom: var(--space-sm);
}

.content-description {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* ============ Dashboard Specific Components ============ */

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-primary);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-2xl);
  padding: var(--space-xl);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-soft);
}

.stat-card:hover {
  box-shadow: 0 15px 35px rgba(2, 6, 23, 0.12);
  transform: translateY(-4px);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.stat-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
  font-size: 1.25rem;
  color: white;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--space-sm);
}

.stat-card-change {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
}

.stat-card-change.positive {
  color: var(--success);
}

.stat-card-change.negative {
  color: var(--error);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  background: var(--bg-primary);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
}

.empty-state-icon {
  width: 4rem;
  height: 4rem;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto var(--space-lg);
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.empty-state-description {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

/* ============================================================
   User Profile Modal  (.up-*)
   ============================================================ */

/* Overlay */
.up-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.up-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal box */
.up-modal {
  background: var(--bg-primary);
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(2, 6, 23, 0.18);
  transform: translateY(18px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.up-overlay.active .up-modal {
  transform: translateY(0) scale(1);
}

/* Header */
.up-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.75rem 1.25rem;
  border-bottom: 1px solid var(--slate-200);
  gap: 1rem;
}
.up-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
/* Avatar upload wrapper */
.up-avatar-wrap {
  position: relative;
  width: 3.25rem;
  height: 3.25rem;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 50%;
}
.up-avatar-wrap:hover .up-avatar-overlay {
  opacity: 1;
}
.up-avatar-wrap:hover .up-avatar-lg {
  filter: brightness(0.75);
}
/* Camera overlay */
.up-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  color: #fff;
  font-size: 0.85rem;
  pointer-events: none;
}
.up-avatar-lg {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-violet) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
  overflow: hidden;
  transition: filter 0.2s;
}
/* When photo loaded — hide initials text, show image */
.up-avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.up-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.2rem;
}
.up-plan-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--brand-violet);
  background: rgba(124, 58, 237, 0.1);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  letter-spacing: 0.01em;
}
.up-close {
  width: 2.1rem;
  height: 2.1rem;
  border: none;
  background: var(--slate-100);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.up-close:hover { background: var(--slate-200); color: var(--text-primary); }

/* Body */
.up-body {
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Section */
.up-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.up-section-title i { color: var(--brand-blue); font-size: 0.85rem; }

/* Info grid (read-only) */
.up-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.25rem;
}
.up-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.up-info-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.up-info-value {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
}
.up-status-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
}

/* Form grid (editable) */
.up-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}
.up-field { display: flex; flex-direction: column; gap: 0.35rem; }
.up-field-full { grid-column: 1 / -1; }
.up-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.up-input-wrap {
  position: relative;
}
.up-input-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 0.8rem;
  pointer-events: none;
}
.up-input {
  width: 100%;
  padding: 0.6rem 0.85rem 0.6rem 2.3rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.up-input:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.up-input::placeholder { color: var(--slate-400); }

/* Footer */
.up-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.1rem 1.75rem 1.5rem;
  border-top: 1px solid var(--slate-200);
}
.up-btn-cancel {
  padding: 0.6rem 1.2rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.up-btn-cancel:hover { background: var(--slate-50); border-color: var(--slate-300); }
.up-btn-save {
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-violet) 100%);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.up-btn-save:hover { opacity: 0.9; transform: translateY(-1px); }
.up-btn-save:active { transform: translateY(0); }

/* Dark mode adjustments */
[data-theme="dark"] .up-input {
  background: var(--bg-secondary);
  border-color: var(--slate-600);
}
[data-theme="dark"] .up-close { background: var(--bg-tertiary); }
[data-theme="dark"] .up-close:hover { background: var(--slate-600); }

/* Responsive */
@media (max-width: 540px) {
  .up-info-grid,
  .up-form-grid { grid-template-columns: 1fr; }
  .up-field-full { grid-column: auto; }
  .up-header,
  .up-body,
  .up-footer { padding-left: 1.1rem; padding-right: 1.1rem; }
}

/* ── Country trigger box ──────────────────────────────────────────────────── */
.up-country-trigger {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--bg-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  user-select: none;
  min-height: 2.5rem;
}
.up-country-trigger:hover {
  border-color: var(--slate-300);
}
.up-country-trigger.open {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.up-country-trigger .selected-text {
  color: var(--text-primary) !important;
}

/* ── Phone Number Combined Field ─────────────────────────────────────────── */
.up-phone-combined {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  height: 2.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}
.up-phone-combined:focus-within {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.10);
}
.up-phone-combined.open {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.10);
}
/* Left: dial code clickable area */
.up-phone-dial {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.28rem;
  padding: 0 0.7rem;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  white-space: nowrap;
  background: transparent;
}
.up-phone-dial span:nth-child(2) {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}
.up-phone-dial .fa-chevron-down {
  font-size: 0.6rem;
  color: var(--text-tertiary);
  transition: transform 0.2s;
}
/* Vertical divider */
.up-phone-divider {
  display: block;
  width: 1.5px;
  flex-shrink: 0;
  background: var(--slate-200);
  margin: 0.45rem 0;
  align-self: stretch;
}
/* Phone icon */
.up-phone-icon {
  display: flex;
  align-items: center;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  padding-left: 0.6rem;
  flex-shrink: 0;
}
/* Number input */
.up-phone-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-primary);
  padding: 0 0.75rem 0 0.4rem;
  height: 100%;
  box-sizing: border-box;
}
.up-phone-input::placeholder {
  color: var(--text-tertiary);
}
[data-theme="dark"] .up-phone-combined {
  border-color: var(--slate-600);
  background: var(--bg-secondary);
}
[data-theme="dark"] .up-phone-divider {
  background: var(--slate-600);
}
[data-theme="dark"] .up-phone-input {
  color: var(--text-primary);
}

/* ── Country Dropdown (portal — position:fixed set by JS) ─────────────────── */
/* Styles are mostly inline in HTML for reliability; dark mode override below */
[data-theme="dark"] #upCountryDropdown {
  background: var(--bg-secondary) !important;
  border-color: var(--brand-blue) !important;
}
[data-theme="dark"] #upCountryFilter {
  background: var(--bg-tertiary) !important;
  border-color: var(--slate-600) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] #upCountryList li {
  color: var(--text-primary);
}
[data-theme="dark"] #upCountryList li:hover {
  background: var(--bg-tertiary);
}
[data-theme="dark"] #upPhoneCodeDropdown {
  background: var(--bg-secondary) !important;
  border-color: var(--brand-blue) !important;
}
[data-theme="dark"] #upPhoneCodeFilter {
  background: var(--bg-tertiary) !important;
  border-color: var(--slate-600) !important;
  color: var(--text-primary) !important;
}
[data-theme="dark"] #upPhoneCodeList li {
  color: var(--text-primary);
}
[data-theme="dark"] #upPhoneCodeList li:hover {
  background: var(--bg-tertiary);
}

.up-country-search-wrap {
  position: relative;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--slate-200);
}
.up-country-search-icon {
  position: absolute;
  left: 1.3rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 0.78rem;
  pointer-events: none;
}
.up-country-filter {
  width: 100%;
  padding: 0.45rem 0.75rem 0.45rem 2rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-secondary);
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.18s;
}
.up-country-filter:focus { border-color: var(--brand-blue); }

.up-country-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  max-height: 210px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--slate-300) transparent;
}
.up-country-list::-webkit-scrollbar { width: 5px; }
.up-country-list::-webkit-scrollbar-track { background: transparent; }
.up-country-list::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 99px; }

.up-country-list li {
  padding: 0.48rem 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  transition: background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.up-country-list li:hover,
.up-country-list li.highlighted { background: var(--slate-50); }
.up-country-list li.selected {
  background: rgba(37,99,235,0.07);
  color: var(--brand-blue);
  font-weight: 600;
}
.up-country-list li .flag { font-size: 1.1rem; flex-shrink: 0; }
.up-country-list li .country-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.up-country-list li.no-results {
  color: var(--text-tertiary);
  cursor: default;
  justify-content: center;
  font-style: italic;
}
.up-country-list li.no-results:hover { background: transparent; }

/* Chevron rotation when open */
#upCountryChevron.rotated { transform: translateY(-50%) rotate(180deg); }

[data-theme="dark"] .up-country-dropdown {
  background: var(--bg-secondary);
  border-color: var(--brand-blue);
}
[data-theme="dark"] .up-country-filter {
  background: var(--bg-tertiary);
  border-color: var(--slate-600);
  color: var(--text-primary);
}
[data-theme="dark"] .up-country-list li:hover,
[data-theme="dark"] .up-country-list li.highlighted {
  background: var(--bg-tertiary);
}

.product-card {
  background: var(--bg-primary);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-soft);
}

.product-card:hover {
  box-shadow: 0 15px 35px rgba(2, 6, 23, 0.15);
  transform: translateY(-5px);
  border-color: var(--brand-blue);
}

.product-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg-tertiary);
}

.product-content {
  padding: var(--space-md);
}

.product-title {
  font-size: 0.938rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  font-size: 0.875rem;
}

.product-rating {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: #fbbf24;
}

.product-reviews {
  color: var(--text-tertiary);
}

.product-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-blue);
  margin-bottom: var(--space-md);
}

.product-actions {
  display: flex;
  gap: var(--space-sm);
}

/* Filters */
.filters-bar {
  background: var(--bg-primary);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-2xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-soft);
}

.filters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

/* ============ Date Range Dropdown ============ */
.date-range-picker-container {
  position: relative;
}

.date-range-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  min-width: 200px;
  z-index: 9999;
  overflow: hidden;
  /* Prevent any layout shifts */
  will-change: transform;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

.date-range-option {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}

.date-range-option:hover {
  background: rgba(102, 126, 234, 0.05);
}

.date-range-option:active {
  background: rgba(102, 126, 234, 0.1);
}

/* Selected option styling */
.date-range-option.selected {
  background: rgba(102, 126, 234, 0.1);
}

/* ============ Custom Range Styling ============ */
/* Divider before Custom Range */
.date-range-divider {
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--border-color) 20%, 
    var(--border-color) 80%, 
    transparent 100%);
  margin: 0.5rem 0;
}

/* Custom Range Option - Special Styling */
.custom-range-option {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #667eea;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  border-radius: 0.375rem;
  margin: 0.25rem;
  padding: 0.75rem 1rem !important;
  transition: background 0.15s ease, transform 0.15s ease;
}

.custom-range-option i:first-child {
  font-size: 1rem;
  color: #667eea;
}

.custom-range-option span {
  flex: 1;
}

.custom-range-option i:last-child {
  font-size: 0.75rem;
  color: #667eea;
  opacity: 0.6;
  transition: all 0.15s ease;
}

.custom-range-option:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.12) 100%);
  transform: translateX(2px);
}

.custom-range-option:hover i:last-child {
  opacity: 1;
  transform: translateX(3px);
}

/* Disable hover effects when modal is opening */
.custom-range-option.opening {
  pointer-events: none !important;
  transform: none !important;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%) !important;
}

/* ============ Custom Modal Styling (ULTRA STABLE v13.37.53) ============ */
.custom-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  padding: 1rem;
  display: none; /* Simple display toggle */
  align-items: center;
  justify-content: center;
}

.custom-modal.active {
  display: flex; /* No transitions, instant display */
  animation: modalFadeIn 0.12s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.custom-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  /* NO blur, NO transitions, NO transforms */
}

.custom-modal-content {
  position: relative;
  background: var(--bg-primary);
  border-radius: 1rem;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  z-index: 1;
  /* ZERO transforms, ZERO special properties */
}

/* Modal Header */
.custom-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.custom-modal-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  /* Prevent text jitter */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.custom-modal-title i {
  font-size: 1.5rem;
}

.custom-modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 0.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease;
  color: white;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.custom-modal-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.custom-modal-close:active {
  background: rgba(255, 255, 255, 0.25);
}

/* Modal Body */
.custom-modal-body {
  padding: 2rem;
}

.date-input-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.date-input-wrapper {
  flex: 1;
}

.date-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
}

.date-label i {
  color: #667eea;
}

.date-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 0.75rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  box-sizing: border-box;
}

.date-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: var(--bg-primary);
}

.date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.75rem;
  color: var(--text-tertiary);
}

.date-separator i {
  font-size: 1.25rem;
}

/* Modal Footer */
.custom-modal-footer {
  display: flex;
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.btn-modal {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, opacity 0.12s ease;
}

.btn-cancel {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
}

.btn-cancel:hover {
  background: var(--bg-secondary);
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.btn-cancel:active {
  opacity: 0.8;
}

.btn-apply {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-apply:hover {
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-apply:active {
  opacity: 0.9;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Responsive */
@media (max-width: 640px) {
  .date-input-group {
    flex-direction: column;
  }
  
  .date-separator {
    display: none; /* Hide instead of rotating */
    margin: 0;
  }
  
  .quick-range-buttons {
    grid-template-columns: 1fr;
  }
  
  .custom-modal-content {
    width: 95%;
    margin: 1rem;
  }
}

/* ============ Responsive Design ============ */
@media (max-width: 1024px) {
  .dashboard {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: var(--shadow-xl);
  }
  
  .sidebar.active {
    left: 0;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .content {
    padding: var(--space-lg);
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: var(--space-md);
  }
  
  .page-title {
    font-size: 1.125rem;
  }
  
  .search-box {
    display: none;
  }
  
  .topbar-actions {
    gap: var(--space-sm);
  }

  .topbar-credits-label {
    display: none;
  }

  .topbar-credits-badge {
    padding: 0.375rem 0.625rem;
    font-size: 0.8rem;
  }
  
  .content {
    padding: var(--space-md);
  }
  
  .content-title {
    font-size: 1.5rem;
  }
  
  .product-grid {
    grid-template-columns: 1fr;
  }
  
  .filters-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Product Finder Page  (.pf-*)
   ============================================================ */

/* ── Page Header ── */
.pf-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.pf-page-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.3rem;
}
.pf-title-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.pf-page-subtitle {
  font-size: 0.83rem;
  color: var(--text-tertiary);
  margin: 0;
}

/* API status badge */
.pf-api-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pf-api-badge--checking  { background: rgba(100,116,139,.1); border-color: rgba(100,116,139,.2); color: #64748b; }
.pf-api-badge--connected { background: rgba(16,185,129,.1);  border-color: rgba(16,185,129,.3); color: #059669; }
.pf-api-badge--demo      { background: rgba(245,158,11,.1);  border-color: rgba(245,158,11,.3); color: #b45309; }
.pf-api-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  animation: pfDotPulse 1.6s infinite;
}
@keyframes pfDotPulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ── Filters Card ── */
.pf-filters-card {
  background: var(--bg-primary);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-2xl);
  padding: 1.35rem 1.5rem 1.2rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-soft);
}
.pf-filters-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pf-filters-icon { color: #2563EB; }

.pf-filters-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}
@media (max-width: 1100px) { .pf-filters-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .pf-filters-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .pf-filters-grid { grid-template-columns: 1fr; } }

.pf-filter-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pf-select-wrap, .pf-input-wrap { position: relative; }
.pf-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-secondary);
  border: 1.5px solid var(--slate-200);
  border-radius: 0.55rem;
  padding: 0.55rem 2rem 0.55rem 0.75rem;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
}
.pf-select:focus { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.pf-select-arrow {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  color: var(--text-tertiary);
  pointer-events: none;
}
.pf-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1.5px solid var(--slate-200);
  border-radius: 0.55rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  box-sizing: border-box;
}
.pf-input:focus { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.pf-input::placeholder { color: var(--text-tertiary); }

/* Action buttons */
.pf-filters-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}
.pf-btn-search, .pf-btn-reset, .pf-btn-export {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.3rem;
  font-size: 0.83rem;
  font-weight: 700;
  border-radius: 0.6rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
}
.pf-btn-search {
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  color: #fff;
  box-shadow: 0 3px 12px rgba(37,99,235,.3);
}
.pf-btn-search:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 18px rgba(37,99,235,.38); }
.pf-btn-search:disabled { opacity: 0.65; cursor: not-allowed; }
.pf-btn-reset {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1.5px solid var(--slate-200);
}
.pf-btn-reset:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.pf-btn-export {
  background: rgba(16,185,129,.1);
  color: #059669;
  border: 1.5px solid rgba(16,185,129,.3);
}
.pf-btn-export:hover:not(:disabled) { background: rgba(16,185,129,.18); }
.pf-btn-export:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Results Stats Bar ── */
.pf-results-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--slate-200);
  border-radius: 0.65rem;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
}
.pf-stats-left { display: flex; align-items: center; gap: 0.5rem; }
.pf-stats-count { font-size: 1.05rem; font-weight: 800; color: #2563EB; }
.pf-stats-label { color: var(--text-secondary); font-weight: 500; }
.pf-stats-source {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
}
.pf-stats-source--real { background: rgba(16,185,129,.12); color: #059669; border: 1px solid rgba(16,185,129,.25); }
.pf-stats-source--demo { background: rgba(245,158,11,.12); color: #b45309; border: 1px solid rgba(245,158,11,.3); }
.pf-search-params { color: var(--text-tertiary); font-size: 0.75rem; }

/* ── Products Container ── */
.pf-products-container { min-height: 200px; }

/* ── Product Grid — 4 column responsive ── */
.pf-product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
}
@media (max-width: 1200px) { .pf-product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px)  { .pf-product-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .pf-product-grid { grid-template-columns: 1fr; } }

/* ── Product Card ── */
.pf-product-card {
  background: var(--bg-primary);
  border: 1px solid var(--slate-200);
  border-radius: 0.85rem;
  overflow: hidden;
  transition: all 0.22s ease;
  box-shadow: 0 1px 6px rgba(2,6,23,.06);
  display: flex;
  flex-direction: column;
  position: relative;
}
.pf-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(2,6,23,.13);
  border-color: rgba(37,99,235,.35);
}

/* Best seller ribbon */
.pf-card-ribbon {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 0.63rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(245,158,11,.4);
}

/* Image */
.pf-product-img-wrap {
  position: relative;
  height: 190px;
  overflow: hidden;
  background: #f8fafc;
  flex-shrink: 0;
}
.pf-product-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
  padding: 0.4rem;
  box-sizing: border-box;
}
.pf-product-card:hover .pf-product-img { transform: scale(1.04); }

/* Body */
.pf-card-body {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.4rem;
}

/* Title */
.pf-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-shrink: 0;
}

/* Rating row */
.pf-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  flex-shrink: 0;
}
.pf-card-stars {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  color: #f59e0b;
  font-size: 0.68rem;
}
.pf-card-rating-val {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.77rem;
}
.pf-card-reviews {
  color: var(--text-tertiary);
  font-size: 0.73rem;
}

/* Price */
.pf-card-price-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.pf-card-price {
  font-size: 1.1rem;
  font-weight: 800;
  color: #2563EB;
  line-height: 1;
}
.pf-card-discount {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(16,185,129,.12);
  color: #059669;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(16,185,129,.25);
}

/* ASIN chip */
.pf-card-asin {
  font-size: 0.67rem;
  color: var(--text-tertiary);
  font-family: monospace;
  flex-shrink: 0;
}

/* Spacer */
.pf-card-spacer { flex: 1; }

/* Actions */
.pf-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
  margin-top: 0.3rem;
}
.pf-card-btn-generate {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.48rem 0.5rem;
  background: linear-gradient(135deg, #2563EB, #7C3AED);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.pf-card-btn-generate:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.pf-card-btn-icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1.5px solid var(--slate-200);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
  flex-shrink: 0;
}
.pf-card-btn-icon:hover { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--slate-300); }
.pf-card-btn-icon.saved { color: #2563EB; border-color: rgba(37,99,235,.4); background: rgba(37,99,235,.07); }

/* ── Published state: Generate Article button turns green ── */
.pf-card-btn-generate.published {
  background: linear-gradient(135deg, #16a34a, #15803d);
  cursor: default;
  pointer-events: none;
  opacity: 0.92;
}
.pf-card-btn-generate.published:hover { transform: none; box-shadow: none; }

/* ── Empty State ── */
.pf-empty-state {
  text-align: center;
  padding: 4rem 2rem 3rem;
  max-width: 420px;
  margin: 0 auto;
}
.pf-empty-icon {
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(37,99,235,.1), rgba(124,58,237,.1));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  color: #2563EB;
  margin: 0 auto 1.25rem;
  box-shadow: 0 0 0 8px rgba(37,99,235,.05);
}
.pf-empty-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.5rem;
}
.pf-empty-desc {
  font-size: 0.83rem;
  color: var(--text-tertiary);
  line-height: 1.55;
  margin: 0 0 1.5rem;
}
.pf-empty-tips {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.pf-tip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--slate-200);
}

/* ── Loading skeleton grid ── */
.pf-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
}
@media (max-width: 1200px) { .pf-skeleton-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px)  { .pf-skeleton-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .pf-skeleton-grid { grid-template-columns: 1fr; } }

.pf-skeleton-card {
  border-radius: 0.85rem;
  overflow: hidden;
  background: var(--bg-primary);
  border: 1px solid var(--slate-200);
}
.pf-skel-img  { height: 190px; background: var(--bg-tertiary); animation: pfSkel 1.4s infinite; }
.pf-skel-body { padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.55rem; }
.pf-skel-line {
  height: 0.65rem;
  border-radius: 0.3rem;
  background: var(--bg-tertiary);
  animation: pfSkel 1.4s infinite;
}
@keyframes pfSkel {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* ── Error state ── */
.pf-error-state {
  text-align: center;
  padding: 3rem 2rem;
}
.pf-error-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: rgba(239,68,68,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #dc2626;
  margin: 0 auto 1rem;
}
.pf-error-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin: 0 0 0.4rem; }
.pf-error-desc  { font-size: 0.82rem; color: var(--text-tertiary); margin: 0 0 1.25rem; }

/* ============================================================
   Product Finder — Searchable Country Dropdown v2 (.pf-cdrop-*)
   Panel uses position:fixed anchored via JS → never clipped
   ============================================================ */

/* Trigger button — same look as .pf-select */
.pf-country-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-secondary);
  border: 1.5px solid var(--slate-200);
  border-radius: 0.55rem;
  padding: 0.52rem 0.75rem;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
}
.pf-country-trigger:hover,
.pf-country-trigger.cdrop-open {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* Fixed-position floating panel */
.pf-cdrop-panel {
  position: fixed;
  z-index: 99999;
  background: var(--bg-primary, #fff);
  border: 1.5px solid var(--slate-200, #e2e8f0);
  border-radius: 0.65rem;
  box-shadow: 0 10px 32px rgba(2,6,23,.16);
  overflow: hidden;
  min-width: 210px;
  /* animation */
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease;
  pointer-events: none;
}
.pf-cdrop-panel.cdrop-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Search box */
.pf-cdrop-search-wrap {
  position: relative;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--slate-200, #e2e8f0);
  background: var(--bg-secondary, #f8fafc);
}
.pf-cdrop-search-icon {
  position: absolute;
  left: 1.05rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: var(--text-tertiary, #94a3b8);
  pointer-events: none;
}
.pf-cdrop-search-input {
  width: 100%;
  background: var(--bg-primary, #fff);
  border: 1.5px solid var(--slate-200, #e2e8f0);
  border-radius: 0.45rem;
  padding: 0.4rem 0.7rem 0.4rem 1.8rem;
  font-size: 0.8rem;
  color: var(--text-primary, #0f172a);
  outline: none;
  box-sizing: border-box;
  transition: border-color .18s;
}
.pf-cdrop-search-input:focus { border-color: #2563EB; box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
.pf-cdrop-search-input::placeholder { color: var(--text-tertiary, #94a3b8); }

/* Options list */
.pf-cdrop-list {
  list-style: none;
  margin: 0;
  padding: 0.3rem 0;
  max-height: 200px;
  overflow-y: auto;
}
.pf-cdrop-list::-webkit-scrollbar { width: 4px; }
.pf-cdrop-list::-webkit-scrollbar-track { background: transparent; }
.pf-cdrop-list::-webkit-scrollbar-thumb { background: var(--slate-300, #cbd5e1); border-radius: 2px; }

/* Option items */
.pf-cdrop-opt {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.46rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary, #0f172a);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s;
}
.pf-cdrop-opt:hover   { background: rgba(37,99,235,.07); color: #2563EB; }
.pf-cdrop-sel         { background: rgba(37,99,235,.1);  color: #2563EB; font-weight: 700; }
.pf-cdrop-nores       { color: var(--text-tertiary,#94a3b8); font-style:italic; cursor:default; font-size:.78rem; }
.pf-cdrop-nores:hover { background: transparent; color: var(--text-tertiary,#94a3b8); }

/* Category group labels (section headers inside searchable category dropdown) */
.pf-cdrop-group-label {
  display: block;
  padding: 0.35rem 0.8rem 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-tertiary, #94a3b8);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
  border-top: 1px solid var(--slate-100, #f1f5f9);
  margin-top: 0.15rem;
}
.pf-cdrop-group-label:first-child {
  border-top: none;
  margin-top: 0;
}

/* ── Sub Category select — disabled / active states ───────── */
.pf-subcat-select:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  background: var(--bg-tertiary, #f1f5f9);
  color: var(--text-tertiary, #94a3b8);
}
#subCategoryGroup:not(.pf-subcat-active) .pf-select-arrow,
#d_subCategoryGroup:not(.pf-subcat-active) .pf-select-arrow {
  opacity: 0.4;
}

/* ── Best Seller ribbon variants ───────────────────────────── */
.pf-ribbon-bestseller {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
.pf-ribbon-choice {
  background: linear-gradient(135deg, #2563EB, #1d4ed8);
}
.pf-ribbon-published {
  background: linear-gradient(135deg, #16a34a, #15803d);
  box-shadow: 0 2px 8px rgba(22,163,74,.4);
}
.pf-ribbon-saved {
  background: linear-gradient(135deg, #2563EB, #1d4ed8);
  box-shadow: 0 2px 8px rgba(37,99,235,.4);
  top: 0.5rem;
  left: unset;
  right: 0.5rem;
}

/* ── Load More button ──────────────────────────────────────── */
.pf-loadmore-wrap {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0 0.5rem;
}
.pf-loadmore-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.72rem 2rem;
  background: var(--bg-primary, #fff);
  border: 2px solid var(--slate-200, #e2e8f0);
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  cursor: pointer;
  transition: background .16s, border-color .16s, box-shadow .16s, transform .15s;
  box-shadow: 0 2px 8px rgba(2,6,23,.07);
}
.pf-loadmore-btn:hover:not(:disabled) {
  background: rgba(37,99,235,.06);
  border-color: #2563EB;
  color: #2563EB;
  box-shadow: 0 4px 14px rgba(37,99,235,.15);
  transform: translateY(-1px);
}
.pf-loadmore-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}
.pf-loadmore-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary, #94a3b8);
  background: var(--bg-secondary, #f8fafc);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--slate-200, #e2e8f0);
}

/* ============================================================
   Product Finder — Price Range Filter  (.pf-price-*)
   ============================================================ */

/* Full-width row below the 4-column grid */
.pf-price-filter-row {
  margin-top: 1rem;
  padding: 0.9rem 1rem 0.85rem;
  background: var(--bg-secondary, #f8fafc);
  border: 1.5px solid var(--slate-200, #e2e8f0);
  border-radius: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

/* Header: label left, live price right */
.pf-price-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pf-price-display {
  font-size: 0.8rem;
  font-weight: 700;
  color: #2563EB;
  background: rgba(37,99,235,.09);
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  letter-spacing: .01em;
  white-space: nowrap;
}

/* Track wrapper — contains the fill bar + two overlapping range inputs */
.pf-range-track-wrap {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
}

/* Unfilled track background */
.pf-range-track-wrap::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  border-radius: 99px;
  background: var(--slate-200, #e2e8f0);
  z-index: 0;
}

/* Blue filled segment between the two thumbs */
.pf-range-fill {
  position: absolute;
  height: 4px;
  background: linear-gradient(90deg, #2563EB, #7C3AED);
  border-radius: 99px;
  z-index: 1;
  pointer-events: none;
}

/* Both range inputs — stacked, fully transparent except thumb */
.pf-range-input {
  position: absolute;
  left: 0; right: 0;
  width: 100%;
  height: 4px;
  background: transparent;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none;
  z-index: 2;
}

/* Thumb — WebKit */
.pf-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid #2563EB;
  box-shadow: 0 2px 6px rgba(37,99,235,.25);
  cursor: pointer;
  pointer-events: all;
  transition: transform .15s, box-shadow .15s;
}
.pf-range-input::-webkit-slider-thumb:hover,
.pf-range-input::-webkit-slider-thumb:active {
  transform: scale(1.18);
  box-shadow: 0 3px 10px rgba(37,99,235,.35);
}

/* Thumb — Firefox */
.pf-range-input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid #2563EB;
  box-shadow: 0 2px 6px rgba(37,99,235,.25);
  cursor: pointer;
  pointer-events: all;
}

/* Min / max edge labels */
.pf-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-tertiary, #94a3b8);
  margin-top: -0.1rem;
}

/* Quick preset chips */
.pf-price-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.1rem;
}
.pf-price-preset {
  padding: 0.22rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary, #475569);
  background: var(--bg-primary, #fff);
  border: 1.5px solid var(--slate-200, #e2e8f0);
  border-radius: 999px;
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
  white-space: nowrap;
}
.pf-price-preset:hover {
  background: rgba(37,99,235,.08);
  color: #2563EB;
  border-color: rgba(37,99,235,.35);
}
.pf-price-preset.active {
  background: rgba(37,99,235,.12);
  color: #2563EB;
  border-color: #2563EB;
  font-weight: 700;
}

/* ── Sidebar overlay (mobile) ─────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.sidebar-overlay.active {
  display: block;
}
