@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Barlow+Condensed:wght@600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange: #E8580A;
  --orange-light: #FFF3EC;
  --orange-dark: #B8400A;
  --steel: #1C2B3A;
  --steel-mid: #2E4157;
  --steel-light: #4A6480;
  --concrete: #8B8F96;
  --concrete-light: #D8DBE0;
  --concrete-lighter: #F2F3F5;
  --green: #2A7A3B;
  --red: #C0392B;
  --border: #D0D5DC;
  --text: #1C2B3A;
  --text-muted: #5A6878;
  --font: 'Barlow', 'Segoe UI', Arial, sans-serif;
  --font-cond: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body { font-family: var(--font); background: var(--concrete-lighter); color: var(--text); font-size: 14px; line-height: 1.5; }

/* HEADER */
#site-header { background: var(--steel) url("/assets/img/header-banner.png") left center/auto 100% no-repeat; border-bottom: 3px solid var(--orange); padding: 0 20px; display: flex; align-items: center; justify-content: space-between; height: 150px; position: sticky; top: 0; z-index: 100; }
.logo { font-family: var(--font-cond); font-size: 26px; font-weight: 700; color: white; cursor: pointer; letter-spacing: 0.5px; }
.logo span { color: var(--orange); }
.header-nav { display: flex; gap: 10px; align-items: center; }
#city-banner { background: var(--steel-mid); padding: 8px 20px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--concrete-light); }
.city-name { font-family: var(--font-cond); font-size: 16px; font-weight: 700; color: #F5C518; }

/* BUTTONS */
.btn { display: inline-block; padding: 10px 20px; border-radius: var(--radius); font-family: var(--font); font-size: 15px; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; text-decoration: none; }
.btn-primary { background: var(--orange); color: white; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-outline { background: transparent; color: var(--concrete-light); border: 1px solid var(--steel-light); }
.btn-outline:hover { background: var(--steel-mid); color: white; }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-danger { background: var(--red); color: white; }
.btn-steel { background: var(--steel-mid); color: white; }

/* LAYOUT */
.main-layout { display: grid; grid-template-columns: 1fr 220px; gap: 16px; max-width: 1200px; margin: 16px auto; padding: 0 16px; }
.content-area { min-width: 0; }

/* SEARCH */
.search-bar { display: flex; gap: 8px; background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; box-shadow: var(--shadow); }
.search-bar input, .search-bar select { border: 1px solid var(--border); border-radius: 4px; padding: 8px 12px; font-size: 14px; font-family: var(--font); }
.search-bar input { flex: 1; }
.search-bar input:focus, .search-bar select:focus { outline: none; border-color: var(--orange); }

/* CATEGORY GRID */
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.category-section { background: white; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cat-header { background: var(--steel); padding: 10px 14px; display: flex; align-items: center; gap: 8px; }
.cat-icon { font-size: 18px; }
.cat-title { font-family: var(--font-cond); font-size: 16px; font-weight: 700; color: white; }
.cat-body { padding: 10px 14px; }
.sub-cat-link { display: block; padding: 5px 0; color: var(--orange); text-decoration: none; font-size: 13px; border-bottom: 1px solid var(--concrete-lighter); transition: color 0.1s; }
.sub-cat-link:hover { color: var(--orange-dark); text-decoration: underline; }
.sub-cat-link:last-child { border-bottom: none; }
.sub-cat-count { float: right; background: var(--concrete-lighter); color: var(--text-muted); font-size: 11px; padding: 1px 6px; border-radius: 10px; }

/* SIDEBAR */
.sidebar-box { background: white; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 14px; }
.sb-header { background: var(--orange); padding: 8px 12px; font-family: var(--font-cond); font-size: 15px; font-weight: 700; color: white; }
.sb-body { padding: 10px; }
.city-link { display: block; padding: 5px 8px; color: var(--orange); font-size: 13px; text-decoration: none; border-radius: 4px; transition: background 0.1s; }
.city-link:hover { background: var(--orange-light); }
.city-link.active { background: var(--orange); color: white; font-weight: 600; }

/* POST AD BANNER */
.post-ad-banner { background: linear-gradient(135deg, var(--orange), var(--orange-dark)); border-radius: var(--radius); padding: 16px; color: white; margin-bottom: 14px; text-align: center; }
.post-ad-banner h3 { font-family: var(--font-cond); font-size: 18px; margin-bottom: 6px; }
.post-ad-banner p { font-size: 12px; opacity: 0.9; margin-bottom: 10px; }

/* LISTINGS */
.page-header { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.page-title { font-family: var(--font-cond); font-size: 22px; font-weight: 700; color: var(--steel); }
.breadcrumb { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.breadcrumb a { color: var(--orange); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.listing-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 8px; box-shadow: var(--shadow); transition: border-color 0.15s, transform 0.1s; }
.listing-card:hover { border-color: var(--orange); transform: translateY(-1px); }
.listing-card a { text-decoration: none; display: block; }
.listing-title { font-size: 15px; font-weight: 600; color: var(--orange); margin-bottom: 4px; }
.listing-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.listing-price { font-weight: 700; color: var(--green); font-size: 15px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 600; }
.tag-job { background: #EBF5FB; color: #1A5276; }
.tag-equip { background: #FEF9E7; color: #7D6608; }
.tag-mat { background: #EAFAF1; color: #1E8449; }
.tag-proj { background: #F4ECF7; color: #7D3C98; }
.tag-serv { background: #FDEDEC; color: #922B21; }
.tag-real { background: #EBF5FB; color: #154360; }

/* DETAIL */
.detail-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.detail-title { font-size: 22px; font-weight: 700; color: var(--steel); margin-bottom: 8px; }
.detail-price { font-size: 26px; font-weight: 700; color: var(--green); margin-bottom: 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; padding: 14px; background: var(--concrete-lighter); border-radius: var(--radius); }
.detail-field label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; display: block; }
.detail-field span { font-size: 14px; color: var(--text); }
.divider { height: 1px; background: var(--concrete-lighter); margin: 12px 0; }

/* FORMS */
.form-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); max-width: 600px; margin: 20px auto; }
.form-card h2 { font-family: var(--font-cond); font-size: 22px; margin-bottom: 20px; color: var(--steel); }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--font); font-size: 14px; color: var(--text); background: white; transition: border-color 0.15s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232,88,10,0.1); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #FDEDEC; border: 1px solid #F5B7B1; color: var(--red); }
.alert-success { background: #EAFAF1; border: 1px solid #A9DFBF; color: var(--green); }

/* TOAST */
#toast { position: fixed; bottom: 24px; right: 24px; background: var(--green); color: white; padding: 12px 20px; border-radius: var(--radius); font-weight: 600; font-size: 14px; z-index: 999; opacity: 0; transform: translateY(10px); transition: all 0.3s; pointer-events: none; }
#toast.show { opacity: 1; transform: translateY(0); }

/* ══════════════════════════════════════════
   TABLET (max 1024px)
══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .main-layout { grid-template-columns: 1fr 200px; gap: 12px; }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* ══════════════════════════════════════════
   MOBILE (max 768px)
══════════════════════════════════════════ */
@media (max-width: 768px) {

  /* HEADER */
  #site-header { height: auto; min-height: 100px; padding: 8px 14px; flex-wrap: wrap; gap: 8px; position: sticky; top: 0; z-index: 100; }
  #site-header img { height: 80px !important; }
  #nav-toggle { display: flex !important; }
  .header-nav { display: none; width: 100%; flex-direction: column; gap: 6px; padding: 10px 0; border-top: 1px solid rgba(255,255,255,0.15); }
  .header-nav.open { display: flex; }
  .header-nav .btn { width: 100%; text-align: center; }
  .btn-sm { padding: 10px 16px; font-size: 14px; }

  /* CITY BANNER */
  #city-banner { flex-wrap: wrap; gap: 6px; padding: 8px 14px; font-size: 12px; }
  #city-banner a { margin-left: 0 !important; }

  /* LAYOUT — stack sidebar below content */
  .main-layout { grid-template-columns: 1fr; gap: 12px; margin: 10px auto; padding: 0 10px; }
  .main-layout aside { order: 2; }
  .main-layout .content-area { order: 1; }

  /* SEARCH BAR */
  .search-bar { flex-direction: column; gap: 8px; padding: 10px; }
  .search-bar input,
  .search-bar select,
  .search-bar button { width: 100%; }

  /* CATEGORY GRID — single column on mobile */
  .home-grid { grid-template-columns: 1fr; gap: 10px; }

  /* LISTING CARDS */
  .listing-card { padding: 12px; }
  .listing-meta { gap: 8px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* DETAIL PAGE */
  .detail-grid { grid-template-columns: 1fr; }
  .detail-title { font-size: 18px; }
  .detail-price { font-size: 22px; }

  /* FORMS */
  .form-card { padding: 16px; margin: 10px; }
  .form-row { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; text-align: center; }

  /* BUTTONS — make tappable */
  .btn { padding: 10px 16px; font-size: 14px; }

  /* SIDEBAR — horizontal scroll on mobile */
  .sidebar-box { margin-bottom: 10px; }

  /* TOAST */
  #toast { bottom: 12px; right: 12px; left: 12px; text-align: center; }

  /* CHECKOUT */
  .checkout-wrap { grid-template-columns: 1fr !important; padding: 0 10px; }

  /* BLOG GRID */
  .blog-grid { grid-template-columns: 1fr !important; }

  /* HIDE register button on very small screens, keep sign in */
  .header-register-hide { display: none; }
}

/* ══════════════════════════════════════════
   SMALL MOBILE (max 480px)
══════════════════════════════════════════ */
@media (max-width: 480px) {
  #site-header img { height: 42px !important; }
  .header-nav .btn-outline:not(:last-child):not(:nth-last-child(2)) { display: none; }
  body { font-size: 13px; }
  .cat-title { font-size: 14px; }
  .sub-cat-link { font-size: 12px; padding: 6px 0; }
  .detail-card { padding: 14px; }
  .form-card { margin: 6px; padding: 14px; }
  #city-banner { font-size: 11px; }
  .city-name { font-size: 14px !important; }
}

