/* ============================================================
   Soojip Mobile — 공통 CSS
   /mobile/_css/mobile_common.css
   ============================================================ */

/* ── 1. CSS 변수 (디자인 토큰) ─────────────────────────────── */
:root {
    /* 브랜드 컬러 */
    --primary: #C9A96E;
    /* 골드 */
    --primary-light: #E8D5B0;
    --primary-deep: #8B6914;
    /* 다크 골드 */
    --accent: #2D2D2D;
    /* 거의 검정 */
    --cream: #FAF7F2;
    /* 크림 배경 */

    /* 텍스트 */
    --text-primary: #1A1A1A;
    --text-secondary: #555555;
    --text-muted: #888888;
    --text-light: #BBBBBB;

    /* 배경 */
    --bg-primary: #FFFFFF;
    --bg-secondary: #FAF7F2;
    --bg-card: #FFFFFF;
    --bg-input: #F8F8F8;

    /* 경계선 */
    --border: #E8E8E8;
    --border-focus: var(--primary);

    /* 상태 컬러 */
    --success: #22C55E;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;

    /* 그림자 */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.14);

    /* 간격 */
    --gap-xs: 4px;
    --gap-sm: 8px;
    --gap-md: 16px;
    --gap-lg: 24px;
    --gap-xl: 40px;

    /* 라운딩 */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 999px;

    /* 헤더 높이 */
    --header-h: 56px;

    /* 전환 */
    --transition: 0.2s ease;
}

/* ── 2. 리셋 & 기본 ────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
}

img {
    max-width: 100%;
    display: block;
}

ul,
ol {
    list-style: none;
}

/* ── 3. 사이트 헤더 ────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    height: var(--header-h);
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 var(--gap-md);
    max-width: 600px;
    margin: 0 auto;
}

.site-logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-deep);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.site-nav {
    display: flex;
    gap: var(--gap-md);
}

.site-nav a {
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: color var(--transition);
}

.site-nav a:hover {
    color: var(--primary-deep);
}

.site-header__actions {
    display: flex;
    gap: var(--gap-sm);
}

.btn-header {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--primary);
    color: var(--primary-deep);
    transition: all var(--transition);
}

.btn-header:hover {
    background: var(--primary);
    color: #fff;
}

/* ── 4. 메인 컨텐츠 영역 ──────────────────────────────────── */
.site-main {
    min-height: calc(100vh - var(--header-h) - 160px);
    padding-bottom: var(--gap-xl);
}

/* ── 5. 푸터 ──────────────────────────────────────────────── */
.site-footer {
    background: var(--accent);
    color: rgba(255, 255, 255, 0.8);
    padding: var(--gap-lg) var(--gap-md);
    font-size: 0.8rem;
    line-height: 1.8;
}

.site-footer__inner {
    max-width: 600px;
    margin: 0 auto;
}

.site-footer__info strong {
    display: block;
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: var(--gap-sm);
    letter-spacing: 0.05em;
}

.site-footer__nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-sm) var(--gap-md);
    margin-top: var(--gap-md);
    padding-top: var(--gap-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.site-footer__nav a {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    transition: color var(--transition);
}

.site-footer__nav a:hover {
    color: var(--primary);
}

/* ── 6. 섹션 공통 ──────────────────────────────────────────── */
.section {
    padding: var(--gap-lg) var(--gap-md) 0;
    max-width: 600px;
    margin: 0 auto;
}

.products {
    padding: var(--gap-lg) var(--gap-md);
    max-width: 600px;
    margin: 0 auto;
}

/* ── 7. 폼 요소 ────────────────────────────────────────────── */
.form-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--gap-lg) var(--gap-md);
    box-shadow: var(--shadow-md);
    max-width: 480px;
    margin: var(--gap-lg) auto;
}

.form-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--gap-lg);
    text-align: center;
}

.form-group {
    margin-bottom: var(--gap-md);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--gap-xs);
}

.form-input {
    width: 100%;
    padding: 12px var(--gap-md);
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.15);
}

.form-input::placeholder {
    color: var(--text-light);
}

.form-select {
    width: 100%;
    padding: 12px var(--gap-md);
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-textarea {
    width: 100%;
    padding: 12px var(--gap-md);
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    resize: vertical;
    min-height: 120px;
    transition: border-color var(--transition);
}

.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.15);
}

.form-button {
    width: 100%;
    padding: 14px;
    background: var(--primary-deep);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), transform 0.1s;
    letter-spacing: 0.03em;
}

.form-button:hover {
    background: #6b5010;
}

.form-button:active {
    transform: scale(0.98);
}

.form-button-outline {
    width: 100%;
    padding: 13px;
    background: transparent;
    color: var(--primary-deep);
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.form-button-outline:hover {
    background: var(--primary);
    color: #fff;
}

.form-footer {
    text-align: center;
    margin-top: var(--gap-md);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.form-footer a {
    color: var(--primary-deep);
    font-weight: 500;
}

/* ── 8. 상품 그리드 ────────────────────────────────────────── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gap-md);
}

.product-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
    display: block;
    color: var(--text-primary);
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-secondary);
}

.product-image-inner {
    width: 100%;
    height: 100%;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.04);
}

.product-info {
    padding: 10px 12px 12px;
}

.product-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-deep);
}

.add-to-cart {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    padding: 5px 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background var(--transition);
}

.add-to-cart:hover {
    background: var(--primary-deep);
}

/* ── 9. 카테고리 필터 ─────────────────────────────────────── */
.filter-section {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-sm);
    margin-bottom: var(--gap-md);
}

.filter-btn {
    padding: 7px 16px;
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.875rem;
    border: 1.5px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary-deep);
}

.filter-btn.active {
    background: var(--primary-deep);
    color: #fff;
    border-color: var(--primary-deep);
    font-weight: 600;
}

/* ── 10. 브레드크럼 ────────────────────────────────────────── */
.breadcrumb {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--gap-md);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.breadcrumb a {
    color: var(--primary-deep);
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ── 11. 총 개수 표시 ─────────────────────────────────────── */
.total-count {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: var(--gap-md);
}

/* ── 12. 섹션 타이틀 ──────────────────────────────────────── */
.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--gap-md);
}

/* ── 13. 빈 상태 / 로딩 ────────────────────────────────────── */
.empty-message {
    text-align: center;
    padding: var(--gap-xl) var(--gap-md);
    color: var(--text-muted);
    font-size: 0.95rem;
    grid-column: 1 / -1;
}

/* ── 14. 더보기 버튼 ──────────────────────────────────────── */
.load-more-container {
    text-align: center;
    margin-top: var(--gap-lg);
}

.load-more-products-btn {
    padding: 12px 32px;
    background: var(--bg-primary);
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-full);
    color: var(--primary-deep);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.load-more-products-btn:hover {
    background: var(--primary-deep);
    border-color: var(--primary-deep);
    color: #fff;
}

.load-more-products-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── 15. 모달 ─────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    padding: var(--gap-md);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--gap-md) var(--gap-lg);
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-header .close {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--gap-md);
}

.modal-footer {
    padding: var(--gap-md) var(--gap-lg);
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Search Modal Styles ── */
.search-section {
    margin-bottom: var(--gap-lg);
}

.search-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--gap-sm);
}

.checkbox-group {
    display: grid;
    gap: 12px;
}

.checkbox-group.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fdfdfd;
    padding: 8px 12px;
    border: 1px solid #eee;
    border-radius: var(--radius-sm);
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-deep);
}

.checkbox-item label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    flex: 1;
}

/* ── 16. 배지 / 태그 ──────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
}

.badge-primary {
    background: var(--primary);
    color: #fff;
}

.badge-success {
    background: var(--success);
    color: #fff;
}

.badge-error {
    background: var(--error);
    color: #fff;
}

/* ── 17. 알림 / 메시지 박스 ────────────────────────────────── */
.alert {
    padding: 12px var(--gap-md);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: var(--gap-md);
}

.alert-success {
    background: #F0FDF4;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.alert-error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-warning {
    background: #FFFBEB;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.alert-info {
    background: #EFF6FF;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

/* ── 18. 탭 ───────────────────────────────────────────────── */
.tab-list {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--gap-lg);
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-list::-webkit-scrollbar {
    display: none;
}

.tab-item {
    flex-shrink: 0;
    padding: 10px var(--gap-md);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}

.tab-item.active {
    color: var(--primary-deep);
    border-bottom-color: var(--primary-deep);
    font-weight: 700;
}

/* ── 19. 카드 공통 ────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--gap-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--gap-md);
}

/* ── 20. 버튼 공통 ────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px var(--gap-lg);
    background: var(--primary-deep);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), transform 0.1s;
    text-decoration: none;
}

.btn-primary:hover {
    background: #6b5010;
    color: #fff;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px var(--gap-lg);
    background: transparent;
    color: var(--primary-deep);
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-danger {
    background: var(--error);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px var(--gap-md);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--transition);
}

.btn-danger:hover {
    background: #DC2626;
}

/* ── 21. 구분선 ───────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border);
    margin: var(--gap-md) 0;
}

/* ── 22. 헬퍼 클래스 ──────────────────────────────────────── */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-primary-color {
    color: var(--primary-deep);
}

.text-success {
    color: var(--success);
}

.text-error {
    color: var(--error);
}

.font-bold {
    font-weight: 700;
}

.font-medium {
    font-weight: 500;
}

.mt-sm {
    margin-top: var(--gap-sm);
}

.mt-md {
    margin-top: var(--gap-md);
}

.mt-lg {
    margin-top: var(--gap-lg);
}

.mb-sm {
    margin-bottom: var(--gap-sm);
}

.mb-md {
    margin-bottom: var(--gap-md);
}

.mb-lg {
    margin-bottom: var(--gap-lg);
}

.hidden {
    display: none !important;
}

/* ── 23. 스크롤바 숨김 ────────────────────────────────────── */
.scroll-x {
    overflow-x: auto;
    scrollbar-width: none;
}

.scroll-x::-webkit-scrollbar {
    display: none;
}

/* ── 24. 페이지 레이아웃 (데스크탑 중앙 정렬) ─────────────── */
@media (min-width: 640px) {

    .site-header__inner,
    .site-main,
    .section,
    .products {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ── 25. 반응형 ────────────────────────────────────────────── */
@media (max-width: 380px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--gap-sm);
    }

    .form-container {
        padding: var(--gap-md);
    }
}