/* 기본 세팅 */
body { margin: 0; padding: 0; background-color: #f4f6f8; font-family: -apple-system, sans-serif; color: #333; }
.main-container { max-width: 1000px; margin: 0 auto; padding: 20px; }

/* 헤더 영역 */
.header {
    background-color: #ffffff; padding: 16px 40px; box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px;
}
.header h1 { margin: 0; font-size: 22px; color: #333; cursor: pointer; }
.header-right { display: flex; align-items: center; gap: 12px; }

/* 폼 & 상세 페이지 카드 */
.form-card { background: white; padding: 30px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); max-width: 500px; margin: 0 auto 30px auto; }
.detail-card { background: white; padding: 40px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }

/* 인풋 박스 */
.input-box {
    width: 100%; box-sizing: border-box; padding: 12px; margin-bottom: 15px;
    border: 1px solid #ddd; border-radius: 8px; font-size: 14px; transition: border-color 0.2s;
}
.input-box:focus { border-color: #007bff; outline: none; }

/* 버튼 스타일 */
.btn { padding: 8px 16px; border-radius: 6px; font-size: 14px; font-weight: bold; cursor: pointer; border: none; transition: all 0.2s ease; }
.btn-primary { background-color: #007bff; color: white; border: 1px solid #007bff; }
.btn-primary:hover { background-color: #0056b3; }
.btn-outline { background-color: white; color: #555; border: 1px solid #ddd; }
.btn-outline:hover { background-color: #f8f9fa; border-color: #ccc; }
.btn-text { background-color: transparent; color: #666; }
.btn-text:hover { color: #111; text-decoration: underline; }

/* 카드 리스트 레이아웃 (Grid) */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* 개별 카드 디자인 */
.card {
    background: #ffffff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-8px); box-shadow: 0 12px 20px rgba(0,0,0,0.1); }
.card-image { width: 100%; height: 160px; object-fit: cover; background-color: #e9ecef; }
.card-content { padding: 20px; flex-grow: 1; }
.card-badge { display: inline-block; padding: 4px 8px; background-color: #e8f0fe; color: #1a73e8; font-size: 12px; font-weight: bold; border-radius: 4px; margin-bottom: 10px; }
.card-title { margin: 0 0 10px 0; font-size: 18px; color: #222; line-height: 1.4; }
.card-summary { color: #666; font-size: 14px; margin-bottom: 20px; }
.card-footer { display: flex; justify-content: space-between; border-top: 1px solid #eee; padding-top: 15px; color: #999; font-size: 12px; }

/* 링크 ও 텍스트 */
.link-group { text-align: center; margin-top: 15px; font-size: 0.9em; color: #555; }
.link-text { cursor: pointer; color: #007bff; text-decoration: underline; margin: 0 5px; }
.post-meta { font-size: 0.9em; color: #777; }
.comment-box { border-bottom: 1px solid #eee; padding: 15px 0; }

/* 이미지 없는 카드 플레이스홀더 */
.card-image-placeholder {
    width: 100%; height: 160px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* 토스트 알림 */
#toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
    padding: 12px 20px; border-radius: 8px; font-size: 14px; font-weight: 500;
    color: white; max-width: 320px; opacity: 0; transform: translateX(120%);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast-show { opacity: 1; transform: translateX(0); }
.toast-success { background-color: #28a745; }
.toast-error   { background-color: #dc3545; }
.toast-info    { background-color: #007bff; }

/* 마크다운 렌더링 스타일 */
#detail-content h1, #detail-content h2, #detail-content h3,
#detail-content h4, #detail-content h5, #detail-content h6 {
    margin: 1.2em 0 0.5em; line-height: 1.4;
}
#detail-content p { margin: 0.8em 0; line-height: 1.8; }
#detail-content ul, #detail-content ol { padding-left: 1.5em; margin: 0.8em 0; }
#detail-content li { margin: 0.3em 0; line-height: 1.7; }
#detail-content blockquote {
    margin: 1em 0; padding: 0.5em 1em;
    border-left: 4px solid #007bff; background: #f0f4ff; color: #555; border-radius: 0 6px 6px 0;
}
#detail-content code {
    background: #f4f4f4; padding: 2px 6px; border-radius: 4px;
    font-family: 'Courier New', monospace; font-size: 0.9em; color: #e83e8c;
}
#detail-content pre {
    background: #282c34; color: #abb2bf; padding: 16px; border-radius: 8px;
    overflow-x: auto; margin: 1em 0;
}
#detail-content pre code { background: none; color: inherit; padding: 0; font-size: 0.9em; }
#detail-content table {
    border-collapse: collapse; width: 100%; margin: 1em 0;
}
#detail-content th, #detail-content td {
    border: 1px solid #ddd; padding: 8px 12px; text-align: left;
}
#detail-content th { background: #f8f9fa; font-weight: bold; }
#detail-content tr:nth-child(even) { background: #fafafa; }
#detail-content a { color: #007bff; text-decoration: underline; }
#detail-content hr { border: none; border-top: 1px solid #eee; margin: 1.5em 0; }
#detail-content img { max-width: 100%; border-radius: 6px; }

/* 반응형 (모바일) */
@media (max-width: 768px) {
    .header { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .header h1 { font-size: 18px; }
    .header-right { gap: 6px; flex-wrap: wrap; }
    .header-right .btn { padding: 5px 8px; font-size: 12px; }
    .main-container { padding: 10px; }
    .card-container { grid-template-columns: 1fr; }
    .form-card { padding: 20px; }
    .detail-card { padding: 20px; }
    #toast-container { right: 10px; left: 10px; }
    .toast { max-width: 100%; }
    .detail-card [style*="float: right"] { float: none; margin-bottom: 12px; }
}