/* Global Styles */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    
    --bg-color: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    
    --border-color: #e2e8f0;
    --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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    cursor: pointer;
}

.logo i {
    font-size: 28px;
}

.header-nav {
    display: flex;
    gap: 24px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: var(--bg-secondary);
}

.nav-link.active {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.1);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 80px 0 60px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse"><path d="M 100 0 L 0 0 0 100" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-subtitle {
    font-size: 18px;
    text-align: center;
    margin-bottom: 40px;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* Search Bar */
.search-bar {
    max-width: 700px;
    margin: 0 auto 40px;
    display: flex;
    align-items: center;
    background: white;
    border-radius: var(--radius-lg);
    padding: 8px 8px 8px 20px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
}

.search-icon {
    color: var(--text-secondary);
    margin-right: 12px;
    font-size: 18px;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 12px 8px;
    color: var(--text-primary);
}

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

.search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* 자동완성 드롭다운 */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    margin-top: -8px;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--bg-secondary);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: var(--bg-secondary);
}

.autocomplete-item i {
    color: var(--primary-color);
    font-size: 14px;
}

.autocomplete-item mark {
    background: #fef08a;
    color: #854d0e;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
}

.stat-item i {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}

.stat-item span {
    display: block;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-item small {
    display: block;
    font-size: 14px;
    opacity: 0.9;
}

/* Ad Spaces */
.ad-space {
    background: var(--bg-tertiary);
    padding: 24px 0;
    margin: 32px 0;
}

.ad-placeholder {
    background: white;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 40px;
    text-align: center;
    color: var(--text-light);
}

.ad-placeholder i {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.ad-placeholder span {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.ad-placeholder small {
    display: block;
    font-size: 13px;
}

.ad-placeholder.small {
    padding: 24px;
}

.ad-placeholder.small i {
    font-size: 24px;
}

.ad-placeholder.small span {
    font-size: 14px;
}

/* Main Content Layout */
.main-content {
    padding: 40px 0 60px;
}

.content-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
}

/* Sidebar */
.sidebar {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    height: fit-content;
    position: sticky;
    top: 100px;
    box-shadow: var(--shadow-sm);
}

.sidebar-header h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.category-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    text-align: left;
}

.category-btn i {
    font-size: 18px;
    width: 20px;
}

.category-btn span:first-of-type {
    flex: 1;
}

.category-btn .count {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.category-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.category-btn.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.category-btn.active .count {
    background: var(--primary-color);
    color: white;
}

.subcategory-list {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding-left: 32px;
    margin-bottom: 8px;
}

.subcategory-list.show {
    display: flex;
}

.subcategory-btn {
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    text-align: left;
    transition: var(--transition);
}

.subcategory-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.subcategory-btn.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    font-weight: 500;
}

.ad-sidebar {
    margin-top: 32px;
    padding: 0;
    background: transparent;
}

/* Document Area */
.document-area {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
}

.document-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--bg-secondary);
}

.document-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-options label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.sort-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    background: white;
    transition: var(--transition);
}

.sort-select:hover {
    border-color: var(--primary-color);
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Featured Section */
.featured-section {
    margin-bottom: 48px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--warning-color);
}

.all-documents-section {
    margin-top: 48px;
}

/* Document Grid */
.document-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.featured-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* Document Card */
.document-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* 검색 하이라이팅 */
.document-card mark {
    background: #fef08a;
    color: #854d0e;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.document-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transform: scaleX(0);
    transition: var(--transition);
}

.document-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.document-card:hover::before {
    transform: scaleX(1);
}

.document-card.featured {
    border-color: var(--warning-color);
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.featured-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--warning-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.file-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.file-icon.hwp {
    color: #ed6c02;
}

.file-icon.pdf {
    color: #d32f2f;
}

.file-icon.docx {
    color: #2563eb;
}

.file-format-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.file-format-badge.hwp {
    background: #fff3e0;
    color: #ed6c02;
}

.file-format-badge.pdf {
    background: #ffebee;
    color: #d32f2f;
}

.file-format-badge.docx {
    background: #e3f2fd;
    color: #2563eb;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.card-category {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.card-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--bg-secondary);
}

.download-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.download-count i {
    color: var(--success-color);
}

.download-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.download-btn:hover {
    background: var(--primary-dark);
    transform: translateX(2px);
}

.download-btn i {
    font-size: 16px;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-results i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.no-results p {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.no-results small {
    font-size: 14px;
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading-indicator i {
    font-size: 40px;
    margin-bottom: 16px;
    color: var(--primary-color);
}

.loading-indicator p {
    font-size: 16px;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 60px 0 24px;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section ul li a:hover {
    color: white;
    padding-left: 4px;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 32px;
}

.disclaimer {
    background: rgba(245, 158, 11, 0.15);
    border-left: 4px solid var(--warning-color);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.disclaimer i {
    color: var(--warning-color);
    margin-right: 8px;
}

.disclaimer strong {
    color: white;
}

.copyright {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .content-layout {
        grid-template-columns: 240px 1fr;
        gap: 24px;
    }
    
    .sidebar {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 32px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .search-bar {
        flex-direction: column;
        padding: 16px;
    }
    
    .search-input {
        width: 100%;
        margin-bottom: 12px;
    }
    
    .search-btn {
        width: 100%;
        justify-content: center;
    }
    
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .content-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
    }
    
    .document-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .hero {
        padding: 60px 0 40px;
    }
    
    .hero-title {
        font-size: 28px;
    }
    
    .document-area {
        padding: 20px;
    }
    
    .document-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}