/* p400 smv Blog — Dark Theme */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Thai', sans-serif;
    background: #0d1117; color: #c9d1d9; line-height: 1.7;
}
.container { max-width: 820px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 0; border-bottom: 1px solid #30363d; flex-wrap: wrap; gap: 10px;
}
.site-logo { font-size: 1.3rem; font-weight: 700; color: #58a6ff; text-decoration: none; }
.site-nav { display: flex; gap: 16px; }
.site-nav a { color: #8b949e; text-decoration: none; font-size: 0.9rem; transition: color 0.2s; }
.site-nav a:hover { color: #58a6ff; }

main { padding: 30px 0; min-height: 60vh; }

/* Post cards */
.post-card {
    background: #161b22; border: 1px solid #30363d; border-radius: 8px;
    padding: 20px; margin-bottom: 16px; transition: border-color 0.2s;
}
.post-card:hover { border-color: #58a6ff; }
.post-meta {
    display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
    font-size: 0.82rem; color: #8b949e; margin-bottom: 8px;
}
.post-date { }
.post-time { }
.post-topic { color: #d2a8ff; background: #1c0332; padding: 2px 8px; border-radius: 10px; }
.post-title { font-size: 1.15rem; margin-bottom: 8px; }
.post-title a { color: #c9d1d9; text-decoration: none; }
.post-title a:hover { color: #58a6ff; }
.post-excerpt { color: #8b949e; font-size: 0.92rem; margin-bottom: 10px; }
.post-footer {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.82rem; color: #484f58;
}
.post-author { }
.post-ago { }
.post-views { color: #fbbf24; }
.like-btn {
    cursor: pointer; color: #8b949e; font-size: 0.85rem;
    padding: 2px 10px; border-radius: 12px; border: 1px solid #30363d;
    transition: all 0.2s; user-select: none;
}
.like-btn:hover { color: #ff6b6b; border-color: #ff6b6b; background: #2d1515; }
.like-btn.liked { color: #ff6b6b; border-color: #ff6b6b; background: #2d1515; }
.like-count { font-weight: 600; margin-left: 2px; }

/* Single post */
.single-post { }
.post-title-single { font-size: 1.6rem; margin: 16px 0; color: #f0f6fc; }
.post-content {
    background: #161b22; border: 1px solid #30363d; border-radius: 8px;
    padding: 24px; font-size: 1.02rem; line-height: 1.85; color: #c9d1d9;
    margin-bottom: 20px;
}
.post-content p { margin-bottom: 14px; }
.post-content h2 {
    font-size: 1.35rem; color: #f0f6fc; margin: 28px 0 12px;
    padding-bottom: 6px; border-bottom: 1px solid #30363d;
}
.post-content h3 {
    font-size: 1.15rem; color: #e0e6f0; margin: 22px 0 10px;
}
.post-content h4 {
    font-size: 1.05rem; color: #d0d6e0; margin: 18px 0 8px;
}
.post-content blockquote {
    border-left: 3px solid #58a6ff; margin: 16px 0; padding: 8px 16px;
    background: #1c2128; border-radius: 0 6px 6px 0; color: #8b949e;
}
.post-content blockquote em { color: #c9d1d9; font-style: italic; }
.post-content pre {
    background: #0d1117; border: 1px solid #30363d; border-radius: 6px;
    padding: 14px 16px; overflow-x: auto; margin: 14px 0;
    font-size: 0.9rem; line-height: 1.6;
}
.post-content code {
    font-family: 'JetBrains Mono','Fira Code','Consolas',monospace;
    background: #0d1117; padding: 2px 5px; border-radius: 3px;
    font-size: 0.88rem; color: #f0c674;
}
.post-content pre code { background: none; padding: 0; color: #c9d1d9; }
.post-content ul, .post-content ol {
    margin: 10px 0 14px 18px; padding: 0;
}
.post-content li { margin-bottom: 6px; }
.post-content hr {
    border: none; border-top: 1px solid #30363d;
    margin: 24px 0; opacity: 0.6;
}
.post-content img {
    max-width: 100%; border-radius: 6px; margin: 14px 0;
    border: 1px solid #30363d;
}
.post-content a { color: #58a6ff; text-decoration: none; }
.post-content a:hover { text-decoration: underline; }
.post-content strong { color: #e6edf3; }
.post-notice {
    background: #1c0332; border: 1px solid #3a1a5e; border-radius: 8px;
    padding: 14px 20px; font-size: 0.85rem; color: #a79fc9; margin-bottom: 20px;
}
.post-nav {
    display: flex; justify-content: space-between; gap: 12px; margin: 24px 0;
}
.nav-link {
    color: #58a6ff; text-decoration: none; font-size: 0.9rem; max-width: 45%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-link:hover { text-decoration: underline; }
.nav-link.prev { text-align: left; }
.nav-link.next { text-align: right; }

/* Archive */
.archive-year { margin-bottom: 32px; }
.archive-year h2 { font-size: 1.3rem; color: #58a6ff; margin-bottom: 12px; }
.month-list { display: flex; flex-wrap: wrap; gap: 10px; }
.month-link {
    background: #161b22; border: 1px solid #30363d; border-radius: 6px;
    padding: 10px 16px; color: #c9d1d9; text-decoration: none; font-size: 0.9rem;
    transition: border-color 0.2s;
}
.month-link:hover { border-color: #58a6ff; color: #58a6ff; }

/* Monthly view */
.month-header { margin-bottom: 20px; }
.month-header h1 { font-size: 1.4rem; color: #f0f6fc; }
.month-nav { margin-top: 10px; display: flex; gap: 12px; }
.month-nav a { color: #58a6ff; text-decoration: none; font-size: 0.9rem; }
.month-nav a:hover { text-decoration: underline; }

/* Day summary cards (clickable) */
.day-summary-link { text-decoration: none; color: inherit; display: block; }
.day-summary { cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.day-summary:hover { border-color: #58a6ff; background: #1c2128; }

/* Daily post views */
.daily-post-views { font-size: 0.78rem; color: #fbbf24; padding: 1px 6px; flex-shrink: 0; }

/* TTS Button */
.tts-bar {
    display: flex; align-items: center; gap: 10px; margin: 16px 0;
}
.tts-btn {
    background: #1f6feb; color: #fff; border: none;
    padding: 10px 20px; border-radius: 20px; cursor: pointer;
    font-size: 0.95rem; transition: background 0.2s;
}
.tts-btn:hover { background: #388bfd; }
.tts-btn.tts-stop { background: #da3633; }
.tts-btn.tts-stop:hover { background: #f85149; }
.tts-btn.tts-stable { background: #8957e5; }
.tts-btn.tts-stable:hover { background: #a371f7; }
.tts-status { font-size: 0.85rem; color: #8b949e; }

/* TTS Speed selector */
.tts-speed {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.8rem; color: #8b949e;
}
.tts-speed select {
    background: #161b22; color: #c9d1d9; border: 1px solid #30363d;
    border-radius: 4px; padding: 4px 6px; font-size: 0.8rem; cursor: pointer;
}

/* About */
.about-page h1 { margin-bottom: 20px; color: #f0f6fc; }
.about-content { background: #161b22; border: 1px solid #30363d; border-radius: 8px; padding: 24px; }
.about-content p { margin-bottom: 12px; }
.about-content ul { margin: 12px 0 12px 20px; }
.about-content li { margin-bottom: 6px; }

/* Error */
.error-page { text-align: center; padding: 60px 20px; }
.error-page h1 { font-size: 1.8rem; margin-bottom: 12px; }
.btn {
    display: inline-block; margin-top: 16px; padding: 10px 24px;
    background: #238636; color: #fff; text-decoration: none; border-radius: 6px;
    font-size: 0.95rem; transition: background 0.2s;
}
.btn:hover { background: #2ea043; }

/* Countdown */
.countdown-bar {
    text-align: center; font-size: 0.95rem; color: #f0c040;
    background: linear-gradient(135deg, #1c1a0e 0%, #2a2515 100%);
    border: 1px solid #5a4a20; border-radius: 20px;
    padding: 6px 20px; margin-bottom: 20px; display: inline-block;
    font-weight: 600; letter-spacing: 0.5px;
}
#countdown-timer { color: #58a6ff; font-weight: 700; font-size: 1.05rem; }

/* Footer */
.site-footer {
    text-align: center; padding: 24px 0; border-top: 1px solid #30363d;
    font-size: 0.82rem; color: #484f58;
}

/* Pagination */
.pagination {
    display: flex; justify-content: center; gap: 8px; margin: 24px 0;
}
.pagination a, .pagination span {
    padding: 6px 12px; border: 1px solid #30363d; border-radius: 4px;
    color: #c9d1d9; text-decoration: none; font-size: 0.9rem;
}
.pagination a:hover { border-color: #58a6ff; color: #58a6ff; }
.pagination .current { background: #238636; border-color: #238636; color: #fff; }

/* Monthly archive cards */
.monthly-list .post-card { margin-bottom: 14px; }

/* Daily archive (monthly grouped by day) */
.daily-group { margin-bottom: 20px; }
.daily-header {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: #161b22; border: 1px solid #30363d; border-radius: 8px;
    padding: 10px 16px; margin-bottom: 6px; font-size: 0.9rem;
}
.daily-date { color: #f0f6fc; font-weight: 700; }
.daily-dow { color: #8b949e; font-size: 0.82rem; }
.daily-stats { margin-left: auto; color: #8b949e; font-size: 0.82rem; }
.daily-stats strong { color: #f0c040; }
.daily-posts { padding-left: 8px; }
.daily-post {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: 6px; font-size: 0.88rem;
    transition: background 0.15s;
}
.daily-post:hover { background: #1c2128; }
.daily-post-time { color: #484f58; font-size: 0.78rem; min-width: 45px; }
.daily-post-title {
    color: #c9d1d9; text-decoration: none; flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.daily-post-title:hover { color: #58a6ff; }
.daily-like { font-size: 0.78rem; padding: 1px 8px; flex-shrink: 0; }

/* Tag badges */
.tag-badge {
    display: inline-block; background: #1f2a3f; color: #8cb4ff;
    padding: 1px 8px; border-radius: 10px; font-size: 0.75rem;
    text-decoration: none; margin: 1px 2px; transition: all 0.15s;
    border: 1px solid #2a3a55;
}
.tag-badge:hover { background: #2a3a55; color: #58a6ff; border-color: #58a6ff; }

.post-tags { margin: -4px 0 6px 0; }
.post-tags-single { margin: 6px 0 2px 0; }

.tag-edit-link {
    color: #8b949e; text-decoration: none; font-size: 0.75rem;
    margin-left: 6px; opacity: 0.5; transition: opacity 0.2s;
}
.tag-edit-link:hover { opacity: 1; color: #58a6ff; }

/* Tags cloud */
.tags-cloud {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
    background: #161b22; border: 1px solid #30363d; border-radius: 8px;
    padding: 24px; margin-top: 12px;
}
.tag-cloud-item {
    color: #8cb4ff; text-decoration: none; transition: color 0.15s;
    padding: 4px 10px; border-radius: 12px; background: #1c2128;
    border: 1px solid #2a3a55; white-space: nowrap;
}
.tag-cloud-item:hover { color: #58a6ff; border-color: #58a6ff; background: #2a3a55; }
.tag-count { color: #8b949e; font-size: 0.75rem; }

/* Tag edit form */
.tag-edit-form {
    background: #161b22; border: 1px solid #30363d; border-radius: 8px;
    padding: 20px; margin: 16px 0;
}
.tag-edit-form label { display: block; margin-bottom: 8px; color: #f0f6fc; font-weight: 600; }
.tag-input-row { display: flex; gap: 8px; margin-bottom: 10px; }
.tag-input-row input[type="text"] {
    flex: 1; background: #0d1117; color: #c9d1d9; border: 1px solid #30363d;
    border-radius: 6px; padding: 10px 12px; font-size: 0.95rem;
}
.tag-input-row input[type="text"]:focus { outline: none; border-color: #58a6ff; }
.tag-save-btn {
    background: #238636; color: #fff; border: none; border-radius: 6px;
    padding: 10px 20px; cursor: pointer; font-size: 0.95rem;
}
.tag-save-btn:hover { background: #2ea043; }
.tag-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-suggestion {
    background: #1c2128; color: #8b949e; border: 1px solid #30363d;
    border-radius: 10px; padding: 3px 10px; font-size: 0.78rem;
    cursor: pointer; transition: all 0.15s;
}
.tag-suggestion:hover { border-color: #58a6ff; color: #58a6ff; }

@media (max-width: 600px) {
    .site-header { flex-direction: column; align-items: flex-start; }
    .post-nav { flex-direction: column; }
    .nav-link { max-width: 100%; }
}
