/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 18px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.75;
    color: #2c2420;
    background: #faf7f2;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

body > main {
    flex: 1;
}

a {
    color: #c45d3e;
    transition: color 0.2s;
}

a:hover {
    color: #a04530;
}

/* ===== LAYOUT ===== */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-wide {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== DECORATIVE ELEMENTS ===== */
.divider {
    text-align: center;
    color: #c45d3e;
    font-size: 1.2rem;
    letter-spacing: 8px;
    margin: 24px 0;
    opacity: 0.5;
}

/* ===== HEADER ===== */
.site-header {
    padding: 20px 0;
    border-bottom: 3px double #e0d6ca;
    background: #faf7f2;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
}

.header-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
    border: 2px solid #e0d6ca;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.blog-name {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1rem;
    font-weight: 700;
    color: #2c2420;
    line-height: 1.3;
    letter-spacing: 0.5px;
}

.blog-tagline {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.75rem;
    font-style: italic;
    color: #8a7e74;
}

/* ===== HERO ===== */
.hero {
    padding: 40px 0 16px;
    text-align: center;
}

.hero-photo {
    margin-bottom: 28px;
}

.hero-photo img {
    width: 200px;
    height: 260px;
    border-radius: 4px;
    object-fit: cover;
    object-position: top;
    border: 3px solid #e0d6ca;
    box-shadow: 4px 4px 0 #e0d6ca;
}

.hero h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 12px;
    text-align: center;
    color: #2c2420;
}

.hero p {
    font-size: 0.95rem;
    color: #8a7e74;
    text-align: center;
    font-style: italic;
}

@media (min-width: 720px) {
    .hero-photo img {
        width: 220px;
        height: 290px;
    }
    .hero h1 {
        font-size: 1.7rem;
    }
}

/* ===== ARTICLE CARDS (CHAPTERS) ===== */
.section-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.1rem;
    font-weight: 400;
    color: #8a7e74;
    margin-bottom: 8px;
    text-align: center;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.section-title::before {
    content: none;
}

.articles-section {
    padding-bottom: 40px;
}

.article-card {
    display: block;
    padding: 28px 0;
    text-decoration: none;
    color: inherit;
    border-top: 1px solid #e0d6ca;
    border-left: 3px solid transparent;
    padding-left: 0;
    transition: border-color 0.2s, padding-left 0.2s;
}

.article-card:hover {
    border-left-color: #c45d3e;
    padding-left: 16px;
}

.article-card:last-child {
    border-bottom: 1px solid #e0d6ca;
}

.article-card-chapter {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.75rem;
    color: #c45d3e;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.article-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.article-card-meta time {
    font-size: 0.75rem;
    color: #8a7e74;
}

.article-card-tags {
    font-size: 0.75rem;
    color: #8a7e74;
}

.article-card-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #2c2420;
    margin: 0 0 8px;
    line-height: 1.4;
}

.article-card-excerpt {
    font-size: 0.9rem;
    color: #5c524a;
    margin-bottom: 10px;
    line-height: 1.6;
    white-space: pre-line;
}

.article-card-link {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.85rem;
    color: #c45d3e;
    font-style: italic;
}

.no-articles {
    text-align: center;
    color: #8a7e74;
    padding: 40px 0;
    font-style: italic;
}

/* ===== BACK LINK ===== */
.back-home {
    padding: 16px 0 40px;
}

.back-home a {
    color: #c45d3e;
    text-decoration: none;
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-size: 0.9rem;
}

.back-home a:hover {
    text-decoration: underline;
}

/* ===== ARTICLE ===== */
.article {
    padding: 32px 0 48px;
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
}

@media (min-width: 720px) {
    .article {
        padding: 40px 0 56px;
    }
}

.article-meta {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: #8a7e74;
    margin-bottom: 16px;
}

h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.75rem;
    line-height: 1.4;
    font-weight: 700;
    color: #2c2420;
    margin-bottom: 24px;
    text-align: left;
}

@media (min-width: 720px) {
    h1 { font-size: 2.2rem; }
}

h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c2420;
    margin: 40px 0 16px;
}

h2::before {
    content: "— ";
    color: #c45d3e;
}

h3 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #3a322c;
    margin-bottom: 8px;
}

p {
    margin-bottom: 16px;
    color: #3a322c;
}

.lead {
    font-size: 1.15rem;
    font-style: italic;
    color: #5c524a;
    margin-bottom: 32px;
    line-height: 1.8;
}

/* Буквица (raised cap) — первая буква первого абзаца статьи */
.article h1 + p::first-letter {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 3rem;
    line-height: 0.5;
    color: #c45d3e;
    font-weight: 700;
    margin-right: 2px;
}

ul {
    margin: 0 0 16px 24px;
    color: #3a322c;
}

ol {
    margin: 0 0 20px 0;
    padding-left: 0;
    color: #3a322c;
    counter-reset: book-counter;
    list-style: none;
}

ol > li {
    counter-increment: book-counter;
    padding-left: 38px;
    position: relative;
    margin-bottom: 12px;
}

ol > li::before {
    content: counter(book-counter) ".";
    position: absolute;
    left: 0;
    top: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.05rem;
    font-style: italic;
    font-weight: 700;
    color: #c45d3e;
    line-height: 1.7;
}

li {
    margin-bottom: 8px;
}

/* ===== ARTICLE IMAGES ===== */
.article img,
.ql-editor img {
    display: block;
    margin: 20px auto;
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 6px;
}

.article-image {
    margin: 28px 0;
    text-align: center;
}

.article-image img {
    margin: 0 auto;
}

/* Standard image sizes */
.article-image img.img-small,
.article img.img-small,
.ql-editor img.img-small { width: 40%; }

.article-image img.img-medium,
.article img.img-medium,
.ql-editor img.img-medium { width: 60%; }

.article-image img.img-large,
.article img.img-large,
.ql-editor img.img-large { width: 80%; }

.article-image img.img-full,
.article img.img-full,
.ql-editor img.img-full { width: 100%; }

/* Centered images in editor */
.ql-editor img {
    display: block;
    margin: 12px auto;
    height: auto;
    cursor: pointer;
}

/* Image resize toolbar */
.img-resize-bar {
    position: absolute;
    display: flex;
    gap: 4px;
    background: #2c2420;
    border-radius: 6px;
    padding: 4px 6px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
    transform: translateX(-50%);
}
.img-resize-bar button {
    background: none;
    border: 1px solid rgba(255,255,255,.3);
    color: #faf7f2;
    font-size: 0.75rem;
    font-family: Georgia, serif;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s;
}
.img-resize-bar button:hover,
.img-resize-bar button.active {
    background: #c45d3e;
    border-color: #c45d3e;
}

.article-image figcaption {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.8rem;
    font-style: italic;
    color: #8a7e74;
    text-align: center;
    margin-top: 8px;
    line-height: 1.4;
}

/* ===== CTA BLOCK ===== */
.cta-block {
    margin: 36px 0;
    padding: 28px 32px;
    background: #f5f0e8;
    border: 1px solid #e0d6ca;
    border-radius: 10px;
    text-align: center;
}

.cta-block h3 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.15rem;
    color: #2c2420;
    margin: 0 0 12px;
}

.cta-text {
    font-size: 0.95rem;
    color: #5c524a;
    line-height: 1.6;
    margin: 0 0 20px;
}

.cta-button {
    display: inline-block;
    background: #c45d3e;
    color: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1rem;
    font-weight: 700;
    padding: 14px 32px;
    border-radius: 8px;
    text-decoration: none;
    transition: background .2s, transform .15s;
}

.cta-button:hover {
    background: #a84d33;
    transform: translateY(-1px);
}

.ad-label {
    font-size: 0.7rem;
    color: #a89e94;
    margin: 14px 0 0;
    line-height: 1.3;
}

/* ===== PRICE COMPARISON ===== */
.price-comparison { margin: 16px 0 24px; }
.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e0d6ca;
}
.price-old { background: #f5ece4; }
.price-label { font-size: 0.95rem; color: #5c524a; }
.price-value { font-weight: 700; color: #c45d3e; font-size: 0.95rem; }

/* ===== STEPS ===== */
.steps { margin: 24px 0; }
.step { display: flex; gap: 16px; margin-bottom: 24px; }
.step-number {
    flex-shrink: 0;
    width: 36px; height: 36px;
    background: #c45d3e;
    color: #faf7f2;
    border-radius: 50%;
    display: flex;
    align-items: center; justify-content: center;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700; font-size: 0.95rem;
    margin-top: 2px;
}
.step-content h3 { margin-bottom: 6px; }
.step-content h3::before { content: none; }
.step-content p { font-size: 0.95rem; margin-bottom: 8px; }
.step-content ul { font-size: 0.95rem; }

/* ===== CTA BLOCK ===== */
.cta-block {
    background: #f4f1e8;
    border: 1px solid #e0d6ca;
    border-left: 4px solid #c45d3e;
    border-radius: 0 4px 4px 0;
    padding: 28px;
    margin: 32px 0;
    text-align: center;
}
.cta-final { background: #f0ece3; border-color: #d4c9bb; border-left-color: #c45d3e; }
.cta-text { font-size: 1rem; color: #3a322c; margin-bottom: 16px; }
.cta-block h3 {
    font-family: Georgia, "Times New Roman", serif;
    color: #2c2420;
    margin-bottom: 12px;
}
.cta-block h3::before { content: none; }
.cta-button {
    display: inline-block;
    background: #c45d3e; color: #fff;
    text-decoration: none;
    padding: 14px 32px;
    border-radius: 4px;
    font-size: 1rem; font-weight: 600;
    transition: background 0.2s;
}
.cta-button:hover { background: #a8462d; color: #fff; }
.ad-label { font-size: 0.7rem; color: #8a7e74; margin-top: 12px; margin-bottom: 0; }

/* ===== COMPARISON TABLE ===== */
.comparison-table { margin: 16px 0 24px; overflow: hidden; border: 1px solid #e0d6ca; }
.comparison-row { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.comparison-row span { padding: 10px 12px; font-size: 0.85rem; border-bottom: 1px solid #e0d6ca; color: #5c524a; }
.comparison-header { background: #f4f1e8; }
.comparison-header span { font-weight: 700; color: #2c2420; font-size: 0.8rem; }
.comparison-highlight { background: #edf5ee; }
.comparison-highlight span { color: #2e7d32; }

@media (max-width: 480px) {
    .comparison-row { grid-template-columns: 1fr; }
    .comparison-row span { padding: 6px 12px; border-bottom: none; }
    .comparison-row span:first-child { font-weight: 600; padding-top: 12px; }
    .comparison-row span:last-child { padding-bottom: 12px; border-bottom: 1px solid #e0d6ca; }
    .comparison-header { display: none; }
}

/* ===== TIP BLOCK ===== */
.tip-block {
    background: #f9f3e8;
    border-left: 4px solid #d4a053;
    padding: 16px 20px;
    margin: 24px 0;
}
.tip-block h3 { color: #b8862c; margin-bottom: 8px; font-size: 0.95rem; }
.tip-block h3::before { content: none; }
.tip-block p { font-size: 0.95rem; margin-bottom: 0; }

/* ===== RESULTS ===== */
.results { margin: 16px 0 24px; }
.result-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid #e0d6ca;
    font-size: 0.95rem; color: #3a322c;
}
.result-icon { color: #2e7d32; font-weight: 700; font-size: 1.1rem; flex-shrink: 0; }

/* ===== FAQ ===== */
.faq { margin: 16px 0; }
.faq-item { border-bottom: 1px solid #e0d6ca; }
.faq-item summary {
    padding: 14px 0; cursor: pointer;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 600;
    font-size: 0.95rem; color: #2c2420; list-style: none;
    display: flex; justify-content: space-between; align-items: center;
}
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: #c45d3e; font-weight: 300; flex-shrink: 0; margin-left: 12px; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p { padding: 0 0 16px; font-size: 0.9rem; color: #5c524a; }

/* ===== FOOTER ===== */
.site-footer {
    padding: 24px 0;
    text-align: center;
    border-top: 3px double #e0d6ca;
    margin-top: 24px;
}
.site-footer p { font-size: 0.75rem; color: #8a7e74; }

/* ===== ARTICLE FOOTER ACTIONS (лайки, ссылки) ===== */
.article-footer-actions {
    padding: 32px 0 8px;
    border-top: 1px solid #e0d6ca;
    margin-top: 32px;
    text-align: center;
}

.like-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
    position: relative;
}

.like-btn,
.dislike-btn {
    background: #fff;
    border: 1.5px solid #e0d6ca;
    border-radius: 24px;
    padding: 10px 22px;
    cursor: pointer;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s;
    font-family: Georgia, "Times New Roman", serif;
    color: #8a7e74;
    line-height: 1;
}

.like-btn:hover {
    border-color: #c45d3e;
    color: #c45d3e;
    background: #fdf5f0;
}

.like-btn.liked {
    background: #c45d3e;
    color: #fff;
    border-color: #c45d3e;
}

.like-btn.liked:hover {
    background: #a8462d;
}

.like-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.dislike-btn {
    padding: 10px 16px;
    font-size: 1rem;
}

.dislike-btn:hover {
    border-color: #8a7e74;
    background: #f5f0eb;
}

.dislike-popup {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: #2c2420;
    color: #faf7f2;
    padding: 14px 18px;
    border-radius: 10px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.85rem;
    font-style: italic;
    line-height: 1.5;
    max-width: 300px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    white-space: normal;
    box-shadow: 0 4px 16px rgba(44,36,32,0.2);
}

.dislike-popup.show {
    opacity: 1;
    pointer-events: auto;
}

.dislike-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #2c2420;
}

.author-links {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.author-link-btn,
.subscribe-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.author-link-btn {
    background: #fff;
    color: #2c2420;
    border: 1.5px solid #e0d6ca;
}

.author-link-btn:hover {
    background: #fdf5f0;
    border-color: #c45d3e;
    color: #c45d3e;
}

.subscribe-link-btn {
    background: #c45d3e;
    color: #fff;
    border: 1.5px solid #c45d3e;
}

.subscribe-link-btn:hover {
    background: #a8462d;
    border-color: #a8462d;
}

@media (max-width: 480px) {
    .like-btn { padding: 9px 18px; }
    .dislike-btn { padding: 9px 14px; }
    .author-link-btn,
    .subscribe-link-btn {
        padding: 10px 18px;
        font-size: 0.85rem;
        flex: 1;
        justify-content: center;
    }
    .dislike-popup {
        max-width: 260px;
        font-size: 0.8rem;
    }
}

/* ============================================================
   ADMIN PANEL STYLES — тёплый стиль блога
   ============================================================ */

.admin-body {
    background: #faf7f2;
}

/* Login */
.admin-login {
    max-width: 340px;
    margin: 100px auto;
    text-align: center;
    background: #fff;
    padding: 40px 36px;
    border-radius: 12px;
    border: 1px solid #e8e0d8;
    box-shadow: 0 2px 16px rgba(44,36,32,0.06);
}

.admin-login h1 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: #2c2420;
}

.admin-login h1::before { content: none; }

.admin-login p {
    font-size: 0.85rem;
    color: #8a7e74;
    margin-bottom: 20px;
}

.admin-login input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e8e0d8;
    border-radius: 8px;
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 8px;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.2s;
    background: #faf7f2;
}

.admin-login input:focus {
    border-color: #c45d3e;
}

.admin-login button {
    width: 100%;
    padding: 12px;
    background: #c45d3e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.admin-login button:hover {
    background: #a8462d;
}

.error {
    color: #c45d3e;
    font-size: 0.85rem;
    margin-top: 12px;
}

/* Admin header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-header h1 {
    font-size: 1.4rem;
    margin: 0;
    color: #2c2420;
}

.admin-header h1::before { content: none; }

.admin-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-new { background: #c45d3e; color: #fff; }
.btn-new:hover { background: #a8462d; }
.btn-export { background: #6b5d53; color: #fff; }
.btn-export:hover { background: #564a42; }
.btn-logout { background: #ede8e3; color: #6b5d53; }
.btn-logout:hover { background: #e0d6ca; }
.btn-back { background: #ede8e3; color: #6b5d53; }
.btn-back:hover { background: #e0d6ca; }

/* Admin table */
.admin-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e8e0d8;
    border-collapse: collapse;
}

.admin-table th {
    background: #f5f0eb;
    padding: 12px 16px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    color: #6b5d53;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table td {
    padding: 12px 16px;
    border-top: 1px solid #ede8e3;
    font-size: 0.9rem;
    color: #2c2420;
}

.admin-table .actions {
    white-space: nowrap;
}

.btn-edit {
    padding: 4px 12px;
    background: #fdf5f0;
    color: #c45d3e;
    border: 1px solid #f0d4c8;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 4px;
    transition: all 0.15s;
}

.btn-edit:hover { background: #f8e4da; }

.btn-delete {
    padding: 4px 12px;
    background: #fff;
    color: #a04030;
    border: 1px solid #e8d0c8;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.15s;
}

.btn-delete:hover { background: #fef0ec; }

/* Editor form */
.editor-form {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid #e8e0d8;
}

.editor-form label {
    display: block;
    margin-bottom: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b5d53;
}

.editor-form input[type="text"],
.editor-form input[type="date"],
.editor-form textarea {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0d6ca;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    margin-top: 6px;
    outline: none;
    transition: border-color 0.2s;
    background: #faf7f2;
}

.editor-form input:focus,
.editor-form textarea:focus {
    border-color: #c45d3e;
    background: #fff;
}

/* CTA settings collapsible */
.cta-settings {
    margin-bottom: 16px;
    border: 1px solid #e0d6ca;
    border-radius: 6px;
    padding: 0;
}
.cta-settings summary {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #8a7e74;
    font-weight: 600;
}
.cta-settings[open] summary {
    border-bottom: 1px solid #e0d6ca;
    margin-bottom: 8px;
}
.cta-settings label {
    padding: 0 14px;
}

/* Editor mode bar (sticky — always visible) */
.editor-mode-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: #f5f0eb;
    border: 1px solid #e0d6ca;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    margin-top: 6px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 50;
}

.mode-btn {
    padding: 5px 12px;
    background: #fff;
    border: 1px solid #e0d6ca;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #6b5d53;
    transition: all 0.2s;
}

.mode-btn:hover { background: #fdf5f0; border-color: #c45d3e; color: #c45d3e; }
.mode-btn.mode-active { background: #c45d3e; color: #fff; border-color: #c45d3e; }
.mode-spacer { flex: 1; }

/* Quill container (bubble theme) */
#quill-container {
    background: #fff;
    border: 1px solid #e0d6ca;
    border-top: none;
    border-radius: 0 0 6px 6px;
    min-height: 500px;
    position: relative;
    overflow: visible;
}

#quill-container .ql-editor {
    min-height: 500px;
    max-height: none;
    overflow-y: visible;
    font-size: 0.95rem;
    line-height: 1.75;
    padding: 20px 20px 20px 48px;
    color: #2c2420;
}

/* Bubble tooltip: ensure visible */
#quill-container .ql-tooltip {
    z-index: 100;
}

#quill-container .ql-container.ql-bubble {
    border: none;
}

/* Compact paragraph spacing in editor */
#quill-container .ql-editor p {
    margin-bottom: 6px;
}

#quill-container .ql-editor h2,
#quill-container .ql-editor h3 {
    margin-top: 16px;
    margin-bottom: 8px;
}

/* No decorative dash in editor headings */
#quill-container .ql-editor h2::before {
    content: none;
}

/* Images in editor */
#quill-container .ql-editor img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 12px auto;
    border: 1px solid #e0d6ca;
    border-radius: 4px;
    min-height: 60px;
    min-width: 80px;
    background: #f5f0eb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%238a7e74'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E") center center no-repeat;
    cursor: pointer;
}

#quill-container .ql-editor img[src] {
    background: none;
}

#quill-container .ql-editor img:hover {
    outline: 2px solid #c45d3e;
    outline-offset: 2px;
}

#quill-container .ql-editor img.selected-image {
    outline: 3px solid #c45d3e;
    outline-offset: 2px;
}

/* Drag and drop hover */
.ql-editor.drag-over {
    background: #fdf5f0 !important;
    outline: 2px dashed #c45d3e;
    outline-offset: -4px;
}

/* HTML editor textarea */
#html-editor {
    font-family: "Consolas", "Monaco", monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    width: 100%;
    min-height: 400px;
    padding: 16px;
    border: 1px solid #e0d6ca;
    border-top: none;
    border-radius: 0 0 6px 6px;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    background: #faf7f2;
}

#html-editor:focus { border-color: #c45d3e; background: #fff; }

/* ===== "+" BUTTON (ZEN-STYLE) ===== */
.editor-plus {
    position: absolute;
    left: 8px;
    display: none;
    align-items: center;
    transform: translateY(-50%);
    z-index: 10;
}

.editor-plus-toggle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid #d0c8c0;
    background: #fff;
    color: #8a7e74;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    line-height: 1;
    padding: 0;
}

.editor-plus-toggle:hover {
    border-color: #c45d3e;
    color: #c45d3e;
}

.editor-plus.open .editor-plus-toggle {
    transform: rotate(45deg);
    border-color: #c45d3e;
    color: #c45d3e;
    background: #fdf5f0;
}

.editor-plus-menu {
    display: none;
    position: absolute;
    left: 36px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border: 1px solid #e0d6ca;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(44,36,32,0.1);
    overflow: hidden;
    white-space: nowrap;
}

.editor-plus.open .editor-plus-menu {
    display: block;
}

.editor-plus-menu button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: left;
    transition: background 0.1s;
    color: #2c2420;
}

.editor-plus-menu button:hover {
    background: #f5f0eb;
}

/* Emoji picker */
#emoji-picker-wrap {
    display: none;
    z-index: 200;
}

.emoji-picker-custom {
    background: #fff;
    border: 1px solid #e0d6ca;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(44,36,32,0.1);
    overflow: hidden;
    max-width: 380px;
}

.emoji-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #ede8e3;
    overflow-x: auto;
}

.emoji-tab {
    flex: 1;
    padding: 7px 4px;
    border: none;
    background: #fff;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s;
    min-width: 34px;
    border-bottom: 2px solid transparent;
}

.emoji-tab:hover { background: #f5f0eb; }
.emoji-tab-active { background: #fdf5f0; border-bottom-color: #c45d3e; }

.emoji-search {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid #ede8e3;
    font-size: 0.85rem;
    outline: none;
    box-sizing: border-box;
    background: #faf7f2;
}

.emoji-search:focus { background: #fff; }

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 1px;
    padding: 6px;
    max-height: 260px;
    overflow-y: auto;
}

.emoji-btn {
    padding: 3px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    font-size: 1.15rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    transition: background 0.1s;
}

.emoji-btn:hover { background: #f5f0eb; }

/* Image modal */
.editor-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(44,36,32,0.35);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 2000;
    overflow-y: auto;
    padding: 40px 16px;
}

.editor-modal {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(44,36,32,0.15);
    width: 90%;
    max-width: 480px;
    flex-shrink: 0;
}

.editor-modal h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
    color: #2c2420;
}

.editor-modal h3::before { content: none; }

.editor-modal label {
    display: block;
    margin-bottom: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b5d53;
}

.editor-modal input {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e0d6ca;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-top: 4px;
    outline: none;
    box-sizing: border-box;
    background: #faf7f2;
}

.editor-modal input:focus,
.editor-modal textarea:focus { border-color: #c45d3e; background: #fff; }

.img-path-input {
    display: flex;
    align-items: center;
    margin-top: 4px;
}

.img-prefix {
    padding: 8px 4px 8px 12px;
    background: #f5f0eb;
    border: 1px solid #e0d6ca;
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-family: monospace;
    font-size: 0.85rem;
    color: #8a7e74;
    white-space: nowrap;
}

.img-path-input input {
    border-radius: 0 6px 6px 0;
    margin-top: 0;
}

.img-preview {
    min-height: 80px;
    border: 1px dashed #e0d6ca;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 12px 0;
    padding: 8px;
    background: #faf7f2;
}

.img-preview-placeholder { font-size: 0.8rem; color: #8a7e74; margin: 0; }
.img-preview-error { font-size: 0.8rem; color: #c45d3e; margin: 0; }

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.btn-save {
    padding: 10px 24px;
    background: #c45d3e;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-save:hover { background: #a8462d; }

.btn-preview {
    padding: 10px 24px;
    background: #fff;
    color: #6b5d53;
    border: 1px solid #e0d6ca;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-preview:hover { background: #f5f0eb; }

/* Preview area — matches main site styling */
#preview-area {
    margin-top: 24px;
    background: #faf7f2;
    padding: 32px 40px;
    border-radius: 8px;
    border: 1px solid #e0d6ca;
}

.preview-label {
    font-size: 0.8rem;
    color: #8a7e74;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0d6ca;
}

/* CTA modal preview */
.cta-modal-preview {
    margin: 16px 0;
    padding: 16px;
    background: #faf7f2;
    border: 1px solid #e0d6ca;
    border-radius: 6px;
}
