/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #FF6900;
    --primary-dark: #D45800;
    --primary-glow: rgba(255, 105, 0, 0.12);
    --bg: #E89E60;
    --surface: rgba(255, 255, 255, 0.55);
    --surface-hover: rgba(255, 255, 255, 0.65);
    --text: #1A1108;
    --text-secondary: #6B4E30;
    --border: rgba(120, 70, 20, 0.12);
    --shadow: 0 2px 8px rgba(100, 60, 20, 0.10);
    --shadow-lg: 0 8px 32px rgba(100, 60, 20, 0.18);
    --radius: 14px;
    --radius-sm: 10px;
    --header-height: 52px;
    --menu-width: 300px;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
    background: #E89E60;
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        radial-gradient(ellipse 90% 80% at 40% 40%, #FDE8D0, transparent 70%),
        radial-gradient(ellipse 70% 60% at 60% 50%, #F5C48A, transparent 65%),
        radial-gradient(ellipse 120% 100% at 50% 50%, #EDAA6E, #E09050);
}

/* ===== Header ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0;
    padding-top: var(--safe-area-top);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* halo 패턴: 최상단에서는 여유있는 패딩 */
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px;
    max-width: 1200px;
    margin: 0 auto;
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 스크롤 시: glass-card 스타일 (헤더만) */
.app-header.scrolled {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px) saturate(1.8);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
    border-color: rgba(180, 120, 60, 0.12);
    border-radius: 0 0 14px 14px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.08);
}

/* 모바일 메뉴 열림 시: 헤더+드롭다운 통합 glass-card */
.app-header.menu-open {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(24px) saturate(1.8);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    border-color: rgba(180, 120, 60, 0.12);
    border-radius: 0 0 14px 14px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    padding-bottom: 16px;
}

.app-header.scrolled .header-inner,
.app-header.menu-open .header-inner {
    padding: 10px 16px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.logo-icon {
    width: 28px;
    height: 28px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.3px;
}

/* ===== Desktop Navigation (768px+) ===== */
.desktop-nav {
    display: none;
    align-items: center;
    gap: 32px;
}

.desktop-nav-item {
    padding: 6px 0;
    color: var(--text);
    opacity: 0.8;
    font-size: 14px;
    font-weight: 500;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.3s;
    white-space: nowrap;
}

.desktop-nav-item:hover {
    opacity: 1;
}

.desktop-nav-item.active {
    color: var(--primary);
    opacity: 1;
    font-weight: 600;
}

/* ===== Hamburger Button (모바일 전용) ===== */
.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    gap: 5px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.hamburger-btn:hover {
    background: rgba(0,0,0,0.06);
}

.hamburger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: #2A1A08;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.hamburger-btn.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-btn.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ===== Mobile Dropdown Menu ===== */
.mobile-menu {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.mobile-menu.active {
    display: block;
    animation: menuSlideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: top center;
}

/* 헤더 glass 내부 드롭다운 — 별도 glass 없이 헤더와 통합 */
.mobile-menu-inner {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    padding: 12px;
    overflow: hidden;
}

@keyframes menuSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.menu-body {
    padding: 4px 0;
}

/* halo 패턴: 모바일 메뉴 항목 stagger slide-down */
.mobile-menu.active .menu-item {
    animation: menuSlideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.menu-category {
    padding: 4px 0;
}

.menu-category + .menu-category {
    border-top: 1px solid rgba(180, 120, 60, 0.1);
    margin-top: 4px;
    padding-top: 8px;
}

.menu-category-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    padding: 4px 8px 0;
    opacity: 0.7;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    border-radius: 10px;
}

.menu-item:hover {
    color: var(--primary);
    transform: translateX(8px);
}

.menu-item.active {
    color: var(--primary);
    font-weight: 600;
}

.menu-item-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-item-icon svg {
    width: 20px;
    height: 20px;
}

/* ===== Responsive: Desktop ===== */
@media (min-width: 768px) {
    .desktop-nav {
        display: flex;
    }
    .hamburger-btn {
        display: none;
    }
    .mobile-menu {
        display: none !important;
    }
}

/* ===== Main Content ===== */
.app-main {
    padding-top: calc(68px + var(--safe-area-top));
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== Banner ===== */
.banner-section {
    padding: 12px 16px 0;
}

.banner-carousel {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: rgba(255,255,255,0.3);
    box-shadow: 0 4px 20px rgba(100, 60, 20, 0.12);
}

.banner-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    height: 100%;
    will-change: transform;
}

.banner-slide {
    min-width: 100%;
    position: relative;
    overflow: hidden;
}

.banner-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.banner-slide-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 20px 16px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    color: white;
}

.banner-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 4px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.banner-subtitle {
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.4;
}

.banner-indicators {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
    transition: filter 0.4s ease;
}

.banner-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                border-radius 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.35s ease;
    cursor: pointer;
}

.banner-indicator:hover {
    transform: scale(1.3);
}

.banner-indicator.active {
    background: white;
    width: 20px;
    border-radius: 3px;
}

/* Light slide theme: dark indicators & nav */
.banner-theme-light .banner-indicator {
    background: rgba(25, 25, 25, 0.3);
}
.banner-theme-light .banner-indicator.active {
    background: #191919;
}
.banner-theme-light .banner-nav {
    background: rgba(25, 25, 25, 0.15);
    color: #191919;
}
.banner-theme-light .banner-nav:hover {
    background: rgba(25, 25, 25, 0.3);
}

/* Dark slide theme: light indicators & nav (default) */
.banner-theme-dark .banner-indicator {
    background: rgba(255, 255, 255, 0.5);
}
.banner-theme-dark .banner-indicator.active {
    background: #fff;
}
.banner-theme-dark .banner-nav {
    background: rgba(255, 255, 255, 0.85);
    color: #000;
}
.banner-theme-dark .banner-nav:hover {
    background: rgba(255, 255, 255, 0.95);
}

.banner-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) scale(0.85);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    color: #000;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.2s ease, box-shadow 0.2s ease;
    opacity: 0;
}

.banner-carousel:hover .banner-nav {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.banner-nav:hover {
    background: rgba(255,255,255,0.95);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transform: translateY(-50%) scale(1.08);
}

.banner-nav:active {
    transform: translateY(-50%) scale(0.95);
}

/* Touch devices: always show nav buttons */
@media (hover: none) {
    .banner-nav {
        opacity: 0.7;
        transform: translateY(-50%) scale(1);
    }
}

.banner-prev { left: 8px; }
.banner-next { right: 8px; }

/* ===== Products ===== */
.products-section {
    padding: 20px 16px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.section-badge {
    font-size: 11px;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.product-card {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(100, 60, 20, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    will-change: transform;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(100, 60, 20, 0.18);
    border-color: rgba(255, 105, 0, 0.3);
}

.product-card:active {
    transform: translateY(-1px) scale(0.98);
    transition-duration: 0.1s;
}

.product-card-img {
    width: 100%;
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 12px;
}

.product-card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-card-body {
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(120, 70, 20, 0.08);
}

.product-card-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-price {
    font-size: 13px;
    color: #C84E00;
    font-weight: 700;
}

.product-card-badge {
    display: inline-block;
    font-size: 10px;
    background: rgba(200, 78, 0, 0.12);
    color: #C84E00;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 600;
    margin-top: 4px;
}

/* ===== Loading ===== */
.loading-skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.3) 25%, rgba(255,255,255,0.5) 50%, rgba(255,255,255,0.3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Safe Area ===== */
.safe-area-bottom {
    height: var(--safe-area-bottom);
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .banner-carousel {
        /* height driven by aspect-ratio in mi-banner-vars.css */
    }

    .banner-title {
        font-size: 24px;
    }

    .banner-nav {
        width: 40px;
        height: 40px;
        font-size: 22px;
    }
}

@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 16px;
    }

    .banner-section {
        padding: 16px 16px 0;
    }
}

/* ===== Entrance Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.banner-section {
    animation: fadeInUp 0.5s ease-out;
}

.section-header {
    animation: fadeInUp 0.5s ease-out 0.15s both;
}

.product-card {
    animation: fadeInUp 0.4s ease-out both;
}

/* Stagger product card entrance */
.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.15s; }
.product-card:nth-child(3) { animation-delay: 0.2s; }
.product-card:nth-child(4) { animation-delay: 0.25s; }
.product-card:nth-child(5) { animation-delay: 0.3s; }
.product-card:nth-child(6) { animation-delay: 0.35s; }
.product-card:nth-child(n+7) { animation-delay: 0.4s; }

/* ===== Side Menu Transitions ===== */
.side-menu .menu-item {
    transition: background 0.15s, transform 0.15s ease;
}

.side-menu .menu-item:active {
    transform: scale(0.97);
}

/* ===== Scrollbar ===== */
.menu-body::-webkit-scrollbar {
    width: 4px;
}

.menu-body::-webkit-scrollbar-track {
    background: transparent;
}

.menu-body::-webkit-scrollbar-thumb {
    background: rgba(120, 70, 20, 0.15);
    border-radius: 2px;
}
