/* ===== 반응형 ===== */

/* ===== 햄버거 메뉴 (모든 viewport에서 base 스타일) ===== */
.nav-toggle {
    display: none;
    position: relative;
    width: 40px;
    height: 36px;
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}
.nav-toggle span {
    display: block;
    position: absolute;
    left: 8px;
    width: 24px;
    height: 2px;
    background: #fff;
    transition: all 0.25s ease;
    border-radius: 1px;
}
.nav-toggle span:nth-child(1) { top: 11px; }
.nav-toggle span:nth-child(2) { top: 17px; }
.nav-toggle span:nth-child(3) { top: 23px; }
.nav-toggle.open span:nth-child(1) { top: 17px; transform: rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { top: 17px; transform: rotate(-45deg); }

.nav-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.nav-overlay.open { opacity: 1; pointer-events: auto; }

/* ===== 1024px 이하 (태블릿) ===== */
@media (max-width: 1024px) {
    .container { padding: 0 20px; }

    .price-wrapper { flex-direction: column; }
    .chart-container { flex-direction: column; }
    .chart-box:first-child { border-right: none; border-bottom: 1px solid #f0f0f0; }
    .store-grid { grid-template-columns: repeat(2, 1fr); }
    .product-grid { grid-template-columns: repeat(3, 1fr); }
    .banner-content h2 { font-size: 36px; }

    .product-list-grid { grid-template-columns: repeat(3, 1fr); }
    .mypage-grid { grid-template-columns: 200px 1fr; gap: 20px; }
}

/* ===== 768px 이하 (모바일 가로 / 작은 태블릿) ===== */
@media (max-width: 768px) {
    /* 모바일에서도 top-right 로그인/회원가입 노출 (top-bar 유지) */
    .top-bar { padding: 6px 0; }
    .top-bar .top-left { display: none; }
    .top-bar-inner { justify-content: flex-end; }
    .top-right { font-size: 12px; }
    .top-right a { padding: 0 8px; }
    .top-right .welcome { font-size: 11px; margin-right: 4px; }

    /* 헤더 */
    .header-inner {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 0;
    }
    .header-contact { display: none; }
    .header-search {
        width: 100%;
        order: 3;
    }
    .logo-img { height: 36px !important; max-height: 40px; }

    /* 네비게이션 햄버거 모드 */
    .main-nav { position: relative; }
    .main-nav .container { display: flex; align-items: center; justify-content: flex-end; padding: 0 15px; min-height: 48px; }
    .nav-toggle { display: block; margin-right: auto; }
    .nav-list {
        position: fixed;
        top: 0; left: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        background: #1a1a1a;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        overflow-y: auto;
        padding: 70px 0 30px;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        z-index: 999;
        margin: 0;
    }
    .nav-list.open { transform: translateX(0); }
    .nav-list .nav-item {
        width: 100%;
        border-bottom: 1px solid #2a2a2a;
        height: auto;
    }
    .nav-list .nav-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 22px;
        font-size: 14px;
        height: auto;
        line-height: 1.4;
        color: #fff;
    }
    .nav-list .nav-item .nav-link::after {
        content: '';
        display: none;
    }
    .nav-list .nav-item:has(.sub-menu) > .nav-link::after,
    .nav-list .nav-item .nav-link:has(+ .sub-menu)::after {
        content: '+';
        display: inline-block;
        font-size: 18px;
        color: #888;
        transition: transform 0.2s;
    }
    .nav-list .nav-item.expanded > .nav-link::after {
        content: '−';
    }
    .nav-list .sub-menu {
        position: static;
        background: #0f0f0f;
        display: none;
        box-shadow: none;
        border: none;
        padding: 0;
        margin: 0;
        min-width: auto;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
    .nav-list .nav-item.expanded .sub-menu { display: block; }
    .nav-list .sub-menu li a {
        display: block;
        padding: 11px 36px;
        font-size: 13px;
        color: #ccc;
        border: none;
    }
    .nav-list .sub-menu li a:hover { background: #1a1a1a; color: #ff8a3d; }

    /* 메인 배너 */
    .banner-slide { min-height: 250px; }
    .banner-img { height: 300px; }
    .banner-content { padding: 40px 0; }
    .banner-content h2 { font-size: 28px; }
    .banner-content p { font-size: 14px; }

    /* 섹션 */
    .section-title { font-size: 22px; }
    .price-section,
    .chart-section,
    .products-section,
    .news-section,
    .store-section { padding: 50px 0; }

    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .news-grid { grid-template-columns: 1fr; }
    .intl-price-cards { grid-template-columns: 1fr 1fr; }

    /* 차트 */
    .chart-controls { flex-direction: column; align-items: flex-start; gap: 10px; }
    .chart-tabs, .chart-period { flex-wrap: wrap; }
    .product-category-tabs { flex-wrap: wrap; }

    /* 푸터 */
    .footer-top { flex-direction: column; gap: 15px; text-align: center; }
    .footer-content { flex-direction: column; gap: 20px; }
    .footer-links { flex-wrap: wrap; justify-content: center; }
    .footer-info { text-align: center; font-size: 12px; }
    .family-links { justify-content: center; flex-wrap: wrap; }

    .store-grid { grid-template-columns: 1fr; }

    /* 플로팅 버튼 */
    .floating-btns { right: 12px; bottom: 12px; gap: 6px; }
    .float-btn { width: 46px; height: 46px; font-size: 12px; }
    .float-btn span { font-size: 10px; }

    /* 페이지 타이틀 */
    .page-title-inner h2 { font-size: 24px; }
    .page-title-section { padding: 30px 0; }

    /* 상품 목록 */
    .product-list-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-list-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .product-sort { flex-wrap: wrap; }
    .sort-btn { padding: 5px 11px; font-size: 11px; }
    .product-card .product-name { font-size: 13px; }
    .product-card .product-desc { font-size: 11px; }
    .product-card .current-price { font-size: 14px; }

    /* 시세 페이지 */
    .price-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .price-tab-link { white-space: nowrap; padding: 10px 18px; font-size: 13px; }
    .price-table-wrap { overflow-x: auto; }
    .price-table thead th,
    .price-table tbody td { font-size: 12px; padding: 8px 6px; }

    /* 가맹점 */
    .franchise-table { font-size: 11px; }
    .franchise-table thead th, .franchise-table tbody td { font-size: 11px; padding: 10px 6px; }
    .franchise-search { flex-direction: column; gap: 10px; }
    .franchise-search input, .franchise-search select { width: 100% !important; }

    /* 회사소개 */
    .company-values { grid-template-columns: repeat(2, 1fr); }
    .company-info-grid { grid-template-columns: 1fr; }
    .diamond-process { grid-template-columns: 1fr; }

    /* 뉴스 상세 */
    .news-detail-title { font-size: 20px !important; line-height: 1.4; }
    .news-detail-content { font-size: 14px !important; }

    /* 인증 폼 */
    .auth-wrap { margin: 24px 12px; padding: 28px 20px; }
    .auth-wrap h3 { font-size: 19px; margin-bottom: 22px; }

    /* 마이페이지 */
    .mypage-grid { grid-template-columns: 1fr; gap: 14px; }
    .mypage-side { padding: 18px 0; }
    .mypage-nav { display: flex; overflow-x: auto; padding: 0 12px; gap: 4px; }
    .mypage-nav a {
        display: inline-block;
        white-space: nowrap;
        padding: 10px 14px;
        border-left: none;
        border-bottom: 2px solid transparent;
        font-size: 13px;
    }
    .mypage-nav a.active {
        border-left: none;
        border-bottom-color: #ff6e0e;
        background: transparent;
    }
    .mypage-panel { padding: 22px 18px; }
    .mypage-panel h3 { font-size: 17px; margin-bottom: 18px; }

    .data-table thead { display: none; }
    .data-table tbody tr {
        display: block;
        margin-bottom: 12px;
        padding: 12px;
        border: 1px solid #eee;
        border-radius: 4px;
    }
    .data-table tbody td {
        display: flex;
        justify-content: space-between;
        text-align: right;
        padding: 6px 0;
        border: none;
        font-size: 13px;
    }
    .data-table tbody td::before {
        content: attr(data-label);
        color: #888;
        font-size: 12px;
        font-weight: 500;
    }

    /* 장바구니 - 카드 형태 */
    .cart-table thead { display: none; }
    .cart-table tbody tr {
        display: block;
        margin-bottom: 12px;
        padding: 14px;
        border: 1px solid #eee;
        border-radius: 6px;
    }
    .cart-table tbody td {
        display: block;
        padding: 6px 0;
        border: none;
        text-align: left;
    }
    .cart-table tbody td[data-label]::before {
        content: attr(data-label) ': ';
        color: #888;
        font-size: 12px;
        margin-right: 6px;
    }
    .cart-summary {
        grid-template-columns: 1fr;
        gap: 14px;
        text-align: center;
    }
    .cart-summary .actions { justify-content: center; flex-wrap: wrap; }
    .pt-row { flex-wrap: wrap; gap: 8px; }

    /* 상품 상세 (inline css 보강) */
    .pdetail-grid { grid-template-columns: 1fr !important; gap: 22px !important; margin: 24px 0 40px !important; }
    .pdetail-info h2 { font-size: 19px !important; }
    .pdetail-info .pprice { font-size: 24px !important; }

    /* 푸터 글자 */
    .footer-info p { font-size: 11px; line-height: 1.6; }
}

/* ===== 480px 이하 (모바일 세로) ===== */
@media (max-width: 480px) {
    .container { padding: 0 14px; }

    .logo-img { height: 32px !important; }
    .header-search input { font-size: 13px; padding: 8px 12px; }
    .header-search .search-btn { width: 38px; }

    .banner-content h2 { font-size: 22px; }
    .banner-img { height: 200px; }
    .banner-slide { min-height: 200px; }

    .section-title { font-size: 19px; }

    .product-grid { grid-template-columns: 1fr; }
    .product-list-grid { grid-template-columns: 1fr; }
    .intl-price-cards { grid-template-columns: 1fr; }

    .price-table tbody td { font-size: 12px; padding: 10px 5px; }
    .price-table thead th { font-size: 11px; padding: 8px 5px; }

    .page-title-inner h2 { font-size: 21px; }

    .company-values { grid-template-columns: 1fr; }

    /* 플로팅 버튼 더 줄임 */
    .float-btn { width: 44px; height: 44px; }
    .float-btn i { font-size: 14px; }
    .float-btn span { display: none; }

    /* 상품 정렬 버튼 */
    .product-sort { width: 100%; justify-content: space-between; }
    .sort-btn { flex: 1; padding: 6px 4px; font-size: 11px; text-align: center; }

    /* 인증 폼 */
    .auth-wrap { margin: 16px 8px; padding: 22px 16px; }

    /* 마이페이지 */
    .mypage-panel { padding: 18px 14px; }
}

/* ===== 신규 정적 페이지 (회사소개 서브) 모바일 ===== */
@media (max-width: 768px) {
    /* career.html 인재상 3컬럼 → 1컬럼 */
    section.sub-content .container > div[style*="grid-template-columns:repeat(3"],
    section.sub-content .container > div[style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
    }
    /* franchise-apply.html 가맹혜택 2컬럼 → 1컬럼 */
    section.sub-content .container > div[style*="grid-template-columns:repeat(2"],
    section.sub-content .container > div[style*="grid-template-columns: repeat(2"] {
        grid-template-columns: 1fr !important;
    }
    /* franchise-apply.html STEP 4개 - 가로 스크롤 또는 줄바꿈 (이미 flex-wrap 있음) */

    /* search.html 검색 폼 */
    #searchForm { flex-direction: column; }
    #searchForm input { width: 100%; }
    #searchForm button { width: 100% !important; }

    /* 회사소개 / 본점안내 등의 내부 table */
    section.sub-content table {
        font-size: 12px;
    }
    section.sub-content table th,
    section.sub-content table td {
        padding: 10px 12px !important;
    }
}

@media (max-width: 480px) {
    /* page-title-section padding 줄임 */
    .page-title-section { padding: 22px 0 !important; }
    .page-title-inner h2 { font-size: 18px; }

    /* sub-content 안의 큰 제목 */
    section.sub-content h3 { font-size: 17px !important; }
    section.sub-content h4 { font-size: 15px !important; }

    /* 회사소개 가맹점/연락처 등 정보 카드 padding 축소 */
    .company-info-card { padding: 18px !important; }
}

/* ===== 가로 모드 작은 화면 보정 ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .nav-list { padding-top: 60px; }
}
