/* ===========================
   공문 서식 템플릿 스타일
   =========================== */

/* 페이지 컨테이너 가운데 정렬 */
.page-container {
    padding: 20px;
}

.page-container .container {
    max-width: 1200px;
    margin: 0 auto;
    display: block;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 카테고리 탭 */
.category-section {
    margin-bottom: 30px;
    width: 100%;
    text-align: center;
}

.category-tabs {
    display: inline-flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
    margin: 0 auto;
}

.category-tab {
    padding: 16px 32px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    color: var(--text-color);
    font-size: 1.05rem;
    position: relative;
    bottom: -2px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 120px;
    justify-content: center;
}

.category-tab:hover {
    background: var(--card-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.category-tab.active {
    background: var(--card-bg);
    border-color: var(--primary-color);
    border-bottom-color: var(--card-bg);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
}

.category-tab i {
    font-size: 1.2rem;
}

/* 템플릿 목록 */
.template-section {
    margin-bottom: 30px;
}

.template-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.template-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.template-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.template-card.active {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    box-shadow: var(--shadow-md);
}

.template-card-icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.template-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.template-card-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* 템플릿 뷰어 */
.viewer-section {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-lg);
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.viewer-header h2 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin: 0;
}

.viewer-content {
    margin-bottom: 20px;
}

.viewer-content textarea {
    width: 100%;
    min-height: 400px;
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    line-height: 1.8;
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    resize: vertical;
    background: var(--card-bg);
    color: var(--text-color);
}

.viewer-content textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 팁 섹션 */
.viewer-tips {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.viewer-tips h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.viewer-tips h3 i {
    font-size: 1.2rem;
}

.viewer-tips ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-color);
}

.viewer-tips li {
    margin-bottom: 10px;
    line-height: 1.7;
}

.viewer-tips li:last-child {
    margin-bottom: 0;
}

.viewer-tips strong {
    color: var(--primary-dark);
    font-weight: 600;
}

.char-count-info {
    margin-top: 10px;
    text-align: right;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.viewer-footer {
    display: flex;
    justify-content: flex-start;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

/* 버튼 스타일 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--card-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 토스트 메시지 */
.toast-message {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary-color);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.toast-message.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-message i {
    font-size: 1.2rem;
}

/* ===== FAQ/QNA 섹션 ===== */
.faq-section {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
    padding: 40px 32px;
    margin: 40px 0 0 0;
    width: 100%;
}

.faq-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
    text-align: center;
}

.faq-title i {
    color: #2563eb;
    font-size: 1.5rem;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.faq-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 24px;
    transition: all 0.3s ease;
    width: 100%;
}

.faq-item.active,
.faq-item:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
    background: #f8fafc;
}

.faq-question {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    line-height: 1.6;
    width: 100%;
}

.faq-question span:not(.faq-icon) {
    flex: 1;
    word-break: keep-all;
}

.faq-icon {
    background: #2563eb;
    color: #fff;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.faq-arrow {
    margin-left: auto;
    color: #64748b;
    font-size: 0.9rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.faq-item.active .faq-arrow {
    transform: rotate(180deg);
    color: #2563eb;
}

.faq-item .faq-answer {
    display: none;
    margin-top: 16px;
    padding-top: 16px;
    padding-left: 0;
    border-top: 1px solid #e2e8f0;
    color: #475569;
    font-size: 1rem;
    line-height: 1.8;
    width: 100%;
}

.faq-item.active .faq-answer {
    display: block;
}

.faq-answer p {
    margin: 0;
    margin-bottom: 8px;
}

.faq-answer p:last-child {
    margin-bottom: 0;
}

.faq-answer strong {
    color: #1e293b;
    font-weight: 600;
}

/* 반응형 */
@media (max-width: 768px) {
    .template-list {
        grid-template-columns: 1fr;
    }
    
    .category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .category-tab {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .viewer-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .viewer-header .btn {
        width: 100%;
        justify-content: center;
    }
    
    .viewer-content textarea {
        min-height: 300px;
    }
    
    .toast-message {
        bottom: 20px;
        right: 20px;
        left: 20px;
    }
    
    .faq-section {
        padding: 24px 20px;
        margin: 24px 0 0;
    }
    
    .faq-title {
        font-size: 1.3rem;
        margin-bottom: 20px;
        flex-direction: column;
        gap: 8px;
    }
    
    .faq-item {
        padding: 16px 18px;
    }
    
    .faq-question {
        font-size: 1rem;
        gap: 10px;
    }
    
    .faq-icon {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    .faq-item .faq-answer {
        font-size: 0.95rem;
    }
}

