/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background: #f0f2f5;
    color: #1a1a2e;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

footer {
    margin-top: auto;
}

a {
    color: #2e86ab;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ── Layout ───────────────────────────────────────────────── */
.container {
    width: 90%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ── Header ───────────────────────────────────────────────── */
header {
    background: #1a1a2e;
    color: #fff;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

header #branding h1 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #fff;
}

header nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 4px;
}

header nav a {
    color: #cdd3de;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

header nav a:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    text-decoration: none;
}

header nav a.nav-admin {
    border: 1px solid rgba(255,255,255,0.3);
}

header nav a.nav-admin:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.5);
}

/* ── Page content ─────────────────────────────────────────── */
.container > h1,
.container > h2 {
    margin-top: 32px;
}

/* ── Cards / panels ───────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 24px;
    margin-top: 24px;
}

/* ── Post listing (public) ────────────────────────────────── */
.post-item {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    padding: 20px 24px;
    margin-top: 16px;
}

.post-item h2 {
    margin: 0 0 6px;
    font-size: 1.15rem;
}

.post-item .meta {
    font-size: 0.8rem;
    color: #777;
    margin-bottom: 8px;
}

.post-item p {
    margin: 0;
    color: #444;
}

/* ── Category chips (public) ──────────────────────────────── */
.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 24px;
}

.categories a {
    background: #e8f4f8;
    color: #2e86ab;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.15s;
}

.categories a:hover {
    background: #2e86ab;
    color: #fff;
    text-decoration: none;
}

/* ── Forms ────────────────────────────────────────────────── */
form {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 24px;
    margin-top: 20px;
}

form label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: #444;
}

form input[type="text"],
form input[type="password"],
form textarea,
form select {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fafafa;
    transition: border-color 0.15s, box-shadow 0.15s;
    display: block;
}

form input[type="text"]:focus,
form input[type="password"]:focus,
form textarea:focus,
form select:focus {
    outline: none;
    border-color: #2e86ab;
    box-shadow: 0 0 0 3px rgba(46,134,171,0.15);
    background: #fff;
}

form textarea {
    min-height: 160px;
    resize: vertical;
}

form input[type="submit"],
.btn {
    display: inline-block;
    padding: 10px 22px;
    background: #2e86ab;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

form input[type="submit"]:hover,
.btn:hover {
    background: #236f8e;
    text-decoration: none;
}

form input[type="submit"]:active,
.btn:active {
    transform: scale(0.98);
}

/* ── Alerts / messages ────────────────────────────────────── */
.message {
    padding: 10px 16px;
    border-radius: 7px;
    margin: 16px 0;
    font-size: 0.9rem;
}

.message-success { background: #d1fae5; color: #065f46; }
.message-error   { background: #fee2e2; color: #991b1b; }

p[style*="color: red"] {
    background: #fee2e2;
    color: #991b1b !important;
    padding: 10px 16px;
    border-radius: 7px;
}

/* ── Tables ───────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    overflow: hidden;
}

table th,
table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

table th {
    background: #1a1a2e;
    color: #fff;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table tr:last-child td {
    border-bottom: none;
}

table tr:hover td {
    background: #f8fafc;
}

/* Inline forms inside table cells */
table form {
    background: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    display: inline;
}

table form input[type="text"],
table form input[type="password"] {
    width: auto;
    padding: 6px 10px;
    margin: 0;
    font-size: 0.875rem;
    display: inline;
}

table button,
table input[type="submit"] {
    padding: 5px 12px;
    background: #2e86ab;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

table button:hover,
table input[type="submit"]:hover {
    background: #236f8e;
}

table button.btn-danger {
    background: #e53e3e;
}

table button.btn-danger:hover {
    background: #c53030;
}

/* ── Featured images ──────────────────────────────────────── */
.featured-thumb {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
    display: block;
    margin-bottom: 12px;
}

.featured-hero {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    margin: 24px 0 20px;
}

.featured-image-preview {
    margin-bottom: 12px;
}

.featured-image-preview img {
    max-width: 240px;
    max-height: 140px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
    margin-bottom: 8px;
}

/* ── Site branding (logo / subtitle) ─────────────────────── */
a.site-title {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    text-decoration: none;
}

.site-subtitle {
    display: block;
    font-size: 0.75rem;
    color: #8892a4;
    margin-top: 2px;
}

.site-logo {
    max-height: 40px;
    display: block;
}

/* ── Post content (rendered HTML from TinyMCE) ────────────── */
.post-content {
    margin-top: 24px;
    line-height: 1.8;
}

.post-content h2, .post-content h3, .post-content h4 {
    margin-top: 28px;
}

.post-content img {
    max-width: 100%;
    border-radius: 6px;
    height: auto;
}

.post-content a {
    color: #2e86ab;
}

.post-content blockquote {
    border-left: 4px solid #2e86ab;
    margin: 16px 0;
    padding: 8px 16px;
    background: #f0f8fc;
    border-radius: 0 6px 6px 0;
    color: #555;
}

.post-content pre {
    background: #1a1a2e;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.88rem;
}

.post-content table {
    box-shadow: none;
    border: 1px solid #e0e0e0;
}

/* ── TinyMCE body styles (loaded as content_css) ─────────── */
.tinymce-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.8;
    color: #1a1a2e;
    padding: 12px;
}

/* ── Footer ───────────────────────────────────────────────── */
footer {
    background: #1a1a2e;
    color: #8892a4;
    text-align: center;
    padding: 16px 0;
    font-size: 0.82rem;
}
