/* ─── STM Guitar Tuition Blog ─── */
:root {
    --bg: #ece5d5;
    --fg: #1a1a2e;
    --card: #f2ece0;
    --card-border: #d5cfc0;
    --primary: #1a1a2e;
    --primary-fg: #f0ebe0;
    --secondary: #ddd6c8;
    --secondary-fg: #1a1a2e;
    --muted: #8a8478;
    --link: #3db8a0;
    --hero-bg: #1a1a2e;
    --hero-fg: #f0ebe0;
    --nav-bg: #222240;
    --nav-fg: #e8e2d5;
    --destructive: #e53e3e;
    --destructive-fg: #fff;
    --success: #38a169;
    --radius: 8px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--fg); font-family: system-ui, -apple-system, sans-serif; line-height: 1.6; }
h1,h2,h3,h4,h5,h6 { font-family: Georgia, 'Times New Roman', serif; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* Hero */
.hero { position: relative; height: 144px; overflow: hidden; background: var(--hero-bg); }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.4; }
.hero-content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; }
.hero h1 { font-size: 2rem; font-weight: bold; color: var(--hero-fg); letter-spacing: 1px; }
.hero p { font-size: 0.875rem; color: rgba(240,235,224,0.8); margin-top: 4px; }

/* Nav */
nav { background: var(--nav-bg); border-bottom: 1px solid var(--nav-bg); }
.nav-inner { max-width: 896px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 12px 16px; flex-wrap: wrap; }
nav a { padding: 6px 16px; font-size: 0.875rem; color: var(--nav-fg); transition: color 0.2s; }
nav a:hover, nav a.active { color: var(--link); text-decoration: none; }
nav a.active { font-weight: 600; }
.nav-admin { background: var(--link); color: var(--hero-bg) !important; border-radius: var(--radius); font-weight: 500; }

/* Main */
main { max-width: 896px; margin: 0 auto; padding: 32px 16px; min-height: 60vh; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); overflow: hidden; transition: box-shadow 0.2s; }
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.card-img { width: 100%; height: 192px; object-fit: cover; }
.card-body { padding: 20px; }
.card-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.badge { font-size: 0.75rem; font-weight: 500; padding: 2px 8px; border-radius: var(--radius); background: var(--secondary); color: var(--secondary-fg); }
.date { font-size: 0.75rem; color: var(--muted); }
.card-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 8px; }
.card-title a { color: var(--fg); }
.card-title a:hover { color: var(--link); text-decoration: none; }
.card-excerpt { font-size: 0.875rem; color: var(--muted); margin-bottom: 12px; }
.read-more { font-size: 0.875rem; font-weight: 500; color: var(--link); }

/* Grid */
.post-grid { display: grid; gap: 24px; grid-template-columns: repeat(2, 1fr); }
@media (max-width: 640px) { .post-grid { grid-template-columns: 1fr; } }

/* Article */
.article-content { padding: 24px 32px; }
.article-content h2 { font-size: 1.25rem; font-weight: bold; margin: 24px 0 12px; }
.article-content h3 { font-size: 1.125rem; font-weight: 600; margin: 16px 0 8px; }
.article-content p { color: var(--muted); margin-bottom: 12px; }
.article-content ul { list-style: disc; padding-left: 20px; margin-bottom: 12px; }
.article-content li { color: var(--muted); margin-bottom: 4px; }
.back-link { font-size: 0.875rem; display: inline-block; margin-bottom: 16px; }

/* Admin actions on blog */
.admin-actions { display: flex; gap: 8px; margin-bottom: 24px; }

/* Buttons */
.btn { display: inline-block; padding: 8px 20px; border-radius: var(--radius); font-size: 0.875rem; font-weight: 500; border: none; cursor: pointer; transition: opacity 0.2s; text-decoration: none; }
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-secondary { background: var(--secondary); color: var(--secondary-fg); }
.btn-danger { background: var(--destructive); color: var(--destructive-fg); }
.btn-sm { padding: 4px 12px; font-size: 0.75rem; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 4px; }
.form-control { width: 100%; border: 1px solid var(--card-border); border-radius: var(--radius); padding: 8px 12px; font-size: 0.875rem; background: var(--bg); color: var(--fg); font-family: inherit; }
.form-control:focus { outline: none; border-color: var(--link); box-shadow: 0 0 0 2px rgba(61,184,160,0.2); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: auto; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input { width: auto; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* Login */
.login-wrapper { display: flex; align-items: center; justify-content: center; min-height: 50vh; }
.login-box { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 32px; width: 100%; max-width: 380px; }
.login-box h2 { text-align: center; margin-bottom: 4px; }
.login-hint { text-align: center; font-size: 0.75rem; color: var(--muted); margin-bottom: 16px; }

/* Alerts */
.alert { padding: 12px; border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 16px; }
.alert-error { background: #fed7d7; color: #c53030; }
.alert-success { background: #c6f6d5; color: #276749; }
.alert-warning { background: var(--secondary); color: var(--fg); font-size: 0.75rem; }

/* Admin list */
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.post-list-item { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 16px; display: flex; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.post-list-thumb { width: 64px; height: 64px; border-radius: var(--radius); object-fit: cover; flex-shrink: 0; }
.post-list-info { flex: 1; min-width: 0; }
.post-list-title { font-weight: 600; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-list-excerpt { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-list-actions { flex-shrink: 0; display: flex; gap: 8px; }
.draft-badge { font-size: 0.75rem; color: var(--destructive); font-weight: 500; }

/* Tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.tab { padding: 6px 16px; border-radius: var(--radius); font-size: 0.875rem; font-weight: 500; border: none; cursor: pointer; background: var(--secondary); color: var(--secondary-fg); text-decoration: none; }
.tab.active { background: var(--primary); color: var(--primary-fg); }
.tab:hover { text-decoration: none; }

/* User list */
.user-item { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 16px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.user-info .username { font-weight: 500; font-size: 0.875rem; }
.user-info .you-badge { font-size: 0.75rem; color: var(--link); margin-left: 8px; }
.user-info .user-date { font-size: 0.75rem; color: var(--muted); }

/* Image preview */
.img-preview { position: relative; display: inline-block; margin-top: 8px; }
.img-preview img { height: 96px; border-radius: var(--radius); object-fit: cover; }
.img-remove { position: absolute; top: -8px; right: -8px; background: var(--destructive); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Footer */
footer { background: var(--hero-bg); color: var(--hero-fg); padding: 32px 16px; margin-top: 48px; text-align: center; }
footer a { color: var(--link); }
.footer-copy { font-size: 0.875rem; opacity: 0.6; margin-top: 8px; }

/* Rich text editor toolbar */
.editor-toolbar { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px; background: var(--secondary); border: 1px solid var(--card-border); border-bottom: none; border-radius: var(--radius) var(--radius) 0 0; }
.editor-toolbar button { padding: 4px 8px; border: 1px solid var(--card-border); border-radius: 4px; background: var(--bg); cursor: pointer; font-size: 0.8rem; color: var(--fg); }
.editor-toolbar button:hover { background: var(--card-border); }
.editor-toolbar button.active { background: var(--primary); color: var(--primary-fg); }
.editor-area { border: 1px solid var(--card-border); border-radius: 0 0 var(--radius) var(--radius); padding: 16px; min-height: 200px; background: var(--bg); }
.editor-area:focus { outline: none; border-color: var(--link); }
.editor-area h2 { font-size: 1.25rem; font-weight: bold; margin: 12px 0 8px; }
.editor-area h3 { font-size: 1.1rem; font-weight: 600; margin: 8px 0 4px; }
.editor-area ul, .editor-area ol { padding-left: 20px; margin: 8px 0; }
.editor-area a { color: var(--link); text-decoration: underline; }

/* Utility */
.text-center { text-align: center; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
