/* ============================================
   유튜브 레시피 — 프리미엄 디자인 시스템
   색상: 딥레드 #E74C3C / 차콜 #2C3E50 / 화이트 #FDFCFA
   ============================================ */

/* 리셋 + 기본 */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #FDFCFA;
    --card: #FFFFFF;
    --red: #E74C3C;
    --red-light: #FF7675;
    --red-bg: #FFF0EF;
    --charcoal: #2C3E50;
    --text: #2D2D2D;
    --text-sub: #7F8C8D;
    --text-light: #BDC3C7;
    --border: #F0EEEB;
    --shadow: 0 2px 12px rgba(44,62,80,0.06);
    --shadow-lg: 0 8px 32px rgba(44,62,80,0.1);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --font: 'Noto Sans KR', 'Inter', -apple-system, sans-serif;
    --max-width: 480px;
    --nav-height: 64px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    max-width: var(--max-width);
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    padding-bottom: calc(var(--nav-height) + 16px);
}

/* ============================================
   헤더
   ============================================ */
.header {
    padding: 20px 20px 8px;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.logo-icon { display: flex; }

.logo-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--charcoal);
    letter-spacing: -0.5px;
}

.tagline {
    font-size: 0.75rem;
    color: var(--text-sub);
    margin-top: 4px;
    font-weight: 400;
}

/* ============================================
   검색바
   ============================================ */
.search-container { padding: 12px 20px 4px; }

.search-bar {
    display: flex;
    align-items: center;
    background: #F5F3F0;
    border-radius: 999px;
    padding: 4px 4px 4px 18px;
    transition: var(--transition);
    border: 2px solid transparent;
}

.search-bar:focus-within {
    border-color: var(--red);
    background: white;
    box-shadow: 0 0 0 4px rgba(231,76,60,0.08);
}

.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    font-family: var(--font);
    color: var(--text);
    outline: none;
}

.search-bar input::placeholder { color: var(--text-light); }

.search-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--red);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.search-btn:hover { background: #C0392B; transform: scale(1.05); }
.search-btn:active { transform: scale(0.95); }

/* ============================================
   섹션 헤더
   ============================================ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 12px;
}

.section-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--charcoal);
}

.see-more {
    font-size: 0.8rem;
    color: var(--red);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.see-more:hover { color: #C0392B; }

/* ============================================
   로딩 애니메이션
   ============================================ */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
}

.loading.hidden { display: none; }

.loading-animation { text-align: center; }

.cooking-pot { position: relative; font-size: 3rem; margin-bottom: 16px; }

.steam {
    position: absolute;
    color: var(--text-light);
    font-size: 1.2rem;
    opacity: 0;
    animation: steamRise 2s ease-in-out infinite;
}

.steam-1 { top: -10px; left: 30%; animation-delay: 0s; }
.steam-2 { top: -10px; left: 50%; animation-delay: 0.5s; }
.steam-3 { top: -10px; left: 70%; animation-delay: 1s; }

@keyframes steamRise {
    0% { opacity: 0; transform: translateY(0) scale(0.8); }
    40% { opacity: 0.6; }
    100% { opacity: 0; transform: translateY(-30px) scale(1.3); }
}

.loading-text {
    font-size: 0.9rem;
    color: var(--text-sub);
    font-weight: 500;
}

/* ============================================
   레시피 피드
   ============================================ */
.recipe-feed { padding: 0 20px; }

/* 히어로 카드 (1번) */
.recipe-card-hero {
    background: var(--card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    cursor: pointer;
    transition: var(--transition);
    animation: cardAppear 0.5s ease-out both;
}

.recipe-card-hero:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.hero-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    overflow: hidden;
}

.hero-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.recipe-card-hero:hover .hero-image-container img { transform: scale(1.05); }

.hero-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(transparent, rgba(255,255,255,0.9));
}

.rank-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    background: var(--red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(231,76,60,0.3);
}

.heart-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
}

.heart-btn:hover { transform: scale(1.15); }
.heart-btn.liked { background: var(--red); }
.heart-btn.liked::after { filter: brightness(10); }

.hero-info {
    padding: 16px 20px 20px;
}

.hero-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--charcoal);
    margin-bottom: 6px;
    line-height: 1.4;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-sub);
}

.hero-meta .channel { font-weight: 600; color: var(--text); }
.hero-meta .dot { color: var(--text-light); }

/* 그리드 카드 (2, 3번) */
.recipe-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.recipe-card-grid {
    background: var(--card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    animation: cardAppear 0.5s ease-out both;
}

.recipe-card-grid:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.grid-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
}

.grid-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.recipe-card-grid:hover .grid-image-container img { transform: scale(1.05); }

.grid-info { padding: 12px 14px 14px; }

.grid-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grid-meta {
    font-size: 0.7rem;
    color: var(--text-sub);
}

/* 리스트 카드 (4번~) */
.recipe-card-list {
    display: flex;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition);
    animation: cardAppear 0.5s ease-out both;
}

.recipe-card-list:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-lg);
}

.list-image-container {
    position: relative;
    width: 110px;
    min-height: 90px;
    flex-shrink: 0;
    overflow: hidden;
}

.list-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-rank {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 24px;
    height: 24px;
    background: var(--red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.7rem;
}

.list-info {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.list-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 4px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-meta {
    font-size: 0.72rem;
    color: var(--text-sub);
}

/* 카드 등장 애니메이션 */
@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   하단 네비게이션
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
    height: var(--nav-height);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 0.65rem;
    font-family: var(--font);
    font-weight: 500;
    transition: var(--transition);
    padding: 8px 16px;
}

.nav-item.active { color: var(--red); }
.nav-item:hover { color: var(--red-light); }

/* ============================================
   레시피 상세 오버레이
   ============================================ */
.detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    overflow-y: auto;
    transition: var(--transition);
}

.detail-overlay.hidden {
    display: none;
}

.detail-container {
    max-width: var(--max-width);
    margin: 0 auto;
    background: var(--bg);
    min-height: 100vh;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.detail-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    overflow: hidden;
}

.detail-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(transparent, var(--bg));
}

.detail-back {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.detail-back:hover { background: rgba(0,0,0,0.5); }

.detail-hero-actions {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
}

.hero-action-btn {
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-content { padding: 0 20px 40px; margin-top: -20px; position: relative; }

.detail-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--charcoal);
    line-height: 1.3;
    margin-bottom: 12px;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.detail-channel {
    display: flex;
    align-items: center;
    gap: 8px;
}

.channel-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--red-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--red);
}

.detail-channel span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.detail-views {
    font-size: 0.8rem;
    color: var(--text-sub);
}

.youtube-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--red);
    color: white;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    margin-bottom: 16px;
}

.youtube-btn:hover { background: #C0392B; transform: translateY(-1px); }

.detail-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tag {
    padding: 6px 14px;
    background: #F5F3F0;
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--text-sub);
    font-weight: 500;
}

.detail-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 12px 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-sub);
    cursor: pointer;
    transition: var(--transition);
}

.tab.active {
    color: var(--red);
    border-bottom-color: var(--red);
    font-weight: 700;
}

.steps-placeholder { padding-bottom: 20px; }

.step-card {
    display: flex;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.step-card:last-child { border-bottom: none; }

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

.step-card p {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.6;
    padding-top: 2px;
}

/* ============================================
   반응형 (데스크탑)
   ============================================ */
@media (min-width: 768px) {
    body {
        max-width: 520px;
        box-shadow: var(--shadow-lg);
        min-height: 100vh;
    }
}

/* ============================================
   유틸리티
   ============================================ */
.hidden { display: none !important; }

/* 스크롤바 스타일 */
::-webkit-scrollbar { width: 0; }
body { scrollbar-width: none; }

/* ============================================
   스플래시 화면
   ============================================ */
.splash {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.splash.fade-out { opacity: 0; visibility: hidden; }

.splash-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    animation: splashBounce 0.6s ease-out;
}

.splash-logo svg { animation: splashSpin 1s ease-out; }

.splash-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--charcoal);
}

.splash-cooking {
    position: relative;
    width: 120px;
    height: 100px;
    margin-bottom: 20px;
}

/* 프라이팬 요리 애니메이션 */
.frying-pan {
    font-size: 3.5rem;
    animation: panShake 1.5s ease-in-out infinite;
}

.food-particle {
    position: absolute;
    font-size: 1.2rem;
    opacity: 0;
}

.food-particle:nth-child(2) { animation: foodFly1 2s ease-out 0.3s infinite; }
.food-particle:nth-child(3) { animation: foodFly2 2s ease-out 0.8s infinite; }
.food-particle:nth-child(4) { animation: foodFly3 2s ease-out 1.3s infinite; }

@keyframes panShake {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

@keyframes foodFly1 {
    0% { opacity: 0; transform: translate(40px, 30px) scale(0.5); }
    30% { opacity: 1; transform: translate(55px, -15px) scale(1); }
    100% { opacity: 0; transform: translate(70px, -40px) scale(0.3); }
}

@keyframes foodFly2 {
    0% { opacity: 0; transform: translate(50px, 25px) scale(0.5); }
    30% { opacity: 1; transform: translate(45px, -20px) scale(1); }
    100% { opacity: 0; transform: translate(35px, -45px) scale(0.3); }
}

@keyframes foodFly3 {
    0% { opacity: 0; transform: translate(60px, 35px) scale(0.5); }
    30% { opacity: 1; transform: translate(65px, -10px) scale(1); }
    100% { opacity: 0; transform: translate(80px, -35px) scale(0.3); }
}

@keyframes splashBounce {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes splashSpin {
    0% { transform: rotate(-180deg) scale(0); }
    100% { transform: rotate(0) scale(1); }
}

.splash-text {
    font-size: 0.85rem;
    color: var(--text-sub);
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   하트 팝업 애니메이션
   ============================================ */
.heart-pop {
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: 2rem;
    pointer-events: none;
    animation: heartPop 0.6s ease-out forwards;
}

@keyframes heartPop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
    100% { transform: translate(-50%, -80%) scale(0.8); opacity: 0; }
}

/* ============================================
   요리 단계 애니메이션 아이콘
   ============================================ */
.step-cooking-icon {
    display: inline-block;
    animation: cookBounce 1.5s ease-in-out infinite;
}

@keyframes cookBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* 불꽃 아이콘 */
.flame-icon {
    display: inline-block;
    animation: flameFlicker 0.8s ease-in-out infinite alternate;
}

@keyframes flameFlicker {
    0% { transform: scale(1) rotate(-3deg); filter: brightness(1); }
    100% { transform: scale(1.1) rotate(3deg); filter: brightness(1.2); }
}

/* 타이머 링 애니메이션 */
.timer-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid var(--border);
    border-top-color: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px auto;
    animation: timerSpin 3s linear infinite;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--charcoal);
}

@keyframes timerSpin {
    from { border-top-color: var(--red); border-right-color: var(--border); }
    25% { border-right-color: var(--red); }
    50% { border-bottom-color: var(--red); }
    75% { border-left-color: var(--red); }
    to { border-top-color: var(--red); }
}

/* 진행 바 애니메이션 */
.cooking-progress {
    height: 3px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin: 8px 0;
}

.cooking-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--red), var(--red-light));
    border-radius: 999px;
    animation: progressSlide 2s ease-in-out infinite;
}

@keyframes progressSlide {
    0% { width: 0; }
    50% { width: 70%; }
    100% { width: 100%; }
}
