/* ============================================================
   DESIGN SYSTEM — Dubuz Frontend (Pro Max UI)
   Brand: #FF4B33 | 8px Grid | Alibaba/Temu PWA Style
   Date: 2026-07-14
   ============================================================
   This is the SINGLE source of truth for frontend styling.
   Admin (#0a837f) is NOT affected.
   ============================================================ */

/* ---- FONTS (Google Fonts — Inter + Outfit) ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@700&display=swap');

/* ---- ROOT VARIABLES ---- */
:root {
  /* Primary Brand (Frontend ONLY — admin keeps #0a837f) */
  --primary: #FF4B33;
  --primary-hover: #e03a24;
  --primary-light: rgba(255, 75, 51, 0.12);
  --primary-text: #ffffff;

  /* Neutral Scale (90% of UI) */
  --page-bg: #f5f5f7;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --border-light: #f0f0f0;
  --placeholder: #d1d5db;
  --text-muted: #6b7280;
  --text-body: #374151;
  --text-heading: #111827;

  /* Functional Colors */
  --success: #22C55E;
  --error: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;

  /* State Colors */
  --hover-bg: #f5f5f7;
  --active-bg: rgba(255, 75, 51, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Font */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Outfit', 'Inter', sans-serif;

  /* Transition */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ---- TYPOGRAPHY ---- */
/* === H1-H6 Heading Hierarchy (element + class, frontend only) === */
h1, .h1 {
  font-family: var(--font-body);
  font-size: 1.875rem;  /* 30px — QuickAd H1 */
  font-weight: 700;
  line-height: 1.2;
  color: #111827;
}

h2, .h2 {
  font-family: var(--font-body);
  font-size: 1.625rem;  /* 26px — QuickAd H2 */
  font-weight: 700;
  line-height: 1.3;
  color: #111827;
}

h3, .h3 {
  font-family: var(--font-body);
  font-size: 1.25rem;   /* 20px — QuickAd H3 = headline-lg */
  font-weight: 700;
  line-height: 1.3;
  color: #111827;
}

h4, .h4 {
  font-family: var(--font-body);
  font-size: 1.125rem;  /* 18px — QuickAd H4 = headline-md */
  font-weight: 600;
  line-height: 1.35;
  color: #111827;
}

h5, .h5 {
  font-family: var(--font-body);
  font-size: 1rem;      /* 16px — QuickAd H5 = body-lg */
  font-weight: 600;
  line-height: 1.4;
  color: #374151;
}

h6, .h6 {
  font-family: var(--font-body);
  font-size: 0.875rem;  /* 14px — QuickAd H6 = body-md */
  font-weight: 600;
  line-height: 1.4;
  color: #374151;
}

/* === Body text scale (Inter) === */
:root {
  --body-lg: 1rem;          /* 16px — larger body text */
  --body-md: 0.875rem;      /* 14px — default body text = QuickAd default */
  --body-sm: 0.8125rem;     /* 13px — small body = QuickAd form-control */
  --label-sm: 0.75rem;      /* 12px — labels, badges */
  --label-xs: 0.6875rem;    /* 11px — tiny labels, timestamps */

  /* Section titles (QuickAd .heading-section .title) */
  --section-title-size: 0.875rem;  /* 14px */
  --section-title-weight: 600;
  --section-title-color: #111827;

  /* Price typography (QuickAd detail) */
  --price-size: 1rem;      /* 16px detail price */
  --price-weight: 700;
  --price-color: var(--primary);
}

/* === Body default === */
body {
  font-family: var(--font-body);
  background: #f5f5f7;
  font-size: 14px;
  color: #374151;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === Utility classes === */
.text-heading {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.25;
}
.text-body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-body);
  line-height: 1.5;
}
.text-muted {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.5;
}
.text-sm { font-size: 13px; }
.text-base { font-size: 15px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }
.text-2xl { font-size: 26px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ---- BACKGROUND UTILITIES ---- */
.bg-page { background-color: var(--page-bg); }
.bg-card { background-color: var(--card-bg); }
.bg-hover { background-color: var(--hover-bg); }
.bg-primary { background-color: var(--primary); }
.bg-primary-light { background-color: var(--primary-light); }
.bg-success { background-color: var(--success); }
.bg-error { background-color: var(--error); }
.bg-warning { background-color: var(--warning); }
.bg-info { background-color: var(--info); }

/* ---- BORDER UTILITIES ---- */
.border-default { border: 1px solid var(--border); }
.border-light { border: 1px solid var(--border-light); }
.border-primary { border: 1px solid var(--primary); }
.border-top { border-top: 1px solid var(--border); }
.border-bottom { border-bottom: 1px solid var(--border); }

/* ---- SHADOW UTILITIES ---- */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* ---- RADIUS UTILITIES ---- */
.radius-sm { border-radius: var(--radius-sm); }
.radius-md { border-radius: var(--radius-md); }
.radius-lg { border-radius: var(--radius-lg); }
.radius-xl { border-radius: var(--radius-xl); }
.radius-full { border-radius: var(--radius-full); }

/* ---- CARD SYSTEM ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.card-elevated {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
  border: none;
}
.card-flush {
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  border: none;
}
.card-header {
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 12px;
}
.card-body {
  padding: 0;
}
.card-footer {
  padding: 12px 0 0;
  border-top: 1px solid var(--border-light);
  margin-top: 12px;
}

/* ---- BUTTON SYSTEM ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Primary */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-text);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--primary-text);
}
.btn-primary:active {
  background: var(--primary-hover);
  transform: scale(0.98);
}

/* Secondary */
.btn-secondary {
  background: var(--hover-bg);
  border-color: var(--border);
  color: var(--text-body);
}
.btn-secondary:hover {
  background: var(--border);
  border-color: var(--border);
  color: var(--text-heading);
}
.btn-secondary:active {
  background: var(--border);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-body);
}
.btn-ghost:hover {
  background: var(--hover-bg);
  color: var(--text-heading);
}
.btn-ghost:active {
  background: var(--border);
}

/* Outline Primary */
.btn-outline-primary {
  background: transparent;
  border-color: var(--primary);
  color: var(--primary);
}
.btn-outline-primary:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.btn-outline-primary:active {
  background: var(--active-bg);
}

/* Danger */
.btn-danger {
  background: var(--error);
  border-color: var(--error);
  color: #ffffff;
}
.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

/* Success */
.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
}

/* Sizes */
.btn-sm {
  padding: 6px 16px;
  font-size: 13px;
  min-height: 34px;
  border-radius: var(--radius-sm);
}
.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
  min-height: 52px;
  border-radius: var(--radius-lg);
}
.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  min-width: 44px;
}
.btn-sm.btn-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
}
.btn-block {
  width: 100%;
}
.btn .fa-solid,
.btn .fa-regular,
.btn .fa-brands {
  font-size: 16px;
  flex-shrink: 0;
}

/* ---- MODAL SYSTEM ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: modalFadeIn var(--transition-slow) ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes modalScaleIn {
  from { transform: scale(0.92) translateY(12px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes modalSlideDown {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(100%); opacity: 0; }
}

/* Desktop: centered modal */
.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  max-width: 400px;
  width: calc(100% - 32px);
  max-height: 90vh;
  overflow-y: auto;
  animation: modalScaleIn var(--transition-slow) ease;
  position: relative;
}
.modal-content.modal-sm { max-width: 320px; }
.modal-content.modal-lg { max-width: 520px; }

/* Mobile: bottom sheet */
@media (max-width: 767px) {
  .modal-overlay {
    align-items: flex-end;
  }
  .modal-content {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
    animation: modalSlideUp var(--transition-slow) ease;
    max-height: 85vh;
  }
}

.modal-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto 16px;
  flex-shrink: 0;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--hover-bg);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.modal-close:hover {
  background: var(--border);
  color: var(--text-body);
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 24px;
}
.modal-icon.is-success { background: rgba(34, 197, 94, 0.12); color: var(--success); }
.modal-icon.is-error { background: rgba(239, 68, 68, 0.12); color: var(--error); }
.modal-icon.is-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.modal-icon.is-info { background: rgba(59, 130, 246, 0.12); color: var(--info); }

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-heading);
  text-align: center;
  margin-bottom: 8px;
  line-height: 1.3;
}

.modal-body {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-actions-row {
  flex-direction: row;
}
.modal-actions-row .btn {
  flex: 1;
}

/* ---- NOTIFICATION TOAST ---- */
.notification-toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  min-width: 280px;
  max-width: 400px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--border-light);
  animation: toastSlideIn var(--transition-slow) ease;
}
@media (max-width: 767px) {
  .notification-toast {
    top: auto;
    bottom: 80px;
    right: 12px;
    left: 12px;
    max-width: 100%;
    min-width: 0;
  }
}

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@media (max-width: 767px) {
  @keyframes toastSlideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
}

.notification-toast-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}
.notification-toast-icon.is-success { background: rgba(34, 197, 94, 0.12); color: var(--success); }
.notification-toast-icon.is-error { background: rgba(239, 68, 68, 0.12); color: var(--error); }
.notification-toast-icon.is-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.notification-toast-icon.is-info { background: rgba(59, 130, 246, 0.12); color: var(--info); }

.notification-toast-body {
  flex: 1;
  min-width: 0;
}
.notification-toast-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 2px;
  line-height: 1.3;
}
.notification-toast-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}
.notification-toast-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  font-size: 14px;
  transition: background var(--transition-fast);
}
.notification-toast-close:hover {
  background: var(--hover-bg);
}

/* ---- SPACING UTILITIES ---- */
/* 8px grid: 4, 8, 12, 16, 24, 32, 40, 48 */
.spacing-4 { padding: 4px; }
.spacing-8 { padding: 8px; }
.spacing-12 { padding: 12px; }
.spacing-16 { padding: 16px; }
.spacing-24 { padding: 24px; }
.spacing-32 { padding: 32px; }
.spacing-40 { padding: 40px; }
.spacing-48 { padding: 48px; }

/* Inline spacing */
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }

/* ---- FLEX / GRID HELPERS ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

/* ---- DISPLAY HELPERS ---- */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }
.w-full { width: 100%; }
.w-auto { width: auto; }

/* ---- TEXT ALIGN ---- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* ---- POSITION ---- */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* ---- OVERFLOW ---- */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* ---- CURSOR ---- */
.cursor-pointer { cursor: pointer; }
.pointer-events-none { pointer-events: none; }

/* ---- PWA CARD (Alibaba/Temu style) ---- */
.pwa-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  box-shadow: none;
  border: none;
}

/* ---- DIVIDER ---- */
.divider {
  height: 1px;
  background: var(--border-light);
  border: none;
  margin: 0;
}

/* ============================================================
   QUICKAD PWA PATTERNS — Detail Page & Section System
   Mobile-first | 8px grid | 20px horizontal padding
   Source: QuickAd mobile template (dubuz-mobile-html/quick-mob)
   ============================================================ */

/* ---- SECTION HEADERS (heading-section pattern) ---- */
.section-heading {
  padding: 0 20px;
  margin: 20px 0 10px;
}
.section-heading .section-title {
  color: #1e1e1e;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}

/* ---- SECTION CONTENT CARDS (ad-section pattern) ---- */
.section-card {
  background: var(--card-bg);
  margin-bottom: 10px;
}
.section-card-item {
  padding: 10px 20px;
}

/* 10px gap between adjacent content sections */
.section-gap {
  margin-bottom: 10px;
}

/* ---- DETAIL PAGE CAROUSEL — Fixed 200px height (QuickAd PWA) ---- */
.detail-carousel {
  position: relative;
  overflow: hidden;
  width: 100%;
}
.detail-carousel .carousel-inner {
  height: 200px;
  overflow: hidden;
}
.detail-carousel .carousel-inner img,
.detail-carousel .carousel-inner picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---- DETAIL CONTENT OVERLAP — overlaps carousel by 20px ---- */
.detail-overlap {
  margin-top: -20px;
  border-radius: 20px 20px 0 0;
  padding: 10px 20px;
  background-color: var(--card-bg);
  z-index: 2;
  position: relative;
}

/* ---- DETAIL PAGE TYPOGRAPHY (QuickAd PWA) ---- */
.detail-ad-title {
  font-size: 16px;
  color: #1e1e1e;
  font-weight: 500;
  line-height: 1.3;
}
.detail-ad-price {
  font-size: 16px;
  color: var(--primary);
  font-weight: 600;
}
.detail-ad-location {
  font-size: 12px;
  color: #535353;
  line-height: 1.4;
}

/* ---- DETAIL PAGE BODY — bottom nav clearance ---- */
.detail-page-body {
  padding: 0px 0px 50px;
}

/* ---- PWA BOTTOM NAV (safe area for notch phones) ---- */
.pwa-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card-bg);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-around;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.06);
}
.pwa-bottom-nav .nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition-fast);
}
.pwa-bottom-nav .nav-btn.active {
  color: var(--primary);
}
.pwa-bottom-nav .nav-btn i,
.pwa-bottom-nav .nav-btn .f7-icons {
  font-size: 22px;
  margin-bottom: 2px;
}

/* ---- NIGHT MODE OVERRIDES ---- */
.night-mode {
  --page-bg: #0f0f1a;
  --card-bg: #1a1a2e;
  --border: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.06);
  --hover-bg: rgba(255, 255, 255, 0.06);
  --text-heading: #f1f5f9;
  --text-body: #cbd5e1;
  --text-muted: #94a3b8;
  --placeholder: #475569;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ---- FOUC PREVENTION ---- */
[x-cloak] { display: none !important; }
