/* ===== CSS 변수 정의 ===== */
:root {
    /* 기본 색상 */
    --primary-color: #4a90e2;
    --secondary-color: #f5f5f5;
    --text-color: #333;
    --border-color: #ddd;
    --hover-color: #357abd;
    
    /* 애니메이션 */
    --transition-speed: 0.3s;
    
    /* 카테고리 색상 */
    --cat-color-1: #4a90e2;
    --cat-color-2: #f5a623;
    --cat-color-3: #7ed957;
    --cat-color-4: #e94e77;
    --cat-color-5: #8f6ed5;
    --cat-color-6: #ffb347;
    --cat-color-7: #50e3c2;
    --cat-color-8: #e67e22;
    
    /* 그림자 */
    --shadow-light: 0 2px 8px rgba(0,0,0,0.07);
    --shadow-medium: 0 2px 16px rgba(0,0,0,0.08);
    --shadow-heavy: 0 4px 32px rgba(0,0,0,0.15);
    
    /* 여백 */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    
    /* 둥근 모서리 */
    --radius-sm: 0.7rem;
    --radius-md: 1.1rem;
    --radius-lg: 1.2rem;
    --radius-xl: 2rem;
}

/* ===== 기본 리셋 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    height: 140%;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ===== 성능 최적화 ===== */
img {
    max-width: 100%;
    height: auto;
    will-change: transform;
}

/* ===== 애니메이션 ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalPopIn {
    0% {
        opacity: 0;
        transform: scale(0.92) translateY(30px);
    }
    80% {
        opacity: 1;
        transform: scale(1.03) translateY(-4px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes sk-bounce {
    0%, 100% { transform: scale(0.0); }
    50% { transform: scale(1.0); }
}

.fade-in {
    animation: fadeIn var(--transition-speed) ease-in;
    will-change: opacity;
}

/* ===== 허브 레이아웃 ===== */
.hub-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-img {
    width: 100px;
    height: 100px;
    margin-bottom: 15px;
    border-radius: 50%;
    transition: transform 0.3s ease;
    cursor: pointer;
}
.logo-img:hover {
    transform: scale(1.1);
}

.main-title {
    font-size: 2.2rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    color: white;
    font-weight: 900;
    text-align: center;
    line-height: 1.1;
}

.subtitle {
    font-size: 1.15rem;
    color: #e0e0e0;
    font-weight: 400;
    margin-bottom: 0;
    text-shadow: 0 2px 6px rgba(0,0,0,0.13);
    text-align: center;
    opacity: 0.9;
    line-height: 1.5;
}

.sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.7rem;
    margin-bottom: 1.2rem;
}

.section-card {
    background: white;
    border-radius: 9px;
    padding: 0.6rem 0.9rem 0.8rem 0.9rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    transition: all 0.18s cubic-bezier(.22,1.12,.62,1.01);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.section-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.dev-notice {
    background: white;
    color: #555;
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    margin: 0 0 2rem 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid #eee;
}

.dev-notice p {
    margin: 0;
    line-height: 1.7;
}

.dev-notice p:first-child {
    font-size: 1rem;
    margin-bottom: 0.7rem;
    font-weight: 600;
    color: #333;
}

.section-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #b7bfff 0%, #aee2f8 100%);
}

.section-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #667eea;
}

.section-title {
    font-size: 1.08rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
}

.section-title .section-emoji {
    font-size: 1.18em;
    margin-right: 0.32em;
    vertical-align: middle;
    display: inline-block;
}

.section-description {
    color: #666;
    line-height: 1.5;
    margin-bottom: 0.7rem;
    font-size: 0.92rem;
}

.section-stats {
    display: flex;
    justify-content: flex-start;
    color: #888;
    font-size: 0.82rem;
    gap: 0.7rem;
    margin-top: 0.2rem;
}

.footer {
    text-align: center;
    color: white;
    font-size: 0.8em;
    opacity: 0.8;
    margin-top: auto;
    padding-top: 3rem;
}

.contact-info {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.contact-info:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.contact-info p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.contact-info p:first-child {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
}

.contact-info a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
}

.contact-info a:hover {
    color: #357abd;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* ===== 스크롤 최적화 ===== */
.toc-scroll {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

/* ===== 레이아웃 ===== */
.container, .content, .content-article {
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

.content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    contain: layout style paint;
    justify-items: center;
}

.center-content {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#main-content {
    position: relative;
    min-height: 60vh;
    width: 100%;
}

/* ===== 반응형 이미지 ===== */
.responsive-img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* ===== 지연 로딩 ===== */
.lazy-load {
    opacity: 0;
    transition: opacity var(--transition-speed) ease-in;
}

.lazy-load.loaded {
    opacity: 1;
}

/* ===== 헤더 스타일 ===== */
h1 {
    text-align: center;
    color: var(--primary-color);
}

h2 {
    color: var(--primary-color);
    margin: var(--spacing-md) 0;
    padding-bottom: var(--spacing-xs);
    border-bottom: 2px solid var(--border-color);
}

/* ===== 공통 버튼 ===== */
.btn {
    border-radius: var(--radius-xl);
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* ===== 플로팅 메뉴 ===== */
.floating-menu {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%);
    display: flex;
    gap: var(--spacing-md);
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-medium);
    padding: var(--spacing-xs) var(--spacing-lg);
    z-index: 100;
}

.floating-menu button {
    background: none;
    border: none;
    font-size: 1.7rem;
    color: var(--primary-color);
    cursor: pointer;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 50%;
    transition: background 0.2s;
}

.floating-menu button:disabled {
    color: #bbb;
    cursor: not-allowed;
}

.floating-menu button:hover:not(:disabled) {
    background: #f0f4fa;
}

/* ===== 카테고리 모달 ===== */
.category-modal {
    position: fixed;
    left: 0; top: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-modal .modal-content {
    position: relative;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-heavy);
    background: #fff;
    margin: 0;
    align-self: center;
    display: flex;
    flex-direction: column;
    min-width: 340px;
    max-width: 95vw;
    max-height: 80vh;
    overflow: hidden;
    padding: 0;
    animation: modalPopIn 0.38s cubic-bezier(.22,1.12,.62,1.01);
    will-change: opacity, transform;
}

.modal-header {
    width: 100%;
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 var(--spacing-md);
    background: #f7faff;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    border-bottom: 1px solid #e3eaf3;
    position: relative;
    z-index: 2;
}

.close-modal {
    position: static;
    margin-left: auto;
    background: #f7faff;
    border: none;
    font-size: 1.7rem;
    color: #888;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    box-shadow: 0 2px 8px rgba(74,144,226,0.08);
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    background: #e3f0ff;
    color: #e94e77;
}

.modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: var(--spacing-md) var(--spacing-md);
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    scrollbar-width: thin;
    scrollbar-color: #d0d0d0 #f7faff;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
    border-radius: 16px;
    background: #f7faff;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 16px;
}

.category-modal ul {
    list-style: none;
    padding: 0;
}

.category-modal li {
    margin-bottom: var(--spacing-xs);
}

/* ===== 카테고리 섹션 ===== */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-section {
    margin-bottom: 1.2em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #e3eaf3;
}

.cat-title {
    flex: 1;
}

.item-list {
    padding-left: 2.7rem;
    margin-top: 0.2rem;
}

.item-btn.active {
    background-color: rgba(0, 0, 0, 0.1);
    font-weight: bold;
}

.cat-order, .item-order {
    flex-shrink: 0;
    min-width: 2.2em;
    margin-right: 0.5em;
    font-size: 1.08em;
    font-weight: bold;
    text-align: right;
    letter-spacing: -0.5px;
    display: inline-block;
    vertical-align: middle;
}

/* ===== 메뉴 뱃지 ===== */
.menu-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.12em 0.7em;
    font-size: 0.85em;
    font-weight: 600;
    border-radius: 1em;
    vertical-align: middle;
    letter-spacing: -0.5px;
    white-space: nowrap;
    min-width: 2em;
    text-align: center;
    line-height: normal;
    margin-left: 0.5em;
    margin-right: 0;
    width: auto !important;
    flex: none !important;
    box-sizing: border-box;
}

.menu-badge.common {
    background: #eaf4ff;
    color: #357abd;
    border: 1px solid #cce7ff;
}
.menu-badge.new {
    background: #fffbe7;
    color: #b97a00;
    border: 1px solid #ffe082;
}
.menu-badge.disease {
    background: #ffe6e6;
    color: #d32f2f;
    border: 1px solid #f8bcbc;
}
.menu-badge.management {
    background: #e8f5e9;
    color: #388e3c;
    border: 1px solid #b2dfdb;
    min-width: 2.5em;
    padding: 0.15em 1em;
}
.menu-badge.behavior {
    background: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #e1bee7;
}
.menu-badge.health {
    background: #e0f7fa;
    color: #00838f;
    border: 1px solid #b2ebf2;
}
.menu-badge.special {
    background: #f5f5f5;
    color: #424242;
    border: 1px solid #bdbdbd;
}

/* ===== 카테고리 색상 ===== */
.cat-order.cat-color-1, .item-order.cat-color-1 { color: var(--cat-color-1); }
.cat-order.cat-color-2, .item-order.cat-color-2 { color: var(--cat-color-2); }
.cat-order.cat-color-3, .item-order.cat-color-3 { color: var(--cat-color-3); }
.cat-order.cat-color-4, .item-order.cat-color-4 { color: var(--cat-color-4); }
.cat-order.cat-color-5, .item-order.cat-color-5 { color: var(--cat-color-5); }
.cat-order.cat-color-6, .item-order.cat-color-6 { color: var(--cat-color-6); }
.cat-order.cat-color-7, .item-order.cat-color-7 { color: var(--cat-color-7); }
.cat-order.cat-color-8, .item-order.cat-color-8 { color: var(--cat-color-8); }

.category-section.cat-color-1 .cat-btn { border-left: none; background: #f5faff; }
.category-section.cat-color-2 .cat-btn { border-left: none; background: #fff8f0; }
.category-section.cat-color-3 .cat-btn { border-left: none; background: #f6fff5; }
.category-section.cat-color-4 .cat-btn { border-left: none; background: #fff5f8; }
.category-section.cat-color-5 .cat-btn { border-left: none; background: #f7f5ff; }
.category-section.cat-color-6 .cat-btn { border-left: none; background: #fffaf5; }
.category-section.cat-color-7 .cat-btn { border-left: none; background: #f5fffd; }
.category-section.cat-color-8 .cat-btn { border-left: none; background: #fffaf5; }

/* ===== 콘텐츠 HTML ===== */
.content-html {
    position: relative;
    z-index: 1;
    background: transparent;
}

/* ===== 로딩 스피너 ===== */
.spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
    width: 100px;
    opacity: 1;
    transition: opacity 0.5s ease-out;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    pointer-events: none;
    background: none;
}

.spinner.fade-out {
    opacity: 0;
}

.double-bounce1, .double-bounce2 {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    opacity: 0.6;
    position: absolute;
    animation: sk-bounce 2.0s infinite ease-in-out;
}

.double-bounce2 {
    animation-delay: -1.0s;
}

.spinner-overlay {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    z-index: 10;
    border-radius: 8px;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* ===== 카테고리 버튼 ===== */
.category-section .cat-btn.section {
    width: 100%;
    display: flex;
    align-items: center;
}

.cat-btn:not(.section), .item-btn {
    font-size: 1.02em;
    color: #222;
    background: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(74,144,226,0.07);
    border-radius: 0.9em;
    padding: 0.85em 1.2em;
    margin-bottom: 0.3em;
    display: flex;
    align-items: center;
    gap: 0.7em;
}

/* 카드형 컨텐츠 박스 공통 스타일 */
.card-box, .benefits, .step-guide, .sub-method, .breed-card, .checklist, .fun-fact, .info-box, .highlight, .tip, .references, .management, .cause, .diagnosis, .nutrition, .environment, .challenges, .activity, .health-check, .warning {
    width: 100%;
    max-width: 700px;
    min-width: 320px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ===== 반응형 ===== */
@media (max-width: 768px) {
    .hub-container {
        padding: 1rem;
    }
    
    .sections-grid {
        grid-template-columns: 1fr;
    }
    
    .content-article {
        padding: 1.2rem 0.5rem;
    }
    
    .contact-info {
        margin-top: 1rem;
        padding: 1.2rem;
        border-radius: 12px;
    }
    
    .contact-info p:first-child {
        font-size: 1rem;
    }
    
    .contact-info a {
        padding: 0.25rem 0.5rem;
        font-size: 0.95rem;
    }
    
    .cat-btn, .item-btn {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex-wrap: nowrap;
        word-break: break-all;
        overflow-wrap: break-word;
        justify-content: flex-start;
        align-items: center;
        gap: 0.18em;
        padding: 0.6em 0.7em;
    }
    
    .cat-btn .menu-badge, .item-btn .menu-badge {
        font-size: 0.62em;
        padding: 0.04em 0.22em;
        min-width: 1.1em;
        margin-left: 0.18em;
        flex-shrink: 0;
        line-height: 1.2;
    }
    
    .cat-btn .cat-title, .item-btn .cat-title {
        flex: 1 1 0;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 1em;
        display: flex;
        align-items: center;
        gap: 0.2em;
    }
    
    .cat-btn .icon, .item-btn .icon {
        flex-shrink: 0;
        margin-right: 0.18em;
        font-size: 1.1em;
        display: inline-block;
        vertical-align: middle;
    }
    
    .cat-title {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 1em;
        word-break: break-all;
    }
    
    .menu-badge {
        flex-shrink: 1;
        min-width: 1.1em;
        font-size: 0.65em;
        padding: 0.06em 0.28em;
        margin-left: 0.2em;
    }
    
    .category-section {
        padding-left: 0.2em;
        padding-right: 0.2em;
        border-radius: 0.7em;
    }
    
    .cat-order, .item-order {
        min-width: 2em;
        font-size: 1em;
        margin-right: 0.35em;
    }
    
    .card-box, .benefits, .step-guide, .sub-method, .breed-card, .checklist, .fun-fact, .info-box, .highlight, .tip, .references, .management, .cause, .diagnosis, .nutrition, .environment, .challenges, .activity, .health-check, .warning {
        max-width: 100%;
        min-width: 0;
        width: 100%;
    }
    
    .content {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 700px) {
    .menu-badge {
        font-size: 0.6rem;
        padding: 0.15rem 0.3rem;
        position: static;
        margin-left: 0.5rem;
    }
}

@media (max-width: 600px) {
    header {
        padding-top: 6px;
        padding-bottom: 2px;
    }
    .logo-img {
        width: 85px;
        height: 85px;
        margin-bottom: 10px;
        padding: 6px;
    }
    .main-title {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }
    .subtitle {
        font-size: 0.95rem;
    }
}

a.section-card,
a.section-card:visited {
    color: var(--text-color);
    text-decoration: none;
}

/* ===== 쿠팡 파트너스 광고 영역 ===== */
.coupang-partners-section {
    background: transparent !important;
    border-radius: 15px;
    padding: 1.2rem 1.2rem 0.7rem 1.2rem;
    margin: 0 0 1.2rem 0;
    box-shadow: none !important;
    border: none !important;
}

.partners-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.partners-header h3 {
    color: #333;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.partners-header p {
    color: #666;
    font-size: 1rem;
    margin: 0;
}

.partners-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.7rem;
}

.partners-grid img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    border-radius: 18px;
}

.partners-placeholder {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.partners-placeholder:hover {
    border-color: #4a90e2;
    background: #f0f4fa;
}

.placeholder-content i {
    font-size: 2.5rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.placeholder-content p {
    color: #6c757d;
    font-size: 1rem;
    margin: 0;
}

.partners-disclaimer {
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0.5rem 0 0 0;
    text-align: center;
}

.partners-disclaimer p {
    background: none !important;
    border: none !important;
    color: #fff;
    font-size: 0.97rem;
    margin: 0;
    text-align: center;
    font-weight: 400;
    opacity: 0.6;
}

.privacy-link {
  display: inline-block;
  padding: 7px 18px;
  border-radius: 18px;
  background: linear-gradient(90deg, #e0e7ff 60%, #c7d2fe 100%);
  color: #3730a3;
  font-size: 1.02rem;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 2px 8px 0 rgba(99,102,241,0.07);
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  border: 1.5px solid #a5b4fc;
  margin-left: 8px;
}
.privacy-link:hover, .privacy-link:focus {
  background: linear-gradient(90deg, #c7d2fe 60%, #e0e7ff 100%);
  color: #3730a3;
  box-shadow: 0 4px 16px 0 rgba(99,102,241,0.13);
  text-decoration: underline;
}
@media (max-width: 600px) {
  .privacy-link {
    font-size: 0.98rem;
    padding: 6px 12px;
    border-radius: 14px;
  }
}
