/* 커스텀 CSS - 배달음식 소비기한 가이드 */

/* 폰트 및 기본 설정 */
:root {
    --primary-gradient: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    --secondary-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.15);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-x: hidden;
}

/* 스크롤바 커스터마이징 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ff6b6b, #ee5a6f);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ee5a6f, #ff6b6b);
}

/* 헤더 애니메이션 */
header {
    animation: fadeInDown 0.8s ease-out;
}

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

/* 타이틀 그라데이션 애니메이션 */
h1 {
    background-size: 200% auto;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% center;
    }
    50% {
        background-position: 100% center;
    }
}

/* 검색창 고급 효과 */
.search-container {
    position: relative;
}

#searchInput {
    transition: var(--transition-smooth);
    position: relative;
}

#searchInput:focus {
    transform: scale(1.02);
    box-shadow: 0 10px 40px rgba(255, 107, 107, 0.2);
}

/* 검색 아이콘 펄스 효과 */
.search-icon {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* 카드 개선 */
.food-card {
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.food-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.food-card:hover::before {
    left: 100%;
}

.food-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--card-shadow-hover);
}

/* 이모지 호버 효과 */
.emoji-icon {
    display: inline-block;
    transition: var(--transition-smooth);
}

.food-card:hover .emoji-icon {
    transform: scale(1.2) rotate(10deg);
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.2));
}

/* 카테고리 배지 효과 */
.category-badge {
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.category-badge::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.food-card:hover .category-badge::after {
    width: 200px;
    height: 200px;
}

/* 보관 기한 카드 애니메이션 */
.storage-info {
    transition: var(--transition-smooth);
}

.storage-info:hover {
    transform: scale(1.05);
}

/* 팁 박스 효과 */
.tip-box {
    position: relative;
    transition: var(--transition-smooth);
}

.tip-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary-gradient);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.food-card:hover .tip-box::before {
    transform: scaleY(1);
}

/* 그리드 아이템 스태거 애니메이션 */
.food-card {
    animation: fadeInUp 0.5s ease-out backwards;
}

.food-card:nth-child(1) { animation-delay: 0.1s; }
.food-card:nth-child(2) { animation-delay: 0.2s; }
.food-card:nth-child(3) { animation-delay: 0.3s; }
.food-card:nth-child(4) { animation-delay: 0.4s; }
.food-card:nth-child(5) { animation-delay: 0.5s; }
.food-card:nth-child(6) { animation-delay: 0.6s; }
.food-card:nth-child(7) { animation-delay: 0.7s; }
.food-card:nth-child(8) { animation-delay: 0.8s; }
.food-card:nth-child(9) { animation-delay: 0.9s; }
.food-card:nth-child(10) { animation-delay: 1s; }
.food-card:nth-child(11) { animation-delay: 1.1s; }
.food-card:nth-child(12) { animation-delay: 1.2s; }

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

/* 빈 상태 애니메이션 */
.empty-state {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 로딩 스피너 */
.loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #ff6b6b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 카테고리 필터 버튼 스타일 */
.filter-btn {
    padding: 10px 20px;
    border: 2px solid transparent;
    border-radius: 25px;
    background: white;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.filter-btn.active {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border-color: #ff6b6b;
}

/* 툴팁 스타일 */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

/* 반응형 개선 */
@media (max-width: 768px) {
    .food-card {
        animation-delay: 0s !important;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    #searchInput {
        font-size: 16px; /* iOS 줌 방지 */
    }
}

/* 다크모드 지원 준비 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a202c;
        --text-color: #e2e8f0;
        --card-bg: rgba(45, 55, 72, 0.95);
    }
}

/* 접근성 개선 */
.focus-visible:focus {
    outline: 3px solid #ff6b6b;
    outline-offset: 2px;
}

/* 프린트 스타일 */
@media print {
    .search-container,
    footer {
        display: none;
    }
    
    .food-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
