/* ==========================================================================
   레시피 찾기 기본 스타일시트 (style.css)
   - 모바일 & PC 반응형 디자인 지원
   - 따뜻하고 정갈한 요리 테마 컬러 팔레트 적용
   ========================================================================== */

/* 1. 디자인 토큰 및 변수 설정 */
:root {
    --primary-color: #ff6b35;         /* 메인 주황/코랄 포인트 */
    --primary-hover: #fa5a20;         /* 버튼 호버 색상 */
    --primary-light: #fff2ec;         /* 연한 주황 배경색 */
    --secondary-color: #2b2d42;       /* 진한 텍스트/헤더 색상 */
    --text-muted: #6c757d;            /* 보조 안내 텍스트 */
    --bg-page: #f9f9fb;               /* 페이지 전체 배경 */
    --bg-card: #ffffff;               /* 카드 및 컨테이너 배경 */
    --border-color: #e9ecef;          /* 기본 구분선 */
    --border-focus: #ff6b35;          /* 포커스 테두리 */
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.1);

    --font-main: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
    --transition: all 0.25s ease;
}

/* 2. 기본 리셋 및 전역 스타일 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-page);
    color: var(--secondary-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
}

input {
    font-family: inherit;
    outline: none;
}

/* 3. 전체 레이아웃 래퍼 */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 4. 헤더 영역 스타일 */
.app-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 2.2rem 1.5rem 1.8rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: 860px;
    margin: 0 auto;
}

.logo-area {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.logo-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.app-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--secondary-color);
}

.app-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 0.2rem;
}

/* 5. 메인 콘텐츠 컨테이너 */
.main-container {
    flex: 1;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* 6. 검색 섹션 스타일 */
.search-section {
    max-width: 720px;
    margin: 0 auto 2.5rem;
}

.search-form {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.search-input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.15);
}

.search-icon {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-right: 0.6rem;
}

.search-input {
    width: 100%;
    border: none;
    padding: 0.85rem 0;
    font-size: 1.05rem;
    background: transparent;
    color: var(--secondary-color);
}

.search-input::placeholder {
    color: #adb5bd;
    font-size: 0.95rem;
}

.clear-btn {
    color: #adb5bd;
    font-size: 1rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.clear-btn:hover {
    color: var(--secondary-color);
    background-color: #f1f3f5;
}

.search-btn {
    background-color: var(--primary-color);
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 0 1.8rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
    transition: var(--transition);
    white-space: nowrap;
}

.search-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.38);
}

.search-btn:active {
    transform: translateY(0);
}

/* 추천 검색어 태그 칩 */
.quick-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-left: 0.4rem;
}

.quick-tags-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-chip {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
    background-color: var(--primary-light);
    border: 1px solid rgba(255, 107, 53, 0.2);
    border-radius: var(--radius-full);
    padding: 0.3rem 0.75rem;
    transition: var(--transition);
}

.tag-chip:hover {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* 7. 상태별 콘텐츠 스타일 */

/* 7-1. 검색 전 초기 안내 박스 */
.guide-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    max-width: 680px;
    margin: 1.5rem auto 0;
}

.guide-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    display: inline-block;
    animation: gentleBounce 2.5s infinite ease-in-out;
}

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

.guide-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 0.7rem;
    letter-spacing: -0.02em;
}

.guide-description {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 2rem;
}

.guide-tips {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    text-align: left;
    background-color: #fafbfc;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem 1.4rem;
    max-width: 520px;
    margin: 0 auto;
}

.tip-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: #495057;
}

.tip-badge {
    background-color: var(--primary-color);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

/* 7-2. 로딩 스피너 박스 */
.loading-box {
    text-align: center;
    padding: 4rem 1rem;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--primary-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1.2rem;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* 7-3. 검색 결과 컨테이너 & 헤더 */
.results-container {
    animation: fadeIn 0.3s ease-in-out;
}

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

.results-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--border-color);
}

.results-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.highlight-text {
    color: var(--primary-color);
}

.count-badge {
    font-size: 0.88rem;
    font-weight: 600;
    color: #495057;
    background-color: #e9ecef;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
}

/* 7-4. 레시피 카드 그리드 */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1.5rem;
}

/* 레시피 개별 카드 */
.recipe-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 107, 53, 0.3);
}

/* 카드 이미지/썸네일 배너 */
.card-thumbnail {
    position: relative;
    height: 180px;
    background: linear-gradient(135deg, #fff3e6 0%, #ffe0cc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    user-select: none;
    overflow: hidden;
}

.card-thumbnail img.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.recipe-card:hover .card-thumbnail img.card-img {
    transform: scale(1.04);
}

.card-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: rgba(255, 255, 255, 0.95);
    color: var(--primary-color);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    z-index: 2;
}

.card-way {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: rgba(43, 45, 66, 0.85);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    z-index: 2;
}

/* 카드 바디 */
.card-body {
    padding: 1.3rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 0.45rem;
    line-height: 1.4;
}

.card-desc {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-bottom: 1.1rem;
    line-height: 1.5;
    flex: 1;
    /* 2줄 말줄임 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 카드 메타 정보 (시간, 난이도 등) */
.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.8rem;
    border-top: 1px solid #f1f3f5;
    margin-bottom: 1.1rem;
    font-size: 0.85rem;
    color: #495057;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 500;
}

/* 카드 액션 버튼 */
.card-action-btn {
    width: 100%;
    background-color: #fafbfc;
    border: 1px solid var(--border-color);
    color: var(--secondary-color);
    font-size: 0.92rem;
    font-weight: 600;
    padding: 0.65rem 0;
    border-radius: var(--radius-md);
    transition: var(--transition);
    text-align: center;
}

.recipe-card:hover .card-action-btn {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

/* 7-5. 검색 결과 없음 안내 */
.no-results-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3.5rem 1.5rem;
    text-align: center;
    max-width: 560px;
    margin: 2rem auto;
    box-shadow: var(--shadow-sm);
}

.no-results-icon {
    font-size: 3.2rem;
    margin-bottom: 1rem;
    opacity: 0.85;
}

.no-results-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.no-results-description {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* 7-6. API 오류 안내 박스 */
.api-error-box {
    background-color: var(--bg-card);
    border: 1px solid #ffccd5;
    border-radius: var(--radius-lg);
    padding: 3.2rem 1.8rem;
    text-align: center;
    max-width: 620px;
    margin: 2rem auto;
    box-shadow: var(--shadow-sm);
}

.api-error-icon {
    font-size: 3.2rem;
    margin-bottom: 0.8rem;
}

.api-error-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #d90429;
    margin-bottom: 0.6rem;
}

.api-error-description {
    font-size: 0.95rem;
    color: #495057;
    line-height: 1.6;
    margin-bottom: 1.2rem;
}

.api-error-help {
    background-color: #fff0f3;
    border: 1px solid #ffccd5;
    border-radius: var(--radius-md);
    padding: 1.1rem 1.3rem;
    margin-bottom: 1.5rem;
    font-size: 0.88rem;
    color: #590d22;
    text-align: left;
    line-height: 1.6;
}

.api-error-help code {
    background: #ffe3e8;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    font-family: monospace;
}

.retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background-color: var(--primary-color);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.75rem 1.6rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.retry-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

/* 8. 푸터 영역 스타일 */
.app-footer {
    background-color: #f1f3f5;
    border-top: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    text-align: center;
    margin-top: auto;
}

.footer-content {
    max-width: 720px;
    margin: 0 auto;
}

.footer-text {
    font-size: 0.92rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.3rem;
}

.footer-subtext {
    font-size: 0.82rem;
    color: #868e96;
}

/* 9. 레시피 상세 모달 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
    animation: fadeIn 0.2s ease-out;
}

.modal-card {
    position: relative;
    background: #ffffff;
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scaleUp 0.25s ease-out;
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #495057;
    z-index: 10;
    transition: var(--transition);
}

.modal-close-btn:hover {
    background: #f1f3f5;
    color: #000;
}

.modal-content {
    overflow-y: auto;
    padding: 2.2rem;
}

.modal-header-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    background-color: #f8f9fa;
}

.modal-title-area {
    margin-bottom: 1.4rem;
}

.modal-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.modal-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 700;
}

.badge-cat {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.badge-way {
    background-color: #e9ecef;
    color: #495057;
}

.modal-title {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--secondary-color);
}

.modal-nutrition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.6rem;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.8rem;
    text-align: center;
}

.nutrition-item .label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.nutrition-item .value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.modal-section {
    margin-bottom: 2rem;
}

.modal-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--secondary-color);
    border-left: 4px solid var(--primary-color);
    padding-left: 0.6rem;
    margin-bottom: 0.8rem;
}

.ingredients-box {
    background: #fffbf7;
    border: 1px solid #ffe8cc;
    border-radius: var(--radius-md);
    padding: 1.2rem;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #343a40;
    white-space: pre-wrap;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.step-card {
    display: flex;
    gap: 1rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    align-items: flex-start;
}

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

.step-text {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #343a40;
}

.step-img {
    width: 130px;
    height: 95px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.tip-box {
    background-color: #e7f5ff;
    border: 1px solid #d0ebff;
    border-radius: var(--radius-md);
    padding: 1.1rem 1.3rem;
    font-size: 0.9rem;
    color: #1864ab;
    line-height: 1.6;
}

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

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* 9. 반응형 미디어 쿼리 (모바일 화면 최적화) */
@media (max-width: 768px) {
    .app-header {
        padding: 1.6rem 1rem 1.4rem;
    }

    .app-title {
        font-size: 1.65rem;
    }

    .app-subtitle {
        font-size: 0.9rem;
    }

    .main-container {
        padding: 1.5rem 1rem 3rem;
    }

    .search-form {
        flex-direction: row;
        gap: 0.5rem;
    }

    .search-input {
        font-size: 0.95rem;
        padding: 0.75rem 0;
    }

    .search-btn {
        padding: 0 1.2rem;
        font-size: 0.95rem;
    }

    .quick-tags {
        padding-left: 0.2rem;
    }

    .guide-box {
        padding: 2.5rem 1.2rem;
    }

    .guide-title {
        font-size: 1.25rem;
    }

    .recipe-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
}
