/* ===== Desktop Large ===== */
@media only screen and (max-width: 1440px) {
  .scroll_container {
    max-height: 610px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
  }

  .scroll_container::-webkit-scrollbar {
    width: 5px;
  }

  .scroll_container::-webkit-scrollbar-track {
    background: #f1f1f1;
  }

  .scroll_container::-webkit-scrollbar-thumb {
    background: #3887be;
  }

  .container {
    max-width: 1700px;
  }
}

/* ===== Tablet / Small Desktop ===== */
@media only screen and (max-width: 1024px) {
  #map {
    width: calc(100% - 280px) !important;
  }

  #menu {
    width: 260px !important;
    padding: 15px !important;
  }

  #menu.active {
    right: -320px !important;
  }

  .heading {
    font-size: 14px;
  }

  .frame-selector {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ===== Mobile / Tablet Portrait ===== */
@media only screen and (max-width: 768px) {

  /* Map takes full width, fixed at top */
  #map {
    width: 100% !important;
    height: 45vh !important;
    min-height: 300px;
    position: fixed !important;
    top: 0;
    left: 0;
    z-index: 1;
  }

  /* Sidebar becomes a bottom drawer */
  #menu {
    position: fixed !important;
    width: 100% !important;
    height: 55vh !important;
    bottom: 0 !important;
    top: auto !important;
    right: 0 !important;
    left: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 10px 15px 20px 15px !important;
    overflow-y: auto !important;
    z-index: 9999 !important;
    transition: bottom 0.3s ease !important;
  }

  /* When sidebar is hidden, push off-screen */
  #menu.active {
    bottom: -60vh !important;
    right: 0 !important;
    transition: bottom 0.3s ease !important;
  }

  /* Toggle button floats above the bottom drawer */
  .toggle_menu {
    position: fixed !important;
    top: auto !important;
    bottom: 56vh !important;
    right: 15px !important;
    z-index: 99999 !important;
    background: #000 !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
  }

  /* Scroll container fills the drawer */
  .scroll_container {
    max-height: calc(55vh - 30px) !important;
    padding: 5px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  /* Smaller controls */
  button#zoom-in,
  button#zoom-out {
    font-size: 12px !important;
    padding: 10px 12px !important;
  }

  .toggle_btn_1 {
    padding: 10px 14px !important;
    font-size: 12px !important;
  }

  #fly,
  #add-title,
  #preview-button {
    font-size: 13px !important;
    height: 40px !important;
  }

  .heading {
    font-size: 13px !important;
    padding-bottom: 6px !important;
  }

  .hi_box {
    padding: 8px !important;
    margin-bottom: 6px !important;
  }

  /* Frame selector */
  .frame-selector {
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 6px !important;
  }

  .frame-option {
    padding: 6px 3px !important;
    font-size: 9px !important;
    min-height: 60px !important;
  }

  .frame-thumb {
    width: 40px !important;
    height: 30px !important;
  }

  .frame-thumb-inner {
    width: 22px !important;
    height: 14px !important;
  }

  /* Embellishments */
  .embellishment-grid {
    gap: 6px !important;
  }

  .embellishment-btn {
    padding: 8px 4px !important;
    font-size: 10px !important;
  }

  .embellishment-btn i {
    font-size: 16px !important;
  }

  /* Input fields */
  #location-input {
    max-width: 100% !important;
    font-size: 13px !important;
  }

  input#width-inches,
  input#height-inches {
    width: 45% !important;
    font-size: 13px !important;
  }

  #latitude,
  #longitude {
    width: 45% !important;
    font-size: 12px !important;
  }

  /* Price modal */
  .price-modal {
    padding: 25px 20px !important;
    max-width: 95% !important;
  }

  /* Top dashboard button */
  .top_db_btn {
    left: 10px !important;
    top: 10px !important;
  }

  .top_db_btn a {
    font-size: 12px !important;
    padding: 6px 12px !important;
  }

  /* Save button */
  .save-map-btn {
    font-size: 14px !important;
    padding: 12px !important;
  }

  /* Mapbox controls */
  .mapboxgl-ctrl-top-right {
    right: 5px !important;
    bottom: 56vh !important;
    top: auto !important;
  }
}

/* ===== Small Phone ===== */
@media only screen and (max-width: 480px) {
  #map {
    height: 40vh !important;
    min-height: 250px;
  }

  #menu {
    height: 60vh !important;
  }

  .toggle_menu {
    bottom: 61vh !important;
  }

  .scroll_container {
    max-height: calc(60vh - 30px) !important;
  }

  .heading {
    font-size: 12px !important;
  }

  .frame-selector {
    grid-template-columns: 1fr 1fr !important;
  }

  input#width-inches,
  input#height-inches {
    width: 44% !important;
    font-size: 12px !important;
    height: 38px !important;
  }

  #latitude,
  #longitude {
    width: 44% !important;
    font-size: 11px !important;
    height: 38px !important;
  }

  .price-modal h2 {
    font-size: 18px !important;
  }

  .pm-btn {
    padding: 12px 16px !important;
    font-size: 13px !important;
  }

  .mapboxgl-ctrl-top-right {
    bottom: 61vh !important;
  }
}

/* ===== Very Small Phone ===== */
@media only screen and (max-width: 360px) {
  #map {
    height: 35vh !important;
    min-height: 220px;
  }

  #menu {
    height: 65vh !important;
  }

  .toggle_menu {
    bottom: 66vh !important;
  }

  .scroll_container {
    max-height: calc(65vh - 30px) !important;
  }
}