/* ===== Variables ===== */
:root {
    /* Colors */
    --color-primary: #E10811;
    --color-primary-dark: #6B0000;
    --color-primary-rgb: 225, 8, 17;
    --color-admin: #B22222;

    /* Typography */
    --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --letter-spacing: -0.02em;
    --line-height: 1.4;
    --font-size-base: 10pt;     /* 기본 */
    --font-size-md: 12pt;       /* 중간 */
    --font-size-lg: 16pt;       /* 강조 */
    --font-size-xl: 18pt;       /* 핵심 */
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    letter-spacing: var(--letter-spacing);
    line-height: var(--line-height);
    color: #333;
    background: #fff;
}

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

button {
    cursor: pointer;
    border: none;
    background: none;
    font: inherit;
}

/* ===== Header ===== */
.header {
    background: #fff;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 상단 바: 로고 + 검색 + 유틸 */
.header-top {
    border-bottom: 1px solid #eee;
    padding: 0 20px;
}

.header-top-inner {
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    height: 80px;
    flex-shrink: 0;
}

.logo-img {
    height: 80px;
    /* ← 여기로 크기 조절 */
    width: auto;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -0.5px;
}

.search-form {
    flex: 1;
    max-width: 480px;
    min-width: 200px;
    height: 60px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background: #EFEFEF;
    border-radius: 80px;

    padding: 16px 24px;

    border: none;
}

.search-form:focus-within {
    box-shadow: 0 0 0 2px rgba(225, 8, 17, 0.15);
}

.search-input {
    height: 60px;
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    color: #333;
}

.search-input::placeholder {
    color: #888;
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #888;
    font-size: 18px;
}

.search-btn:hover {
    color: var(--color-primary);
}

/* 사용자 유틸 아이콘 */
.header-utils {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.util-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: #444;
    text-decoration: none;
    font-size: 0.72rem;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    padding: 0;
    transition: color 0.2s;
    white-space: nowrap;
}

.util-btn:hover {
    color: var(--color-primary);
}

.util-btn-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.util-btn-text {
    color: #666;
    font-size: 0.8rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 4px 0;
    text-decoration: none;
    transition: color 0.2s;
}

.util-btn-text:hover {
    color: var(--color-primary);
}

/* ===== Dropdown ===== */
.util-dropdown {
    position: relative;
}

/* 드롭다운 박스 */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;

    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);

    min-width: 140px;
    padding: 8px 0;

    display: none;
    z-index: 200;
}

/* 기존 util-btn-text 스타일 그대로 활용 */
.dropdown-menu .util-btn-text {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 16px;
}

/* hover로 열림 */
.util-dropdown:hover .dropdown-menu {
    display: block;
}

/* 하단 카테고리 내비게이션 */
.header-nav {
    background: #fff;
    padding: 0 20px;
}

.header-nav-inner {
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.header-nav a {
    display: block;
    padding: 13px 20px;
    font-size: 0.92rem;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.header-nav a:hover,
.header-nav a.active {
    color: var(--color-primary);
}

.header-nav a.nav-secondary {
    color: #a4a4a4;
}

.header-nav a.nav-secondary:hover,
.header-nav a.nav-secondary.active {
    color: var(--color-primary);
}

/* (하위 호환) btn-text */
.btn-text {
    color: #555;
    font-size: 0.9rem;
    padding: 5px 10px;
    transition: color 0.2s;
    background: none;
    border: none;
    cursor: pointer;
}

.btn-text:hover {
    color: var(--color-primary);
}

.user-name {
    font-weight: 500;
}

/* ===== Footer ===== */
.footer {
    background: #fff;
    border-top: 1px solid #e0e0e0;
    position: sticky;
    top: 100vh;
}

.footer-inner {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 60px 80px;
    box-sizing: border-box;
}

/* 2단 레이아웃 */
.footer-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.footer-left {
    width: 636px;
    flex-direction: column;
    display: flex;
    justify-content: space-between;
    height: auto;
}

.footer-right {
    width: 540px;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-bottom: 16px;
}

/* 약관 링크 (최상단) */
.footer-policy {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: -20px;
    margin-bottom: 12px;
}

.footer-policy a {
    font-size: 12px;
    color: #222;
    text-decoration: none;
    font-weight: 600;
}

.footer-policy a:hover {
    color: var(--color-primary);
}

.footer-policy .divider {
    color: #ccc;
    font-size: 12px;
    line-height: 1;
}

/* 하단 링크바 */
.footer-links {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
}

.footer-links a {
    font-size: 12px;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    line-height: 1;
}

.footer-links a:hover {
    color: var(--color-primary);
}

/* 회사정보 */
.footer-company {
    display: flex;
    flex-direction: column;
    gap:12px;
}

.footer-company .company-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111;
}

.footer-company p {
    font-size: 0.82rem;
    color: #666;
    line-height: 1.6;
}

.footer-company .copyright {
    font-size: 14px;
    font-weight: 400;
    color: #a4a4a4;
}

.footer-info-columns {
    width: 540px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.footer-info-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Figma gap: 8px */
}

/* 각 컬럼 정확한 width 적용 */
.footer-info-col:nth-child(1) {
    width: 160px;
}

.footer-info-col:nth-child(2) {
    width: 150px;
}

.footer-info-col:nth-child(3) {
    width: 160px;
}

.footer-info-col h4 {
    font-size: 12px;
    font-weight: 600;
    color: #111;
    margin-bottom: 10px;
}

.footer-info-col p {
    font-size: 10px;
    color: #555;
    margin: 0;
    line-height: 1.5;
}

.footer-phone {
    font-size: 18px !important;
    font-weight: 800;
    color: var(--color-primary) !important;
    margin: 0;
}

    /* SNS 아이콘 */
.footer-sns{
        width:240px;
        margin-left:auto;
        margin-top:auto;
        display:flex;
        justify-content: space-between;
        align-items: center;
}

.sns-circle-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        text-decoration: none;
        color: #555;
        font-size: 0.8rem;
}

.sns-circle-item:hover {
        color: #333
}

.sns-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 0 2px 6px 0px rgba(17, 17, 17, 0.2);
}

.sns-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.is-instagram .sns-circle img{
    width: 30px;
    height: 30px;
    object-fit: contain;
}

/* ===== Container ===== */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 40px 20px;
}

.container-sm {
    max-width: 500px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ===== Page Title ===== */
.page-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: #2d3436;
    margin-bottom: 30px;
    text-align: center;
}

.page-subtitle {
    font-size: 1rem;
    color: #636e72;
    text-align: center;
    margin-top: -20px;
    margin-bottom: 30px;
}

/* ===== Card ===== */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 30px;
}

/* ===== Form ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: #2d3436;
    margin-bottom: 8px;
}

.form-label .required {
    color: #e74c3c;
    margin-left: 3px;
}

.form-control,
.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 1px solid #dfe6e9;
    border-radius: 8px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
}

.form-control.is-invalid,
.form-input.is-invalid,
.form-textarea.is-invalid {
    border-color: #e74c3c;
}

.form-textarea {
    resize: vertical;
}

.form-hint {
    font-size: 0.8rem;
    color: #636e72;
    margin-top: 5px;
}

.form-error {
    font-size: 0.8rem;
    color: #e74c3c;
    margin-top: 5px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: white;
    color: #2d3436;
    border: 1px solid #dfe6e9;
}

.btn-secondary:hover {
    background: #f8f9fa;
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary);
    color: white;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 1.1rem;
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
}

.badge-best {
    background: #e74c3c;
    color: white;
}

.badge-grade {
    background: #E10811;
    color: white;
}

.badge-soldout {
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

.badge-storage {
    background: #e9ecef;
    color: #555;
}

.badge-premium {
    background: linear-gradient(135deg, var(--color-primary), #ff6b6b);
    color: white;
}

.badge-special {
    background: linear-gradient(135deg, #d63031, #ffb3b3);
    color: white;
}

.badge-first {
    background: linear-gradient(135deg, #ff7675, #ffe5e5);
    color: white;
}

.badge-second {
    background: linear-gradient(135deg, #fdcb6e, #fff5e6);
    color: #2d3436;
}

.badge-third {
    background: linear-gradient(135deg, #b2bec3, #ecf0f1);
    color: #2d3436;
}

/* ===== Alert ===== */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ===== Checkbox ===== */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--color-primary);
}

.checkbox-label {
    font-size: 0.9rem;
    color: #2d3436;
}

.checkbox-label a {
    color: var(--color-primary);
    text-decoration: underline;
}

/* ===== Divider ===== */
.divider {
    display: flex;
    align-items: center;
    margin: 25px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #dfe6e9;
}

.divider span {
    padding: 0 15px;
    font-size: 0.85rem;
    color: #767676;
}

/* ===== Link ===== */
.link-group {
    text-align: center;
    margin-top: 20px;
}

.link-group a {
    color: #636e72;
    font-size: 0.9rem;
}

.link-group a:hover {
    color: var(--color-primary);
}

.link-group span {
    margin: 0 10px;
    color: #dfe6e9;
}

/* ===== Mypage ===== */
.mypage-menu {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 1px solid #dfe6e9;
    padding-bottom: 15px;
}

.mypage-menu a {
    padding: 10px 20px;
    border-radius: 8px;
    color: #636e72;
    transition: all 0.2s;
}

.mypage-menu a:hover,
.mypage-menu a.active {
    background: var(--color-primary);
    color: white;
}

.info-table {
    width: 100%;
}

.info-table tr {
    border-bottom: 1px solid #f1f2f6;
}

.info-table th {
    padding: 15px;
    text-align: left;
    font-weight: 500;
    color: #636e72;
    width: 120px;
    background: #f8f9fa;
}

.info-table td {
    padding: 15px;
}

/* ===== Utilities ===== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mt-30 {
    margin-top: 30px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* ===== Accessibility Utilities ===== */
/* Visually hidden but accessible to screen readers */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border-width: 0 !important;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 1rem;
    background-color: #000;
    color: #fff;
    text-decoration: none;
}

.skip-to-content:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 1rem;
}

/* ===== Category Sidebar ===== */
.category-sidebar {
    width: 200px;
    flex-shrink: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    border-bottom: 1px solid #f1f2f6;
}

.sidebar-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 10px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    transition: color 0.2s;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: var(--color-primary);
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px;
}

.toggle-icon {
    font-size: 1.1rem;
    color: #999;
    line-height: 1;
}

.sidebar-link.active .toggle-icon {
    color: var(--color-primary);
}

.sidebar-submenu {
    list-style: none;
    padding: 0 0 8px 0;
    margin: 0;
    display: none;
}

.sidebar-item.open>.sidebar-submenu {
    display: block;
}

.sidebar-sublink {
    display: block;
    padding: 9px 10px 9px 20px;
    font-size: 0.9rem;
    color: #666;
    transition: all 0.2s;
}

.sidebar-sublink:hover {
    color: var(--color-primary);
}

.sidebar-sublink.active {
    background: var(--color-primary);
    color: white;
    border-radius: 6px;
    margin: 2px 5px;
    padding: 9px 15px;
    font-weight: 500;
}

/* 사이드바 포함 레이아웃 */
.with-sidebar {
    display: flex;
    gap: 40px;
}

.sidebar-content-area {
    flex: 1;
    min-width: 0;
}

@media (max-width: 768px) {
    .category-sidebar {
        width: 100%;
    }

    .with-sidebar {
        flex-direction: column;
        gap: 20px;
    }

    .sidebar-menu {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }

    .sidebar-item {
        border-bottom: none;
    }

    .sidebar-link {
        padding: 8px 14px;
        background: #f8f9fa;
        border-radius: 20px;
        font-size: 0.85rem;
    }

    .sidebar-link.active {
        background: var(--color-primary);
        color: white;
    }

    .sidebar-submenu {
        flex-wrap: wrap;
        gap: 5px;
        padding: 5px 0;
    }

    .sidebar-item.open>.sidebar-submenu {
        display: flex;
    }

    .sidebar-sublink {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .sidebar-sublink.active {
        margin: 0;
        padding: 6px 12px;
    }
}

@media (max-width: 768px) {

    .header-top-inner {
        height: auto;
        flex-wrap: wrap;
        padding: 15px 0;
        gap: 15px;
    }

    .search-form {
        order: 3;
        width: 100%;
        max-width: 100%;
    }

    .header-utils {
        gap: 15px;
    }

    .logo-img {
        height: 45px;
    }

    /* Footer 모바일 */
    .footer-inner {
        padding: 40px 20px;
    }

    .footer-main {
        flex-direction: column;
        gap: 30px;
    }

    .footer-left,
    .footer-right {
        width: 100%;
    }

    .footer-right {
        align-items: flex-start;
    }

    .footer-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .footer-policy .divider {
        display: none;
    }

    .footer-info-columns {
        width: 100%;
        flex-direction: column;
        gap: 24px;
    }

    .footer-info-col:nth-child(1),
    .footer-info-col:nth-child(2),
    .footer-info-col:nth-child(3) {
        width: 100%;
    }

    .footer-sns {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
    }

    /* Navbar 모바일 — 가로 스크롤 */
    .header-nav {
        padding: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .header-nav::-webkit-scrollbar {
        display: none;
    }

    .header-nav-inner {
        display: flex;
        flex-wrap: nowrap;
        padding: 0 12px;
        gap: 0;
        width: max-content;
        min-width: 100%;
    }

    .header-nav a {
        padding: 11px 14px;
        font-size: 0.85rem;
        white-space: nowrap;
    }
}