@charset "UTF-8";
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #06b6d4;
    --bg-color: #f8fafc;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --border-color: #e5e7eb;
    --white: #ffffff;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

@import url('[https://fonts.googleapis.com/css2?family=Pretendard:wght@400;500;600;700;800;900&display=swap](https://fonts.googleapis.com/css2?family=Pretendard:wght@400;500;600;700;800;900&display=swap)');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    word-break: keep-all; /* 한국어 단어 중간에 줄바꿈 방지 */
}

body {
    font-family: 'Pretendard', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button, input { font-family: inherit; }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* =========================================
   2. 헤더 및 네비게이션 (반응형)
   ========================================= */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 60;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 900;
    color: #111827;
    letter-spacing: -0.025em;
}

/* 햄버거 버튼 (모바일용) */
.mobile-menu-btn {
    display: block;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    z-index: 60;
}

/* 네비게이션 래퍼 (모바일에서는 메뉴가 접힘) */
.nav-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 55;
}

.nav-wrapper.active {
    transform: translateY(0);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
    font-size: 1.25rem;
}

.nav-link {
    color: var(--text-muted);
    font-weight: 700;
}

.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 80%;
    max-width: 300px;
}

.btn-login, .btn-signup {
    text-align: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    border: none;
    cursor: pointer;
}

.btn-login { background-color: #f3f4f6; color: #374151; }
.btn-signup { background-color: var(--primary); color: var(--white); }

/* 데스크탑(PC) 미디어 쿼리 - 헤더 */
@media (min-width: 768px) {
    .header-inner { height: 5rem; }
    .logo-text { font-size: 1.5rem; }
    .mobile-menu-btn { display: none; }
    .nav-wrapper {
        position: static;
        height: auto;
        background: transparent;
        flex-direction: row;
        justify-content: space-between;
        flex-grow: 1;
        margin-left: 3rem;
        transform: none;
        z-index: auto;
    }
    .nav-menu {
        flex-direction: row;
        gap: 2rem;
        font-size: 1rem;
    }
    .nav-link { font-weight: 600; }
    .nav-link:hover { color: var(--primary); }
    .auth-buttons {
        flex-direction: row;
        width: auto;
        gap: 0.75rem;
    }
    .btn-login, .btn-signup { padding: 0.625rem 1.25rem; font-size: 0.875rem; }
}

/* =========================================
   3. 히어로 섹션
   ========================================= */
.hero {
    padding: 4rem 0 5rem;
    text-align: center;
    background: linear-gradient(to bottom right, #eff6ff, #ffffff, #ecfeff);
    border-bottom: 1px solid #dbeafe;
}

.hero-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    background-color: #dbeafe;
    color: #1d4ed8;
    font-weight: 700;
    font-size: 0.75rem;
    margin-bottom: 1rem;
}

.hero-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
}

.hero-title span {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    color: transparent;
}

.hero-desc {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--white);
    border-radius: var(--radius-full);
    padding: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(219, 234, 254, 0.5);
    border: 1px solid var(--border-color);
    max-width: 768px;
    margin: 0 auto;
}

.search-icon { padding-left: 1rem; color: var(--text-light); display: none; }
.search-input {
    flex-grow: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    font-size: 0.9375rem;
    outline: none;
    width: 100%;
}
.search-btn {
    background-color: #111827;
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.popular-tags {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}
.popular-tags span { font-size: 0.875rem; color: var(--text-muted); font-weight: 600; display: none; }
.tag-link {
    padding: 0.25rem 0.75rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* 데스크탑(PC) 미디어 쿼리 - 히어로 */
@media (min-width: 768px) {
    .hero { padding: 5rem 0 7rem; }
    .hero-badge { font-size: 0.875rem; margin-bottom: 1.5rem; }
    .hero-title { font-size: 3.5rem; margin-bottom: 1.5rem; }
    .hero-desc { font-size: 1.125rem; margin-bottom: 2.5rem; }
    .search-bar { padding: 0.5rem; }
    .search-icon { display: block; }
    .search-input { font-size: 1.125rem; }
    .search-btn { padding: 0.75rem 2.5rem; }
    .popular-tags span { display: inline-block; }
    .tag-link { font-size: 0.875rem; }
    .tag-link:hover { border-color: #93c5fd; color: var(--primary); }
}

/* =========================================
   4. 핵심 가치 섹션 (그리드 반응형)
   ========================================= */
.features-section { padding: 3rem 0; background: var(--white); }
.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
.feature-card {
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    background: #f9fafb;
    border: 1px solid var(--border-color);
}
.feature-icon {
    width: 3rem; height: 3rem;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; margin-bottom: 1rem;
}
.feature-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.5rem; }
.feature-desc { font-size: 0.875rem; color: var(--text-muted); line-height: 1.6; }

@media (min-width: 640px) { .features-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { 
    .features-section { padding: 5rem 0; }
    .features-grid { grid-template-columns: repeat(4, 1fr); } 
    .feature-card:hover { transform: translateY(-4px); transition: transform 0.3s; }
}

/* =========================================
   5. 최신 자료 피드 (그리드 반응형)
   ========================================= */
.materials-section { padding: 3rem 0 5rem; background: #f8fafc; }
.section-header { margin-bottom: 1.5rem; text-align: center; }
.section-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.section-desc { font-size: 0.875rem; color: var(--text-muted); }
.reset-btn {
    background: none; border: none; color: var(--primary);
    font-weight: 600; cursor: pointer; margin-top: 0.5rem;
}

.materials-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    display: flex; flex-direction: column; position: relative;
}
.card.verified { border-color: #fde047; box-shadow: var(--shadow-sm); }
.badge-verified {
    position: absolute; top: 0; right: 0;
    background: #facc15; color: #111827;
    font-size: 0.625rem; font-weight: 700;
    padding: 0.25rem 0.5rem; border-bottom-left-radius: var(--radius-md);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.card-subject { font-size: 0.75rem; font-weight: 700; padding: 0.2rem 0.5rem; border-radius: 0.25rem; border: 1px solid; }
.card-time { font-size: 0.75rem; color: var(--text-light); font-weight: 500; }
.card-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.5rem; }
.card-desc { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex-grow: 1; }
.card-footer { border-top: 1px solid #f9fafb; padding-top: 1rem; display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.author-info { display: flex; align-items: center; gap: 0.5rem; }
.author-avatar { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; }
.author-name { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
.stats { display: flex; gap: 0.5rem; font-size: 0.8125rem; color: var(--text-light); }
.stat-likes { color: #f87171; }

.loading-state { text-align: center; padding: 3rem 0; color: var(--text-muted); }
.loading-spinner {
    border: 3px solid #f3f3f3; border-top: 3px solid var(--primary);
    border-radius: 50%; width: 24px; height: 24px;
    animation: spin 1s linear infinite; margin: 0 auto 1rem;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

@media (min-width: 768px) {
    .section-header { display: flex; justify-content: space-between; align-items: flex-end; text-align: left; margin-bottom: 2rem; }
    .section-title { font-size: 1.875rem; }
    .section-desc { font-size: 1rem; }
    .reset-btn { margin-top: 0; }
    .materials-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
    .card { padding: 1.5rem; transition: all 0.3s; }
    .card:hover { box-shadow: var(--shadow-lg); border-color: #93c5fd; }
    .card:hover .card-title { color: var(--primary); }
}
@media (min-width: 1024px) { .materials-grid { grid-template-columns: repeat(3, 1fr); } }

/* =========================================
   6. 푸터
   ========================================= */
.footer { background-color: #111827; color: var(--text-light); padding: 3rem 0; margin-top: auto; }
.footer-content { display: flex; flex-direction: column; gap: 1.5rem; align-items: center; text-align: center; }
.footer-brand { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; opacity: 0.5; filter: grayscale(100%); justify-content: center; }
.footer-brand span { font-size: 1.25rem; font-weight: 700; color: var(--white); }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; font-size: 0.875rem; }
.footer-bottom { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid #1f2937; text-align: center; font-size: 0.875rem; color: #4b5563; }

@media (min-width: 768px) {
    .footer-content { flex-direction: row; justify-content: space-between; text-align: left; }
    .footer-brand { justify-content: flex-start; }
    .footer-links { gap: 1.5rem; }
}

/* =========================================
   7. AI 챗봇 위젯 (모바일 최적화)
   ========================================= */
.chatbot-widget { position: fixed; bottom: 1rem; right: 1rem; z-index: 50; display: flex; flex-direction: column; align-items: flex-end; }

.chatbot-window {
    width: calc(100vw - 2rem); max-width: 24rem;
    background: var(--white); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg); border: 1px solid #dbeafe;
    margin-bottom: 1rem; display: none; flex-direction: column;
    transform-origin: bottom right;
}
.chatbot-window.active { display: flex; }
.chatbot-header { background: linear-gradient(to right, var(--primary), var(--secondary)); padding: 1rem; color: var(--white); display: flex; justify-content: space-between; align-items: center; border-top-left-radius: var(--radius-xl); border-top-right-radius: var(--radius-xl); }
.chatbot-header-title { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.chatbot-close { background: none; border: none; color: var(--white); cursor: pointer; font-size: 1.2rem; }
.chatbot-messages { padding: 1rem; height: 60vh; max-height: 20rem; overflow-y: auto; background: #f8fafc; display: flex; flex-direction: column; gap: 0.75rem; font-size: 0.875rem; }
.msg-bubble { padding: 0.75rem; border-radius: 1rem; max-width: 85%; line-height: 1.5; white-space: pre-wrap; }
.msg-ai { align-self: flex-start; background: var(--white); border: 1px solid var(--border-color); border-top-left-radius: 0.125rem; color: var(--text-main); }
.msg-user { align-self: flex-end; background: #dbeafe; border: 1px solid #bfdbfe; border-top-right-radius: 0.125rem; color: #1e3a8a; }
.chatbot-input-area { padding: 0.75rem; background: var(--white); border-top: 1px solid var(--border-color); display: flex; gap: 0.5rem; border-bottom-left-radius: var(--radius-xl); border-bottom-right-radius: var(--radius-xl); }
.chatbot-input { flex-grow: 1; padding: 0.625rem 1rem; background: #f3f4f6; border: none; border-radius: var(--radius-lg); outline: none; }
.chatbot-send-btn { background: #111827; color: var(--white); padding: 0.625rem 1rem; border-radius: var(--radius-lg); border: none; cursor: pointer; font-weight: bold; }

.chatbot-toggle-btn {
    background: linear-gradient(to right, var(--primary), var(--secondary)); color: var(--white);
    width: 3.5rem; height: 3.5rem; border-radius: 50%; border: 2px solid var(--white); box-shadow: var(--shadow-lg);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}

@media (min-width: 768px) {
    .chatbot-widget { bottom: 1.5rem; right: 1.5rem; }
    .chatbot-messages { height: 20rem; }
}