/* =========================================================================
   추천, 좋은제품들을 모아놓은곳 - 스타일
   ========================================================================= */

/* ---------- 테마 변수 ---------- */
:root {
    --radius: 18px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.35);
    --transition: 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    --maxw: 1240px;
}

/* 밝은 테마 (기본) */
[data-theme="light"] {
    --bg: #f4f6fb;
    --bg-grad:
        radial-gradient(1200px 600px at 100% -10%, #e7ecff 0%, transparent 60%),
        radial-gradient(900px 500px at -10% 10%, #ffe9f2 0%, transparent 55%);
    --surface: #ffffff;
    --surface-2: #f7f8fc;
    --text: #1a1d29;
    --text-soft: #5a6072;
    --border: #e7e9f2;
    --accent: #5b6cff;
    --accent-2: #9b5bff;
    --accent-contrast: #ffffff;
    --chip-bg: #ffffff;
}

/* 다크 모드 */
[data-theme="dark"] {
    --bg: #0c0e16;
    --bg-grad:
        radial-gradient(1200px 600px at 100% -10%, #1c2452 0%, transparent 60%),
        radial-gradient(900px 500px at -10% 10%, #3a1c52 0%, transparent 55%);
    --surface: #161a26;
    --surface-2: #1d2230;
    --text: #eef1fb;
    --text-soft: #9aa2bd;
    --border: #262b3b;
    --accent: #7b8cff;
    --accent-2: #c08bff;
    --accent-contrast: #0c0e16;
    --chip-bg: #1d2230;
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.8);
}

/* 봄 */
[data-theme="spring"] {
    --bg: #fff5f8;
    --bg-grad:
        radial-gradient(1000px 500px at 90% -10%, #ffd9e6 0%, transparent 60%),
        radial-gradient(800px 500px at 0% 20%, #d9f7e0 0%, transparent 55%);
    --surface: #ffffff;
    --surface-2: #fff0f5;
    --text: #4a2b3a;
    --text-soft: #8a6b78;
    --border: #ffe0eb;
    --accent: #ff7eb3;
    --accent-2: #7ed957;
    --accent-contrast: #ffffff;
    --chip-bg: #ffffff;
}

/* 여름 */
[data-theme="summer"] {
    --bg: #eefcff;
    --bg-grad:
        radial-gradient(1100px 550px at 95% -10%, #aef0ff 0%, transparent 60%),
        radial-gradient(800px 500px at 0% 15%, #fff4c2 0%, transparent 55%);
    --surface: #ffffff;
    --surface-2: #eafaff;
    --text: #053b4a;
    --text-soft: #4a7682;
    --border: #c9eef6;
    --accent: #00b4d8;
    --accent-2: #ffb703;
    --accent-contrast: #ffffff;
    --chip-bg: #ffffff;
}

/* 가을 */
[data-theme="autumn"] {
    --bg: #fff6ec;
    --bg-grad:
        radial-gradient(1100px 550px at 95% -10%, #ffd9a8 0%, transparent 60%),
        radial-gradient(800px 500px at 0% 15%, #ffc0a0 0%, transparent 55%);
    --surface: #fffaf3;
    --surface-2: #fdeedd;
    --text: #4a2a14;
    --text-soft: #8a6a52;
    --border: #f2dcc4;
    --accent: #e76f1d;
    --accent-2: #c1440e;
    --accent-contrast: #ffffff;
    --chip-bg: #fffaf3;
}

/* 겨울 */
[data-theme="winter"] {
    --bg: #eef3fb;
    --bg-grad:
        radial-gradient(1100px 550px at 95% -10%, #cfe2ff 0%, transparent 60%),
        radial-gradient(800px 500px at 0% 15%, #e6ecff 0%, transparent 55%);
    --surface: #ffffff;
    --surface-2: #f1f5fc;
    --text: #1b2a44;
    --text-soft: #5e6e8c;
    --border: #dce6f5;
    --accent: #4a7bd8;
    --accent-2: #7aa5e9;
    --accent-contrast: #ffffff;
    --chip-bg: #ffffff;
}

/* ---------- 기본 ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    /* Firefox 커스텀 스크롤바 */
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--accent) 70%, transparent) transparent;
}

/* 예쁜 커스텀 스크롤바 (Chrome/Edge/Safari) */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    border-radius: 999px;
    border: 3px solid var(--bg);   /* 트랙과의 여백 효과 */
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    border-width: 2px;
}

body {
    font-family: "Noto Sans KR", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition:
        background var(--transition),
        color var(--transition);
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: var(--bg-grad);
    z-index: -1;
    transition: opacity var(--transition);
}

a {
    text-decoration: none;
    color: inherit;
}

/* ---------- 헤더 ---------- */
.site-header {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 56px 24px 28px;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

.brand-badge {
    display: none;
    font-size: 12px;
    letter-spacing: 0.25em;
    font-weight: 700;
    color: var(--accent-contrast);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    padding: 5px 14px;
    border-radius: 999px;
    margin-bottom: 14px;
    animation: pop-in 0.6s var(--transition) both;
}

.brand-logo {
    display: block;
    /* 기본은 원본 크기. 단 가로 넘침만 방지 (높이는 설정값을 인라인으로 지정) */
    max-width: 100%;
    height: auto;
    margin-bottom: 12px;
    object-fit: contain;
    animation: rise-in 0.7s var(--transition) both;
}

.brand-title {
    font-family: "Playfair Display", "Noto Sans KR", serif;
    font-size: clamp(28px, 5vw, 46px);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.01em;
    background: linear-gradient(120deg, var(--text), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rise-in 0.7s var(--transition) both 0.05s;
}

.brand-subtitle {
    margin-top: 10px;
    color: var(--text-soft);
    font-size: 16px;
    animation: rise-in 0.7s var(--transition) both 0.15s;
}

/* 상단 영역 우측 컬럼 (테마 스위처 위, 문의 링크 아래) */
.header-aside {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
}

/* 문의 링크 (상단 영역 우측 하단) */
.inquiry-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    animation: rise-in 0.7s var(--transition) both 0.25s;
    transition: transform 0.2s var(--transition),
                color 0.2s var(--transition),
                border-color 0.2s var(--transition);
}
.inquiry-link:hover {
    transform: translateY(-2px);
    color: var(--accent);
    border-color: var(--accent);
}

/* 테마 스위처 (드롭다운) */
.theme-switcher {
    position: relative;
    animation: rise-in 0.7s var(--transition) both 0.2s;
}

/* 토글: 선택된 아이콘만 (원형) */
.theme-toggle {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition:
        transform 0.2s var(--transition),
        box-shadow 0.2s;
}
.theme-toggle:hover {
    transform: translateY(-2px) scale(1.05);
}
.theme-toggle:active {
    transform: scale(0.96);
}
.opt-icon {
    font-size: 20px;
    line-height: 1;
}

/* 메뉴: 위에서 아래로 쭉 펼쳐지는 애니메이션 */
.theme-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 200;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-lg);
    padding: 7px;
    display: flex;
    flex-direction: column;
    gap: 6px;

    transform-origin: top center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scaleY(0.3);
    transition:
        opacity 0.2s ease,
        transform 0.32s cubic-bezier(0.22, 1.4, 0.36, 1),
        visibility 0.32s;
}
.theme-menu.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scaleY(1);
}

/* 옵션: 원형 아이콘 버튼, 펼칠 때 순차 등장 */
.theme-option {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-6px);
    transition:
        background 0.18s,
        opacity 0.25s var(--transition),
        transform 0.25s var(--transition);
}
.theme-menu.open .theme-option {
    opacity: 1;
    transform: none;
}
.theme-menu.open .theme-option:nth-child(1) { transition-delay: 0.04s; }
.theme-menu.open .theme-option:nth-child(2) { transition-delay: 0.08s; }
.theme-menu.open .theme-option:nth-child(3) { transition-delay: 0.12s; }
.theme-menu.open .theme-option:nth-child(4) { transition-delay: 0.16s; }
.theme-menu.open .theme-option:nth-child(5) { transition-delay: 0.20s; }
.theme-menu.open .theme-option:nth-child(6) { transition-delay: 0.24s; }
.theme-option:hover {
    background: var(--surface-2);
}
.theme-option.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 6px 16px -6px var(--accent);
}

/* ---------- 툴바 ---------- */
.toolbar {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(14px);
    background: color-mix(in srgb, var(--bg) 75%, transparent);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}

.toolbar-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 16px;
    align-items: center;
}

.search-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 12px 18px;
    box-shadow: var(--shadow);
    transition:
        box-shadow var(--transition),
        transform var(--transition);
}
.search-wrap:focus-within {
    box-shadow:
        0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent),
        var(--shadow);
    transform: translateY(-1px);
}
.search-icon {
    color: var(--text-soft);
    flex-shrink: 0;
}
.search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    outline: none;
}
.search-input::placeholder {
    color: var(--text-soft);
}
.clear-search {
    border: none;
    background: var(--surface-2);
    color: var(--text-soft);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
}

/* 레이아웃 스위처 */
.layout-switcher {
    display: flex;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px;
    box-shadow: var(--shadow);
}
.layout-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-soft);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.25s var(--transition);
}
.layout-btn:hover {
    color: var(--text);
    transform: translateY(-2px);
}
.layout-btn.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--accent-contrast);
}

/* 카테고리 칩 */
.category-chips {
    max-width: var(--maxw);
    margin: 14px auto 0;
    padding: 0 24px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
/* 펼치기/접기 애니메이션 (JS가 첫 측정 이후 활성화) */
.category-chips.chips-animated {
    transition: max-height 0.35s var(--transition);
}
/* 애니메이션 중에는 넘치는 줄을 클립해서 자연스럽게 펼쳐/접히게 */
.category-chips.chips-clip {
    overflow: hidden;
}
/* 카테고리 칩 + 펼침 아이콘 묶음 */
.category-filter {
    position: relative;
}
/* 카테고리가 많아 2줄을 넘으면 접어서 공간 절약 (JS가 높이를 측정해 설정) */
.category-chips.collapsed {
    overflow: hidden;
    max-height: var(--chips-collapsed-h, 84px);
}
/* 우측 하단 아이콘 토글 (한 줄을 차지하지 않고 칩 영역 위에 떠 있음) */
.chips-toggle {
    position: absolute;
    right: 24px;
    bottom: 0;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--accent-contrast);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    transition: all 0.25s var(--transition);
    z-index: 2;
}
.chips-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24);
}
.chips-toggle-icon {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}
.chip {
    border: 1px solid var(--border);
    background: var(--chip-bg);
    color: var(--text-soft);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s var(--transition);
}
.chip:hover {
    transform: translateY(-2px);
    color: var(--text);
}
.chip.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--accent-contrast);
    border-color: transparent;
}
/* 기획 칩: 카테고리 칩과 시각적으로 구분 (강조 테두리) */
.chip-campaign {
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 700;
}
.chip-campaign.active {
    color: var(--accent-contrast);
}

/* ---------- 에러 페이지 ---------- */
.error-screen {
    max-width: 560px;
    margin: 0 auto;
    padding: 100px 24px;
    text-align: center;
}
.error-code {
    font-size: 96px;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.error-message {
    margin: 16px 0 28px;
    color: var(--text-soft);
    font-size: 18px;
}

/* ---------- 단일 상품(공유 링크) 배너 ---------- */
.single-banner {
    max-width: var(--maxw);
    margin: 18px auto 0;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
.single-banner-text {
    color: var(--text);
    font-size: 14px;
}
.single-banner-link {
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}
@media (max-width: 640px) {
    .single-banner {
        margin: 14px 16px 0;
    }
}

/* ---------- 콘텐츠 ---------- */
.content {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 36px 24px 80px;
}

/* 상품 리스트 - 공통 카드 진입 애니메이션 */
.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        border-color var(--transition);
    animation: card-in 0.6s var(--transition) both;
    animation-delay: calc(var(--i) * 60ms);
    position: relative;
}
.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.product-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 45%);
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}
.product-card:hover::after {
    opacity: 1;
}

.card-media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--surface-2);
    overflow: hidden;
}
.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--transition);
}
.product-card:hover .card-media img {
    transform: scale(1.08);
}
.media-placeholder,
.card-media.no-image::before {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-size: 48px;
    opacity: 0.35;
}
.card-media.no-image::before {
    content: "🛍️";
}
.card-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    pointer-events: none;   /* 카드 클릭(링크 이동)을 막지 않도록 */
}
.card-category {
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    backdrop-filter: blur(6px);
    color: var(--text);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid var(--border);
}

/* 상품 이미지 우측 상단 공유(링크 복사) 버튼 */
.card-share {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    color: var(--text);
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.2s var(--transition),
                transform 0.2s var(--transition),
                background 0.2s var(--transition);
}
.card-share:hover {
    opacity: 1;
    transform: translateY(-1px);
    background: var(--surface);
}
.card-share.copied {
    color: #fff;
    background: #22c55e;
    border-color: #22c55e;
}

.card-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}
.card-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
}
.card-content {
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-footer {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-price {
    font-weight: 900;
    font-size: 17px;
    color: var(--accent);
}
.card-link {
    margin-left: auto;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.card-link .arrow {
    transition: transform 0.3s var(--transition);
}
.product-card:hover .card-link {
    color: var(--accent);
}
.product-card:hover .card-link .arrow {
    transform: translateX(5px);
}

/* ===== 레이아웃: 그리드형 ===== */
.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* ---------- 더보기 버튼 ---------- */
.load-more-wrap[hidden] {
    display: none;
}
.load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 36px;
    animation: rise-in 0.5s var(--transition) both;
}
.load-more-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 34px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition:
        transform 0.25s var(--transition),
        box-shadow 0.25s,
        color 0.25s;
}
.load-more-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    opacity: 0;
    transition: opacity 0.25s;
    z-index: 0;
}
.load-more-btn > * {
    position: relative;
    z-index: 1;
}
.load-more-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    color: var(--accent-contrast);
}
.load-more-btn:hover::before {
    opacity: 1;
}
.load-more-count {
    font-size: 13px;
    font-weight: 700;
    opacity: 0.7;
}

/* ===== 레이아웃: 한줄형 (카테고리별 가로 스크롤) ===== */
.row-groups[hidden] {
    display: none;
}
.row-groups {
    display: flex;
    flex-direction: column;
    gap: 34px;
}
.cat-section[hidden] {
    display: none;
}
.cat-section {
    animation: rise-in 0.5s var(--transition) both;
}
.cat-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 20px;
    font-weight: 900;
    margin-bottom: 16px;
    padding-left: 4px;
    position: relative;
}
.cat-title::before {
    content: "";
    width: 6px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    flex-shrink: 0;
}
.cat-title .cat-name {
    background: linear-gradient(120deg, var(--text), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.cat-title .cat-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-soft);
}

.cat-track {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 4px 4px 18px;
    scroll-snap-type: x mandatory;
}
.cat-track .product-card {
    flex: 0 0 300px;
    scroll-snap-align: start;
}
.cat-track::-webkit-scrollbar {
    height: 10px;
}
.cat-track::-webkit-scrollbar-track {
    background: var(--surface-2);
    border-radius: 999px;
}
.cat-track::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: 999px;
}
@media (max-width: 560px) {
    .cat-track .product-card {
        flex-basis: 240px;
    }
}

/* ===== 레이아웃: 텍스트형 ===== */
.layout-text {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.layout-text .product-card {
    flex-direction: row;
    align-items: stretch;
}
.layout-text .card-media {
    flex: 0 0 132px;
    aspect-ratio: auto;
    padding: 12px;
    background: transparent;
}
.layout-text .card-media img,
.layout-text .card-media .media-placeholder {
    border-radius: var(--radius-sm);
}
.layout-text .card-badges {
    display: none;
}
.layout-text .card-share {
    top: 18px;
    right: 18px;
    width: 30px;
    height: 30px;
}
.layout-text .card-share svg {
    width: 15px;
    height: 15px;
}
.layout-text .card-body {
    padding: 16px 22px;
}
.layout-text .card-content {
    -webkit-line-clamp: 1;
}
@media (max-width: 560px) {
    .layout-text .card-media {
        flex-basis: 104px;
        padding: 10px;
    }
}

/* ---------- 토스트 (링크 복사 알림) ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translate(-50%, 16px);
    z-index: 1000;
    max-width: calc(100vw - 40px);
    padding: 12px 22px;
    border-radius: 999px;
    background: var(--text);
    color: var(--surface);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--transition),
                transform 0.25s var(--transition);
}
.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- 맨 위로 이동 플로팅 버튼 ---------- */
.scroll-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 900;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    color: var(--accent-contrast);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity 0.25s var(--transition),
                transform 0.25s var(--transition),
                box-shadow 0.2s var(--transition);
}
.scroll-top.show {
    opacity: 0.92;
    transform: translateY(0);
    pointer-events: auto;
}
.scroll-top:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}
@media (max-width: 560px) {
    .scroll-top {
        right: 16px;
        bottom: 16px;
        width: 44px;
        height: 44px;
    }
}

/* ---------- 빈 상태 ---------- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-soft);
}
.empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}
.empty-state p {
    font-size: 18px;
}
.empty-cta {
    display: inline-block;
    margin-top: 18px;
    padding: 12px 24px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--accent-contrast);
    font-weight: 700;
}

/* ---------- 푸터 ---------- */
.site-footer {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 30px 24px 50px;
    text-align: center;
    color: var(--text-soft);
    font-size: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.admin-link {
    font-size: 13px;
    color: var(--text-soft);
    opacity: 0.6;
    transition: opacity 0.25s;
}
.admin-link:hover {
    opacity: 1;
    color: var(--accent);
}

/* ---------- 모바일 여백/간격 다듬기 ---------- */
@media (max-width: 600px) {
    .site-header {
        padding: 32px 16px 16px;
    }
    .header-inner {
        align-items: center;
    }
    .toolbar {
        padding: 12px 0;
    }
    .toolbar-inner {
        padding: 0 16px;
        gap: 10px;
    }
    .search-wrap {
        padding: 10px 14px;
    }
    .layout-switcher {
        flex-shrink: 0;
    }
    .layout-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    .category-chips {
        padding: 0 16px;
    }
    .chips-toggle {
        right: 16px;
    }
    .content {
        padding: 24px 16px 70px;
    }
    .layout-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .site-footer {
        padding: 24px 16px 40px;
    }
}

/* ---------- 애니메이션 ---------- */
@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes pop-in {
    0% {
        opacity: 0;
        transform: scale(0.7);
    }
    70% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}
@keyframes float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* =========================================================================
   관리자 화면
   ========================================================================= */
.admin-body {
    max-width: 1000px;
    margin: 0 auto;
    padding: 32px 24px 80px;
}

/* 로그인 */
.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px 34px;
    text-align: center;
    animation: card-in 0.5s var(--transition) both;
}
.login-card .lock {
    font-size: 44px;
    margin-bottom: 14px;
}
.login-card h1 {
    font-size: 22px;
    margin-bottom: 6px;
}
.login-card p {
    color: var(--text-soft);
    margin-bottom: 24px;
    font-size: 14px;
}

/* 폼 공통 */
.field {
    margin-bottom: 18px;
    text-align: left;
}
.field label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}
.field label .req {
    color: #ff5b6c;
    margin-left: 4px;
}
.field input[type="text"],
.field input[type="password"],
.field input[type="url"],
.field input[type="number"],
.field textarea,
.field select {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.field textarea {
    resize: vertical;
    min-height: 110px;
}
.field .hint {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 6px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition:
        transform 0.2s,
        box-shadow 0.2s,
        opacity 0.2s;
}
.btn:hover {
    transform: translateY(-2px);
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--accent-contrast);
    box-shadow: 0 10px 24px -10px var(--accent);
}
.btn-block {
    width: 100%;
}
.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-danger {
    background: transparent;
    color: #ff5b6c;
    border: 1px solid color-mix(in srgb, #ff5b6c 40%, var(--border));
}
.btn-danger:hover {
    background: color-mix(in srgb, #ff5b6c 12%, transparent);
}
.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}
/* 아이콘 전용 버튼: 텍스트 없이 SVG만 표시 (설명은 title 툴팁으로) */
.btn-icon {
    padding: 0;
    width: 34px;
    height: 34px;
    gap: 0;
    flex: none;
}
.btn-icon svg {
    display: block;
}

/* 관리자 네비 */
.admin-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.admin-nav .nav-title {
    font-weight: 900;
    font-size: 20px;
    margin-right: auto;
}
.admin-nav a.tab {
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-soft);
    border: 1px solid var(--border);
    background: var(--surface);
}
.admin-nav a.tab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--accent-contrast);
    border-color: transparent;
}

/* 관리자 탭 */
.admin-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px;
    box-shadow: var(--shadow);
    width: fit-content;
    max-width: 100%;
}
.atab {
    border: none;
    background: transparent;
    color: var(--text-soft);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    padding: 10px 22px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.25s var(--transition);
}
.atab:hover { color: var(--text); }
.atab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--accent-contrast);
    box-shadow: 0 8px 18px -8px var(--accent);
}
.tab-panel[hidden] { display: none; }
/* transform 대신 opacity만 사용 (transform 조상은 내부 position:fixed 모달을 어긋나게 함) */
.tab-panel { animation: fade-in 0.3s ease both; }
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 플래시 메시지 */
/* 하단 토스트 컨테이너 (JS가 .flash들을 이 안으로 옮겨 담음) */
.flash-toasts {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(440px, calc(100vw - 32px));
    pointer-events: none;
}

.flash {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow);
    cursor: pointer;
    /* 등장/퇴장 애니메이션: 아래에서 슬라이드 + 페이드 */
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.35s var(--transition), transform 0.35s var(--transition);
}
.flash-toasts .flash {
    pointer-events: auto;
}
/* JS가 부여: 보이는 상태 (제거하면 다시 아래로 사라짐) */
.flash.flash-show {
    opacity: 1;
    transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
    .flash {
        transition: opacity 0.2s linear;
        transform: none;
    }
    .flash.flash-show {
        transform: none;
    }
}
.flash-error {
    background: color-mix(in srgb, #ff5b6c 14%, var(--surface));
    color: #d63545;
    border: 1px solid color-mix(in srgb, #ff5b6c 35%, transparent);
}
.flash-success {
    background: color-mix(in srgb, #1fc16b 14%, var(--surface));
    color: #119a52;
    border: 1px solid color-mix(in srgb, #1fc16b 35%, transparent);
}

/* 관리자 카드/패널 */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}
.panel-head h2 {
    font-size: 19px;
}
.panel-head-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 쿠팡파트너스 링크 버튼 */
.coupang-link {
    background: linear-gradient(135deg, #346aff, #00b4d8);
    color: #ffffff;
    box-shadow: 0 8px 20px -10px #346aff;
    white-space: nowrap;
}
.coupang-link:hover {
    filter: brightness(1.05);
}

/* 상품 테이블 */
.product-table {
    width: 100%;
    border-collapse: collapse;
}
.product-table th,
.product-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}
.product-table th {
    color: var(--text-soft);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.product-table .thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--surface-2);
}
.thumb-empty {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    display: grid;
    place-items: center;
    font-size: 22px;
    opacity: 0.4;
}
.row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.t-name {
    font-weight: 700;
}
.t-link {
    white-space: nowrap;
}
/* 테이블 액션 아이콘 버튼 (열기 / 복사) - 설명은 title 툴팁으로 */
.t-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    background: var(--chip-bg);
    color: var(--text-soft);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s var(--transition);
}
.t-icon + .t-icon {
    margin-left: 6px;
}
.t-icon:hover {
    color: var(--text);
    border-color: var(--accent);
}
.t-icon svg {
    display: block;
}
.copy-link.copied {
    color: var(--accent-contrast);
    background: var(--accent);
    border-color: transparent;
}
.muted {
    color: var(--text-soft);
}

/* ---------- 기획 설정: 상태 배지 ---------- */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.badge-on {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}
.badge-off {
    background: var(--chip-bg);
    color: var(--text-soft);
}

/* ---------- 기획 설정: 활성화 체크박스 ---------- */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ---------- 기획 설정: 적용 상품 선택 목록 ---------- */
.campaign-products {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
}
.cp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.cp-item:last-child {
    border-bottom: none;
}
.cp-item:hover {
    background: var(--chip-bg);
}
.cp-item input[type="checkbox"] {
    width: 17px;
    height: 17px;
    flex: none;
    cursor: pointer;
}
.cp-thumb {
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 8px;
    object-fit: cover;
    background: var(--chip-bg);
}
.cp-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.cp-name {
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cp-cat {
    font-size: 12px;
    flex: none;
}

@media (max-width: 640px) {
    .hide-sm {
        display: none;
    }
    .cp-cat {
        display: none;
    }
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}
.form-grid .full {
    grid-column: 1 / -1;
}
@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

/* 링크 + 자동채우기 버튼 한 줄 */
.link-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}
.link-row input {
    flex: 1;
}
.link-row .btn {
    white-space: nowrap;
    flex-shrink: 0;
}
@media (max-width: 560px) {
    .link-row {
        flex-direction: column;
    }
}

/* HTML 붙여넣기 모달 */
.modal-overlay[hidden] {
    display: none;
}
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: rise-in 0.2s var(--transition) both;
}
.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 26px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: card-in 0.3s var(--transition) both;
}
.modal-box.modal-lg {
    max-width: 720px;
}
.modal-box h3 {
    font-size: 19px;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.modal-close {
    border: none;
    background: var(--surface-2);
    color: var(--text-soft);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.modal-close:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
}
/* HTML 추출 모달은 상품 모달 위에 표시 */
#htmlModal {
    z-index: 1100;
}
.modal-box textarea {
    width: 100%;
    min-height: 240px;
    resize: vertical;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    line-height: 1.5;
    outline: none;
}
.modal-box textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 4px;
}

/* 링크 + 자동채우기 버튼 한 줄 */
.link-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

/* 이미지 드롭존 */
.dropzone {
    margin-top: 10px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    padding: 22px 18px;
    text-align: center;
    cursor: pointer;
    transition:
        border-color 0.2s,
        background 0.2s,
        transform 0.2s;
    outline: none;
}
.dropzone:hover,
.dropzone:focus-visible {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 7%, var(--surface-2));
}
.dropzone.dragging {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
    transform: scale(1.01);
}
.dz-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-soft);
    font-size: 14px;
}
.dz-icon {
    font-size: 24px;
}
.dz-status {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
}
.dz-status.error {
    color: #ff5b6c;
}

/* 이미지 미리보기 */
.img-preview-wrap {
    margin-top: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}
.img-preview {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    max-height: 180px;
    max-width: 100%;
    object-fit: contain;
    background: var(--surface-2);
}
.img-preview.is-placeholder {
    border-style: dashed;
    opacity: 0.85;
}
