/* =================================================================
   HorseSales.ie — Mobile Responsive Patch
   Extends style.css — works from 320px upward
   ================================================================= */

/* ── 320px floor ──────────────────────────────────────────────── */
html { min-width: 320px; }
body { min-width: 320px; overflow-x: hidden; }
*, *::before, *::after { box-sizing: border-box; }
img, video, iframe { max-width: 100%; height: auto; }

/* ── Navbar hamburger (already in style.css, extended here) ────── */
@media (max-width: 768px) {
  .hamburger { display: flex; flex-direction: column; }
  .nav-links {
    display: none; flex-direction: column; align-items: stretch;
    position: absolute; top: 62px; left: 0; right: 0;
    background: #fff; box-shadow: 0 10px 24px rgba(0,0,0,.12);
    padding: 12px; gap: 4px; z-index: 999;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; border-radius: 9px; }
  .nav-links a.btn-nav { margin-left: 0; text-align: center; justify-content: center; }
}

/* ── Admin sidebar — mobile drawer ────────────────────────────── */
.admin-mobile-toggle {
  display: none;
  position: fixed; top: 12px; left: 12px; z-index: 600;
  background: var(--green-darker, #1f4a42); color: #fff;
  border: none; border-radius: 8px; padding: 10px 14px;
  font-size: 1.1rem; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  min-width: 44px; min-height: 44px;
}
.admin-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 540;
}
.admin-overlay.open { display: block; }

@media (max-width: 900px) {
  .admin-mobile-toggle { display: flex; align-items: center; justify-content: center; }
  .admin-main { padding-top: 60px; padding-left: clamp(12px, 4vw, 30px); padding-right: clamp(12px, 4vw, 30px); }
  .admin-sidebar {
    position: fixed; top: 0; left: 0; z-index: 550;
    height: 100vh; width: 240px;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .admin-sidebar.open { transform: translateX(0); display: flex; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 400px) {
  .stat-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card .val { font-size: 1.5rem; }
}

/* ── User sidebar — mobile drawer ─────────────────────────────── */
.user-nav-toggle {
  display: none;
  align-items: center; gap: 8px;
  background: var(--green-light, #e8f4f2);
  border: 1.5px solid var(--border, #e2e8e6);
  border-radius: 9px; padding: 10px 16px;
  font-size: .92rem; font-weight: 600; cursor: pointer;
  margin-bottom: 14px; width: 100%;
  min-height: 44px;
}
.user-sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.38); z-index: 499;
}
.user-sidebar-overlay.open { display: block; }

@media (max-width: 900px) {
  .user-layout { grid-template-columns: 1fr; }
  .user-nav-toggle { display: flex; }
  .user-sidebar {
    position: fixed; top: 0; left: 0; z-index: 500;
    height: 100vh; width: min(280px, 88vw);
    overflow-y: auto; border-radius: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    padding-top: 28px;
  }
  .user-sidebar.open { transform: translateX(0); }
}

/* ── Browse page filter bar ────────────────────────────────────── */
@media (max-width: 700px) {
  .filter-bar form {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 480px) {
  .filter-bar form {
    grid-template-columns: 1fr;
  }
}

/* ── Tables ────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 600px) {
  th, td { padding: 9px 10px; font-size: .82rem; }
  th { font-size: .8rem; }
}

/* ── Forms ─────────────────────────────────────────────────────── */
.form-control { min-height: 44px; }
.btn { min-height: 44px; }

@media (max-width: 560px) {
  .form-row { flex-direction: column; gap: 0; }
}

/* ── Cards ─────────────────────────────────────────────────────── */
@media (max-width: 400px) {
  .card { padding: 14px; }
  .card-header { padding-bottom: 12px; margin-bottom: 14px; }
}

/* ── Listing detail ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .horse-detail-grid { grid-template-columns: 1fr; }
  .listing-sidebar { position: static; }
}

/* ── Hero search ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .hero-search {
    flex-direction: column; background: transparent;
    box-shadow: none; padding: 0; gap: 8px;
    border-radius: 0;
  }
  .hero-search input {
    background: #fff; border-radius: 999px;
    padding: 13px 18px; box-shadow: 0 4px 18px rgba(31,74,66,.08);
  }
  .hero-search button { border-radius: 999px; width: 100%; }
}

/* ── OTP input styling ─────────────────────────────────────────── */
.otp-input {
  text-align: center; font-size: clamp(1.4rem, 6vw, 2rem);
  letter-spacing: clamp(4px, 2vw, 10px);
  font-weight: 700; padding: 14px !important;
}

/* ── Gender selector (complete-profile.php) ────────────────────── */
.gender-options { display: flex; gap: 10px; flex-wrap: wrap; }
.gender-option {
  flex: 1 1 120px; padding: 12px 10px; border: 2px solid var(--border, #e2e8e6);
  border-radius: 9px; text-align: center; cursor: pointer;
  font-weight: 600; font-size: .9rem; transition: all .15s;
  background: #fff; min-height: 44px; display: flex; align-items: center; justify-content: center;
}
.gender-option.selected,
.gender-option:has(input:checked) {
  border-color: var(--green, #3a7a6e);
  background: var(--green-light, #e8f4f2);
  color: var(--green-darker, #1f4a42);
}
@media (max-width: 380px) {
  .gender-option { flex: 1 1 100%; }
}

/* ── Footer ────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* ── 360px and below ───────────────────────────────────────────── */
@media (max-width: 360px) {
  html { font-size: 14px; }
  .btn { padding: 10px 14px; font-size: .85rem; }
  .hero h1 { font-size: 1.4rem; }
  .navbar-inner { padding-inline: 12px; }
  .container { padding-inline: 12px; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
}

/* ── 320px absolute minimum ────────────────────────────────────── */
@media (max-width: 320px) {
  html { font-size: 13px; }
  .stat-cards { grid-template-columns: 1fr; }
  .gender-options { flex-direction: column; }
}
