/*
 * 파일명: style.css
 * 위치: /home/tarkr/public_html/assets/css/
 * 기능: TAR.KR 메인 스타일 (리팩토링)
 * 작성일: 2026-01-21
 * 수정일: 2026-01-21 - 디자인 리팩토링
 */

:root {
    --primary-color: #f5a623;
    --primary-dark: #e6951a;
    --secondary-color: #2d3436;
    --accent-color: #ff6b6b;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-light: #b2bec3;
    --border-color: #dfe6e9;
    --footer-bg: #2d3436;
    --coupang-blue: #00a0e0;
    --coupang-red: #e4002b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
    background-color: #e0e0e0;
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: 70px;
}

/* 앱 컨테이너 - PC에서 480px 고정, 모바일 100% */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    background-color: var(--bg-color);
    min-height: 100vh;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.15);
    position: relative;
}

/* ===================================
   헤더 (오렌지 그라데이션)
   =================================== */
.app-header {
    background: linear-gradient(135deg, #f5a623 0%, #f7b844 50%, #f9c76b 100%);
    color: var(--text-primary);
    padding: 10px 20px;
    position: relative;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

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

.logo span {
    color: var(--secondary-color);
}

.header-date {
    font-size: 0.8rem;
    color: var(--text-primary);
    opacity: 0.8;
}

.header-desc {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.0;
}

/* 헤더 버튼 */
.header-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--secondary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.header-btn:hover {
    background: #1e272e;
    transform: translateY(-2px);
}

.header-btn svg {
    width: 16px;
    height: 16px;
}

/* ===================================
   파트너스 고지 문구
   =================================== */
.partners-notice-bar {
    background: var(--footer-bg);
    color: var(--primary-color);
    padding: 12px 20px;
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.5;
}

/* ===================================
   탭 메뉴
   =================================== */
.tab-menu {
    display: flex;
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 0;
}

.tab-btn {
    flex: 1;
    padding: 14px 10px;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn:hover {
    background: #fef9f0;
}

/* ===================================
   상품 섹션
   =================================== */
.products-section {
    padding: 20px 15px;
    background: var(--bg-color);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.section-title .icon {
    font-size: 1.2rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* ===================================
   상품 카드
   =================================== */
.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #f5f5f5;
}

.product-info {
    padding: 12px;
}

.product-name {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.product-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.original-price {
    font-size: 0.75rem;
    color: var(--text-light);
    text-decoration: line-through;
}

.sale-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-color);
}

.discount-rate {
    display: inline-block;
    background: var(--accent-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 5px;
}

.product-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.7rem;
    color: var(--coupang-blue);
    margin-top: 6px;
}

.product-badge svg {
    width: 14px;
    height: 14px;
}

/* ===================================
   로딩 스피너
   =================================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===================================
   에러 메시지
   =================================== */
.error-message {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-secondary);
}

.error-message .icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* ===================================
   하단 고정 메뉴
   =================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--footer-bg);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.7rem;
    padding: 1px 15px;
    transition: color 0.2s ease;
    gap: 4px;
}

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

.nav-item svg {
    width: 22px;
    height: 22px;
}

.nav-item.coupang-btn {
    background: var(--primary-color);
    color: var(--text-primary);
    border-radius: 25px;
    padding: 12px 28px;
    margin: -5px 0;
    font-weight: 700;
    font-size: 1.1rem; /* 쿠팡 폰트 조정 */
}

.nav-item.coupang-btn:hover {
    background: var(--primary-dark);
    color: var(--text-primary);
}

/* ===================================
   PWA 설치 배너
   =================================== */
.pwa-install-banner {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #1e272e 100%);
    color: white;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-100%); }
    to { transform: translateX(-50%) translateY(0); }
}

.pwa-install-content {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    gap: 12px;
}

.pwa-install-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.pwa-install-text {
    flex: 1;
    min-width: 0;
}

.pwa-install-text strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.pwa-install-text small {
    font-size: 0.75rem;
    opacity: 0.85;
}

.pwa-install-btn {
    background: var(--primary-color);
    color: var(--text-primary);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.pwa-install-btn:hover {
    transform: scale(1.05);
}

.pwa-install-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    opacity: 0.7;
    flex-shrink: 0;
}

.pwa-install-close:hover {
    opacity: 1;
}

/* ===================================
   iOS 설치 가이드 모달
   =================================== */
.ios-install-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
}

.ios-install-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

.ios-install-content {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: white;
    border-radius: 20px 20px 0 0;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(100%); }
    to { transform: translateX(-50%) translateY(0); }
}

.ios-install-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.ios-install-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
}

.ios-install-close {
    background: var(--border-color);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.ios-install-body {
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.ios-install-step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 15px;
}

.ios-install-step:last-child {
    margin-bottom: 0;
}

.step-number {
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content p {
    margin: 0 0 10px 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.step-icon {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 10px;
    display: inline-block;
}

/* ===================================
   반응형
   =================================== */
@media (max-width: 480px) {
    .app-container {
        box-shadow: none;
    }
    
    .bottom-nav {
        left: 0;
        transform: none;
    }
    
    .ios-install-content {
        max-width: 100%;
    }
}

/* 안전 영역 (노치 대응) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
}

/* ===================================
   FAQ 섹션
   =================================== */
.faq-section {
    background: #ffffff;
    padding: 25px 20px;
    margin-top: 15px;
    border-top: 1px solid #dfe6e9;
}

.faq-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3436;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.faq-title::before {
    content: '❓';
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.faq-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border-left: 3px solid #f5a623;
}

.faq-question {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 8px;
}

.faq-answer {
    font-size: 0.85rem;
    color: #636e72;
    line-height: 1.6;
    margin: 0;
}
