/* ===============================
   모바일 스타일 (화면 너비 850px 이하)
   =============================== */
@media (max-width: 850px) {

  /* ---------- 공통 색상 변수 ---------- */
  :root {
    --main-red: #E82310;     /* 메인 빨간색 */
    --main-white: #fff;      /* 기본 흰색 */
    --menu-hover-bg: #ffe4de;/* 메뉴 hover 시 배경 */
    --main-red-dark: #c51709;/* 진한 빨간색 */
  }

  /* ---------- 공통 기본 설정 ---------- */
  body, html {
    margin: 0;
    padding: 0;
    font-family: 'Pretendard', sans-serif;
    background: #fff;
  }

  /* PC 헤더는 모바일에서 보이지 않도록 */
  .pc-header {
    display: none !important;
  }

  /* 앱바 높이만큼 body 위쪽 여백 확보 */
  body {
    padding-top: 57px !important;
  }

  /* ---------- 모바일 상단 앱바 ---------- */
  .mobile-appbar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 57px;
    background: #fff;
    color: var(--main-red);
    border-bottom: 1.5px solid #e0e0e0;
    z-index: 1201;
    padding: 0 8px 0 10px;
  }

  /* 중앙 로고 */
  .mobile-appbar .logo {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.8rem;
    color: inherit;
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
  }

  /* 아이콘 버튼 (햄버거 등) */
  .mobile-appbar .icon-btn {
    background: none;
    border: none;
    font-size: 1.6em;
    cursor: pointer;
    color: inherit;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* 초기에는 햄버거 메뉴 숨김 */
  #mobileMenuBtn { display: none; }

  /* ---------- 모바일 메뉴바 ---------- */
  .mobile-main-menu {
    position: relative !important;
    top: 0 !important;
    margin: 0 !important;
    padding: 0 6px 4px 6px !important;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    width: 100vw;
    z-index: 1100;
  }

  /* 메뉴 슬라이더 (좌우 스크롤) */
  .mobile-menu-slider {
    display: flex;
    gap: 4px; /* 버튼 간격 최소화 */
    overflow-x: auto;
    padding: 6px 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  /* 메뉴 버튼 */
  .mobile-menu-slider a {
    flex: 0 0 auto;
    min-width: 70px;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    border: 1px solid #aaa;
    border-radius: 10px;
    padding: 7px 0;
    color: #222;
    background: #fff;
    text-decoration: none;
    transition: all .15s ease-in-out;
    box-shadow: none !important; /* 그림자 제거 */
  }

  /* 메뉴 버튼 hover/선택 효과 */
  .mobile-menu-slider a:active,
  .mobile-menu-slider a:focus,
  .mobile-menu-slider a.selected,
  .mobile-menu-slider a:hover {
    border: 1px solid var(--main-red);
    color: var(--main-red);
    background: var(--menu-hover-bg);
  }

  /* ---------- 검색 레이어 ---------- */
  .mobile-layer-search {
    display: none;
    flex-direction: column;
    background: var(--main-red);
    color: #fff;
    width: 100vw;
    position: fixed;
    left: 0;
    top: 57px;
    z-index: 1230;
    box-shadow: 0 6px 20px rgba(232, 35, 16, 0.25);
    animation: slide-down .22s ease-out;
    padding: 24px 0 16px 0;
  }

  /* 검색 레이어 활성화 시 표시 */
  .mobile-layer-search.active { display: flex; }

  /* 검색 레이어 헤더(X 버튼 있는 영역) 숨김 */
  .mobile-layer-search .search-header {
    display: none !important;
  }

  /* 검색창 컨테이너 */
  .mobile-layer-search .mobile-menu-search {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 90%;
    max-width: 360px;
    margin: 0 auto;
    padding: 0 14px;
    background: #fff;
    border: 2px solid var(--main-red);
    border-radius: 9999px;
    box-sizing: border-box;
  }

  /* 검색창 입력 필드 */
  .mobile-layer-search input {
    flex: 1;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 10px 8px;
    font-size: 1.1em;
    color: var(--main-red);
    box-sizing: border-box;
  }

  /* placeholder 스타일 */
  .mobile-layer-search input::placeholder {
    color: var(--main-red);
    opacity: 0.7;
  }

  /* ---------- 검색 버튼 (텍스트 "검색") ---------- */
  .mobile-layer-search button {
    border: none;
    background: none;
    margin-left: 8px;
    padding: 0;
    font-size: 1em;
    font-weight: 700;
    color: var(--main-red);
    cursor: pointer;
  }

  /* 최근검색 X 버튼 보이도록 */
  #recent-search-list-mo .close-btn {
    display: flex !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #999 !important;
  }

  /* 메뉴 닫기 버튼(X) 숨김 */
  .mobile-layer-menu .close-btn {
    display: none !important;
  }

  /* 최근검색 리스트 아이콘 원래 스타일 유지 (돋보기 제거) */
  #recent-search-list-mo .search-item-icon {
    position: relative;
    top: 0;
    left: 0;
    transform: none;
    font-size: 1.2rem;
    color: var(--main-red);
  }

  /* 모바일 검색 버튼 (좌측) 위치 고정 */
  #mobileSearchBtn {
    position: absolute !important;
    left: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: inline-flex !important;
    color: inherit;
    z-index: 3;
  }

  /* PC 검색 리스트 숨김 */
  #recent-search-list-pc { display: none !important; }

  /* slide-down 애니메이션 */
  @keyframes slide-down {
    from { opacity: 0; transform: translateY(-20px);}
    to { opacity: 1; transform: translateY(0);}
  }

  /* 배너, 콘텐츠 z-index */
  #mainBanner, .content, .banner, .other-main-content { 
    position: relative; 
    z-index: 1; 
  }
}
