/* =======================================================
   JamiaBricks — Responsive Breakpoints
   All base styles are in layout.css
   ======================================================= */

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

/* ---------- Ensure full bleed ---------- */
html, body { margin: 0; padding: 0; overflow-x: hidden; }
#wrap { width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; }

/* ---------- Hamburger (hidden on desktop) ---------- */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #94a3b8;
  border-radius: 2px;
  transition: .2s;
}

/* ---------- Remove old nav wrapper background ---------- */
div[style*="background-color:#C0C0C0"],
div[style*="background-color: #C0C0C0"] {
  background: transparent !important;
  padding: 0 !important;
}

/* =======================================================
   MODAL
   ======================================================= */
@media (max-width: 575px) {
  .modal-box {
    max-width: 100% !important;
    max-height: 95vh !important;
    border-radius: 10px 10px 0 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
  }
  .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
  .modal-actions { flex-direction: column !important; }
}

/* =======================================================
   DESKTOP ≥ 576px — force search form 2-fields-per-row
   ======================================================= */
@media (min-width: 576px) {
  .search_form               { display: table !important; width: 100% !important; table-layout: auto !important; border-collapse: collapse !important; }
  .search_form tbody         { display: table-row-group !important; }
  .search_form tr            { display: table-row !important; }
  .search_form td            { display: table-cell !important; width: auto !important; vertical-align: middle !important; padding: 8px 10px !important; }
  .search_form td.test,
  .search_form td.label      { width: 120px !important; white-space: nowrap !important; }
  .search_form select,
  .search_form input[type="text"],
  .search_form input[type="number"] { width: 100% !important; box-sizing: border-box; }
}

/* =======================================================
   TABLET  ≤ 900px
   ======================================================= */
@media (max-width: 900px) {
  #home_main, #main {
    flex: 0 0 100% !important;
    width: 100% !important;
    padding: 14px 16px !important;
  }
  #home_sidebar, #sidebar {
    flex: 0 0 100% !important;
    width: 100% !important;
    border-left: none !important;
    border-top: 1px solid #e2e8f0;
  }
  #topbar { padding: 0 14px !important; }
  #header { flex-wrap: wrap !important; min-height: auto !important; }
  #sitename  { padding: 8px 12px !important; }
  #shoutout  { padding: 8px 10px !important; }
  #useractions { flex: 1 1 260px !important; padding: 8px 14px !important; }
  #headings { gap: 4px 12px !important; }
  #loginform { flex-wrap: wrap !important; gap: 8px !important; }
  .formblock .textfields { width: 130px !important; }
  .listing .listinfo { width: 100% !important; }
  .listingbtns { float: none !important; width: 100% !important; display: flex; gap: 6px; margin-top: 8px; }
  .listingbtns .listbuttons { width: auto !important; flex: 1; }

  /* New listing card responsive */
  .listing-card { flex-direction: column !important; }
  .listing-actions { flex: 0 0 auto !important; width: 100% !important; flex-direction: row !important; border-left: none !important; border-top: 1px solid #e2e8f0; padding: 10px 12px !important; }
  .btn-action { flex: 1; }
  .listing-thumb { width: 80px !important; height: 80px !important; }
  #topcategorieslink { margin: 12px 0 0 !important; }
}

/* =======================================================
   MOBILE  ≤ 575px
   ======================================================= */
@media (max-width: 575px) {

  /* ---- Hide desktop-only elements ---- */
  #topbar    { display: none !important; }
  #header    { display: none !important; }   /* desktop login/logo header hidden */
  #shoutout  { display: none !important; }

  /* ---- Mobile top bar ---- */
  #mobile-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    background: #0f172a;
    padding: 0 14px;
    height: 48px;
    position: sticky;
    top: 0;
    z-index: 800;
  }
  .mob-brand {
    font-family: var(--font);
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
  }
  .mob-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .mob-btn {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
  }
  .mob-post-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fff;
    color: #1e293b;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
    text-decoration: none;
    white-space: nowrap;
  }
  .mob-free-badge {
    background: #f59e0b;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: .5px;
  }
  .hamburger { display: flex; }

  /* ---- Mobile login panel ---- */
  #mobile-login-panel {
    background: #1e293b;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
  }
  .mob-login-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
  }
  .mob-login-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,.2);
    background: rgba(255,255,255,.08);
    color: #fff;
    font-family: var(--font);
    font-size: 13px;
  }
  .mob-login-input::placeholder { color: rgba(255,255,255,.45); }
  .mob-login-btn {
    width: 100%;
    padding: 11px;
    background: #1565c0;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }
  .mob-login-links {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
  }
  .mob-login-links a { color: rgba(255,255,255,.6); text-decoration: none; }
  .mob-login-links a:hover { color: #fff; }

  /* ---- Main nav: hidden, expands on .open ---- */
  #nav-bar { display: none !important; }
  #nav-bar.open { display: block !important; }
  #menu {
    flex-direction: column !important;
    height: auto !important;
  }
  #menu > li {
    width: 100% !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;
  }
  #menu > li > a {
    display: block !important;
    width: 100% !important;
    padding: 13px 18px !important;
    font-size: 14px !important;
  }
  #menu li .dropdown_1column,
  #menu li .dropdown_2columns,
  #menu li .dropdown_3columns,
  #menu li .dropdown_4columns,
  #menu li .dropdown_5columns { display: none !important; }

  /* ---- Accordion: search + hot properties ---- */
  .acc-header {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
  }
  .acc-header h2 {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  .acc-arrow {
    font-size: 12px;
    margin-left: 8px;
    transition: transform .2s;
  }
  /* Content hidden on mobile until .acc-open */
  .acc-body {
    display: none !important;
    overflow: hidden;
  }
  .acc-body.acc-open {
    display: block !important;
  }

  /* ---- Content columns stack ---- */
  #content {
    flex-direction: column !important;
  }
  #home_main, #main {
    flex: 0 0 100% !important;
    width: 100% !important;
    padding: 0 !important;
  }
  #home_sidebar, #sidebar {
    flex: 0 0 100% !important;
    width: 100% !important;
    border-left: none !important;
    border-top: 2px solid #cbd5e1;
    margin-top: 0 !important;
  }

  /* ---- Search form stacks to 1 column on mobile ---- */
  .sf-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* ---- Categories ---- */
  #topcategorieslink { flex-direction: column; }
  #topcategorieslink h2 { width: 100% !important; }
  #topcategorieslink ul  { width: 100% !important; }

  /* ---- Listing cards (old + new) ---- */
  .listing-card { flex-direction: column !important; }
  .listing-left  { flex-direction: column !important; gap: 8px !important; }
  .listing-thumb { width: 100% !important; height: 160px !important; }
  .listing-actions {
    flex-direction: column !important;
    border-left: none !important;
    border-top: 1px solid #e2e8f0;
    padding: 10px 12px !important;
  }
  .btn-action { width: 100% !important; }

  /* ---- Search result cards ---- */
  .sr-card { flex-direction: column !important; }
  .sr-card-img { flex: 0 0 auto !important; width: 100% !important; height: 180px !important; }
  .sr-card-actions {
    flex: 0 0 auto !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    border-left: none !important;
    border-top: 1px solid var(--border) !important;
    padding: 10px 12px !important;
    gap: 6px !important;
  }
  .sr-card-actions .btn-action { flex: 1 1 auto !important; width: auto !important; }

  /* ---- Modals slide up from bottom ---- */
  .modal-box {
    max-width: 100% !important;
    max-height: 95vh !important;
    border-radius: 10px 10px 0 0 !important;
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    margin: 0 !important;
  }
  .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
  .modal-actions { flex-direction: column !important; }

  /* ---- Footer table ---- */
  div[style*="background-image"] table,
  div[style*="background-image"] table tr,
  div[style*="background-image"] table td {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
  }
}

  /* Search form stacks */
  .search_form,
  .search_form tbody,
  .search_form tr,
  .search_form td {
    display: block !important;
    width: 100% !important;
  }
  .search_form td.test { padding-top: 10px !important; padding-bottom: 2px !important; font-size: 12px; }

  /* Categories */
  #topcategorieslink { flex-direction: column; }
  #topcategorieslink h2 { width: 100% !important; }
  #topcategorieslink ul  { width: 100% !important; }

  /* Listing — legacy */
  .listinfo .listingimage { float: none !important; display: block; margin: 0 auto 10px; }
  .listing .listinfo { width: 100% !important; }
  .listingbtns { float: none !important; width: 100% !important; }

  /* Listing — new cards */
  .listing-left { flex-direction: column !important; gap: 8px !important; }
  .listing-thumb { width: 100% !important; height: 160px !important; }
  .listing-actions { flex-direction: column !important; padding: 10px 12px !important; }
  .btn-action { width: 100% !important; }

  /* Footer table */
  div[style*="background-image"] table,
  div[style*="background-image"] table tr,
  div[style*="background-image"] table td {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
  }
}
