/* ============================================
   BakenBooks — Mobile Responsive Styles
   Подключается после bakenbooks.css
   ============================================ */

/* --- Base styles (hidden by default) --- */

.mobile-nav-toggle {
  display: none;
  background: none;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  margin: 10px 0;
}

.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 0;
  background: #f9f9f7;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}

.mobile-nav.open {
  display: flex;
}

.mobile-nav a {
  padding: 12px 20px;
  color: #333;
  text-decoration: none;
  font-size: 16px;
  border-bottom: 1px solid #eee;
}

.mobile-nav a:last-child {
  border-bottom: none;
}

.mobile-nav a:hover {
  background: #eee;
}


/* ============================================
   @media (max-width: 979px) — Tablets
   Bootstrap 2 container = 940px
   ============================================ */

@media (max-width: 979px) {

  .container {
    width: auto !important;
    padding: 0 15px;
  }

  .row {
    margin-left: 0;
  }

  .span12 {
    width: auto;
    float: none;
  }

  /* Header */
  .site-header {
    height: auto !important;
    background-size: cover;
    background-position: center top;
  }

  .site-header-logo {
    float: none !important;
    width: auto !important;
    text-align: center;
  }

  .site-header-logo a {
    height: 80px !important;
    max-width: 230px;
    margin: 0 auto;
  }

  .site-header-nav {
    float: none !important;
    width: auto !important;
    text-align: center;
    padding: 10px 0 !important;
    font-size: 14px;
  }

  /* Menu buttons — smaller */
  .menu_new,
  .menu_catalog,
  .menu_delivery,
  .menu_order,
  .menu_baken {
    width: 110px;
    height: 35px;
    background-size: contain;
  }

  /* Catalog grid — 3 columns */
  .thumbnails {
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
  }

  .thumbnails > li.span2 {
    width: 30%;
    margin-left: 2%;
    float: none;
  }

  /* Book description on "new books" pages */
  .book_recent_description {
    float: none;
    width: 100%;
  }

  /* Age confirmation modal */
  .age-wrap {
    width: 90% !important;
    left: 5% !important;
    margin-left: 0 !important;
  }

  /* Catalog filters */
  .catalog-filters {
    flex-wrap: wrap;
  }

  .price-filter {
    flex-basis: 100%;
    justify-content: flex-start;
  }

  /* Footer */
  .site-footer {
    text-align: center;
  }
}


/* ============================================
   @media (max-width: 767px) — Mobile (landscape)
   ============================================ */

@media (max-width: 767px) {

  /* Nav buttons — scale down to fit mobile */
  .desktop-nav {
    text-align: center;
  }

  .desktop-nav .menu_new,
  .desktop-nav .menu_catalog,
  .desktop-nav .menu_delivery,
  .desktop-nav .menu_order,
  .desktop-nav .menu_baken {
    width: 18vw;
    height: 30px;
    background-size: contain;
    margin: 0 1px;
  }

  /* Header */
  .site-header {
    position: relative;
    min-height: auto !important;
    padding: 10px 0;
  }

  /* Logo — visible, takes up space for background image */
  .site-header-logo {
    height: 100px;
  }

  .site-header-logo a {
    height: 100px !important;
  }

  /* Nav text — below the logo */
  .site-header-nav {
    font-size: 13px;
    padding-top: 5px !important;
  }

  /* Telegram auth — push down a bit */
  .site-header-nav > div:last-of-type {
    margin-top: 10px !important;
  }

  /* Social icons + hamburger — overlay top-right of logo */
  .social-icons {
    position: absolute;
    top: 10px;
    right: 60px;
    margin-bottom: 0 !important;
    z-index: 10;
  }

  .mobile-nav-toggle {
    display: none;
  }

  /* Catalog grid — 2 columns */
  .thumbnails > li.span2 {
    width: 47%;
    margin-left: 2%;
  }

  /* Remove fixed height on author area */
  .book-card-authors {
    height: auto !important;
  }

  /* Book preview image */
  .book_div_img_previw {
    height: 160px;
    overflow: hidden;
  }

  .book_img_previw {
    object-fit: contain;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
  }

  /* Pagination — smaller */
  .pagination li a,
  .pagination li span {
    padding: 6px 0;
    font-size: 13px;
  }

  /* Footer */
  .site-footer {
    text-align: center;
  }

  .site-footer .alpha_link {
    display: block;
    margin-bottom: 8px;
  }

  .site-footer span {
    display: block;
    margin-left: 0 !important;
  }

  /* Search form */
  .search-form input[type="text"] {
    width: 100%;
    min-width: 0;
  }

  .catalog-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .stock-filter {
    margin-top: 0;
  }

  .price-filter {
    justify-content: flex-start;
  }

  .price-filter .price-label,
  .price-filter .price-sep,
  .price-filter button {
    margin-top: 0;
  }

  /* Telegram auth widget */
  .telegram-login-btn {
    font-size: 12px;
    padding: 5px 10px;
  }
}


/* ============================================
   @media (max-width: 480px) — Mobile (portrait)
   ============================================ */

@media (max-width: 480px) {

  /* Header — fit logo by width */
  .site-header {
    background-size: 100% auto !important;
    background-position: left top !important;
    background-repeat: no-repeat !important;
    background-color: transparent;
    padding: 10px 0;
  }

  .site-header-logo a {
    height: 50px !important;
  }

  /* Catalog grid — 1 column, horizontal cards */
  .thumbnails > li.span2 {
    width: 100%;
    margin-left: 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
  }

  .thumbnails > li.span2 > a {
    flex-shrink: 0;
  }

  .book_div_img_previw {
    width: 90px;
    height: 135px;
    flex-shrink: 0;
    overflow: hidden;
  }

  .book_div_img_previw .book_img_previw {
    max-width: 90px;
  }

  .book-card-authors {
    height: auto !important;
  }

  /* Age modal */
  .age-wrap {
    width: 95% !important;
    left: 2.5% !important;
    margin-left: 0 !important;
  }

  /* Category tags — wrap normally */
  .category-tags {
    white-space: normal;
    line-height: 2;
  }

  /* Price filter inputs */
  .price-filter input[type="number"] {
    width: 60px;
  }
}
