/* =============================================================================
  MEDIA.CSS (refactor)
  Goal: keep behavior, reduce contradictions, clearer intent.
============================================================================= */

/* Hide legacy responsive menu hooks (kept) */
#topnav_hamburger_icon,
#topnav_responsive_menu{
  display: none;
}

/* =============================================================================
  <= 1250px (container full width)
============================================================================= */
@media screen and (max-width: 1250px){
  .container{
    margin: 0;
  }

  /* Audio player: desktop layout (kept) */
  #audio div.player{
    display: block;
  }
  #audio div.player.mobile{
    display: none;
  }
}

/* =============================================================================
  <= 768px (title/subtitle adjustments)
============================================================================= */
@media only screen and (max-width: 768px){
  header .site-title .mobile{
    display: block;
  }
  header .site-subtitle{
    display: none;
  }
}

/* =============================================================================
  >= 650px (DESKTOP/TABLET)
  - classic (horizontal) nav visible
  - mobile nav hidden
============================================================================= */
@media screen and (min-width: 650px){
  /* Mobile nav hidden on desktop */
  #mobilenav{
    display: none;
  }

  /* Title desktop version visible, mobile title hidden */
  header .site-title{
    display: block;
  }
  header .site-title .mobile{
    display: none;
  }

  /* If you still have nav.topnav (legacy), keep it hidden */
  nav.topnav{
    display: none;
  }

  .search-container{
    width: 250px;
  }
  .search-container .search-input{
    opacity: 1;
  }

  /* Audio player: desktop layout */
  #audio div.player{
    display: block;
  }
  #audio div.player.mobile{
    display: none;
  }
}

/* =============================================================================
  < 650px (MOBILE)
  - classic nav hidden
  - mobile nav enabled + slide drawer
============================================================================= */
@media screen and (max-width: 650px){
  /* Admin tables: compact */
  #admin_user table{
    font-size: 0.8rem;
  }
  #admin_user th:not(.mobile),
  #admin_user td:not(.mobile){
    display: none;
  }

  nav{
    justify-content: center !important;
  }

  form.product{
    width: 600px;
  }

  #indicators{
    display: none;
  }

  #carousel-control{
    margin-top: 80px;
  }

  #cat_parent,
  #aud_language{
    font-size: .8em;
  }

  #admin_product form.product select.cat_id{
    width: 100%;
  }

  /* Container: edge-to-edge mobile */
  .container{
    position: relative;
    margin: 0;
    padding: 10px;
    border-radius: 0;
    overflow-x: hidden;
    overflow-y: hidden;
  }

  /* Header simplification on mobile */
  .logo img,
  .subtitle,
  .horiznav{
    display: none;
  }

  header .site-title a{
    display: none;
  }

  header .site-title a.mobile{
    display: block;
  }

  header .title{
    font-size: 24px;
  }

  /* Classic menu hidden */
  nav.horiznav{
    display: none;
  }

  /* Mobile nav shown */
  #mobilenav{
    display: block;
  }

  /* =============================================================================
    Mobile drawer panel
  ============================================================================= */
  #mobilenav .menu{
    position: absolute;
    top: 0;
    left: 0;

    max-width: 450px;
    width: calc(100vw - 40px);
    height: 100%;

    transform: translate3d(-450px, 0, 0);
    transition: transform 0.35s;

    overflow: hidden;
    background-color: #fff;
    z-index: 50;
  }

  #mobilenav .header{
    padding: 0 50px;
    height: 50px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-bottom: 1px solid #e8e8e8;
  }

  #mobilenav .header i{
    font-size: 2rem;
    color: #333;
  }

  #mobilenav .header span{
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    width: 100%;
    cursor: pointer;
  }

  /* Nested submenu initial offset (kept) */
  #mobilenav .menu .menu{
    transform: translate3d(480px, 0, 0);
  }

  #mobilenav .menu ul{
    height: 100%;
    list-style: none;
    padding-left: 0;
    overflow-y: auto;
  }

  #mobilenav .menu ul li a,
  nav .menu ul li label{
    display: block;
    text-align: left;
    padding: 0 15px;
    line-height: 47px;
    text-decoration: none;
    color: #333;
    cursor: pointer;
    font-size: 1rem;
    border-bottom: 1px solid #e8e8e8;
    position: relative;
  }

  #mobilenav .menu ul li a.chevron::after{
    content: "";
    position: absolute;
    display: inline-block;
    height: 10px;
    width: 10px;
    border-color: #333;
    border-style: solid;
    border-width: 1px 1px 0 0;
    transform: rotate(45deg);
    top: 50%;
    margin-top: -5px;
    right: 16px;
  }

  #mobilenav .menu ul li .invisible{
    border-bottom: 0;
  }

  /* Open state (kept: .open_menu.active ~ .menu) */
  #mobilenav .open_menu.active ~ .menu{
    transform: translate3d(0, 0, 0);
  }

  /* =============================================================================
    HAMBURGER ICON
  ============================================================================= */
  #nav-hamburger-icon{
    display: block;
    position: absolute;
    top: 10px;
    left: 10px;
    width: 33px;
    height: 28px;
    z-index: 100;
    user-select: none;
    cursor: pointer;
  }

  #nav-hamburger-icon.open{
    po/sition: fixed;
    top: 10px;
    left: 10px;
  }

  #nav-hamburger-icon span{
    display: block;
    position: absolute;
    height: 4px;
    width: 100%;
    margin-bottom: 5px;
    background: black;
    border-radius: 3px;
    z-index: 100;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: 0.25s ease-in-out;
  }

  #nav-hamburger-icon span:nth-child(1){
    top: 0px;
    transform-origin: left top;
  }
  #nav-hamburger-icon span:nth-child(2){
    top: 12px;
    transform-origin: left center;
  }
  #nav-hamburger-icon span:nth-child(3){
    top: 24px;
    transform-origin: left bottom;
  }

  #nav-hamburger-icon.open span{
    background: #333;
  }

  #nav-hamburger-icon.open span:nth-child(1){
    width: 110%;
    transform: rotate(45deg);
  }

  #nav-hamburger-icon.open span:nth-child(2){
    width: 0%;
    opacity: 0;
  }

  #nav-hamburger-icon.open span:nth-child(3){
    width: 110%;
    transform: rotate(-45deg);
  }

  /* Audio player: mobile layout */
  #audio .player{
    display: none;
  }
  #audio .player.mobile{
    display: block;
  }
  #audio .play-button{
    ma/rgin-left: 0;
  }
}

/* =============================================================================
  320px–640px (extra small tweaks)
============================================================================= */
@media screen and (min-width: 320px) and (max-width: 640px){
  header .site-title .mobile{
    display: block;
  }

  header .profile-menu > li > a{
    font-size: 1.2rem;
  }

  .jq-toast-wrap.bottom-right{
    right: 20px;
  }

  #admin_product form.product select.cat_id{
    width: 100%;
  }
}
