/*BLOG HEADER*/
.blog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.blog-header h2 { margin: 0; }

/*FILTERS*/
.blog-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.blog-filters #blog-search {
    width: 100%;
}
.blog-date-range {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.blog-date-range label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8a72b0;
    font-size: 0.9rem;
}

/*ARTICLE CARDS (INDEX)*/
#blog-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    align-items: start;
}
#blog-empty, #blog-no-matches {
    grid-column: 1 / -1;
}

.article-card {
    background-color: #ffffff;
    border: 1px solid #ffe0f2;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(160, 107, 255, 0.1);
}
.article-card:hover {
    box-shadow: 0 10px 28px rgba(160, 107, 255, 0.22);
    transform: translateY(-4px);
}
.article-card-link {
    display: block;
    color: inherit;
}
.article-card-link:hover { text-decoration: none; }

.article-card-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #ffe3f1, #e6e0ff);
}
.article-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.article-card-cover-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    opacity: 0.4;
}
.article-card-cover-badge {
    position: absolute;
    top: 8px;
    right: 8px;
}
.article-card-cover-draft {
    position: absolute;
    top: 8px;
    left: 8px;
}

.article-card-body {
    padding: 14px 16px 16px;
}
.article-card-title {
    margin: 0;
    color: #4a2c7a;
    font-size: 1.1rem;
}
.article-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #8a72b0;
}
.article-card-written {
    display: block;
    margin-top: 8px;
    font-size: 0.78rem;
}
.article-card-admin {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid #ffe7f4;
    flex-wrap: wrap;
}
.article-card-admin .btn {
    font-size: 0.8rem;
    min-height: 36px;
    padding: 6px 12px;
}

/*EF RATING BADGE*/
.ef-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
}
.ef-ef0 { background-color: #4a90d9; }
.ef-ef1 { background-color: #56b000; }
.ef-ef2 { background-color: #f5b800; color: #6a2c9a; }
.ef-ef3 { background-color: #e8730c; }
.ef-ef4 { background-color: #d6361f; }
.ef-ef5 { background-color: #8e1bd1; }

/*DRAFT BADGE*/
.draft-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background-color: #f0e2fb;
    color: #a06bff;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/*ARTICLE VIEW*/
.article-back { margin-bottom: 12px; }
.article-full { overflow: hidden; }

/* Wikipedia-style floating info box */
.article-infobox {
    float: right;
    width: 320px;
    max-width: 42%;
    margin: 4px 0 18px 26px;
    background: #ffffff;
    border: 1px solid #ffe0f2;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(160, 107, 255, 0.18);
}
.infobox-cover { position: relative; line-height: 0; }
.infobox-cover img {
    width: 100%;
    display: block;
    max-height: 280px;
    object-fit: cover;
}
.infobox-cover-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 18px 12px 8px;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
    color: #fff;
    background: linear-gradient(to top, rgba(120, 60, 160, 0.85), rgba(120, 60, 160, 0));
}
.infobox-heading {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700;
    text-align: center;
    color: #fff;
    padding: 8px 12px;
    background: linear-gradient(90deg, #ff6ec4, #a06bff);
}
.infobox-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.infobox-table th,
.infobox-table td {
    text-align: left;
    padding: 9px 14px;
    vertical-align: top;
    border-bottom: 1px solid #ffe7f4;
}
.infobox-table tr:last-child th,
.infobox-table tr:last-child td { border-bottom: none; }
.infobox-table th {
    width: 42%;
    color: #9a6ec0;
    font-weight: 700;
}
.infobox-table td { color: #4a2c7a; font-weight: 600; }

.article-full-head h2 { margin: 0; font-size: 1.8rem; }
.article-full-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    margin: 8px 0;
    font-size: 0.9rem;
    color: #8a72b0;
}
.article-full-admin { margin-bottom: 16px; }

.article-body {
    margin-top: 8px;
    line-height: 1.75;
}
.article-body::after { content: ''; display: block; clear: both; }
.article-text {
    white-space: pre-wrap;
    margin-bottom: 16px;
    font-size: 1.08rem;
}

/* Image blocks: full-width (default) + floated side variants */
.article-figure {
    margin: 20px 0;
    text-align: center;
}
.article-figure img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 6px 20px rgba(160, 107, 255, 0.15);
}
.article-figure figcaption {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #a07ac0;
    font-style: italic;
}
.article-figure-left {
    float: left;
    margin: 6px 24px 14px 0;
    text-align: left;
}
.article-figure-right {
    float: right;
    margin: 6px 0 14px 24px;
    text-align: left;
}
.article-figure-left img, .article-figure-right img { margin: 0; }
.article-figure-small { width: 240px; max-width: 60%; }
.article-figure-medium { width: 340px; max-width: 70%; }
.article-figure-large { width: 460px; max-width: 80%; }

/* Editor: image placement & size controls */
.editor-img-preview { transition: max-width 0.2s ease; }
.editor-img-preview.img-align-left { float: left; margin-right: 12px; }
.editor-img-preview.img-align-right { float: right; margin-left: 12px; }
.editor-img-preview.img-size-small { max-width: 160px; }
.editor-img-preview.img-size-medium { max-width: 240px; }
.editor-img-preview.img-size-large { max-width: 340px; }
.editor-img-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 10px;
    align-items: center;
}
.editor-img-group { display: flex; align-items: center; gap: 6px; }
.editor-img-group-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #9a6ec0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 2px;
}
.editor-img-toggle {
    min-height: 32px;
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    background-color: #f7ecfc;
    color: #a06bff;
    border: 1px solid #ffd9f0;
}
.editor-img-toggle.active {
    background: linear-gradient(135deg, #ff6ec4, #a06bff);
    color: #fff;
    border-color: transparent;
}
.editor-img-toggle:disabled { opacity: 0.4; cursor: default; }

@media (max-width: 768px) {
    .article-infobox {
        float: none;
        width: 100%;
        max-width: 100%;
        margin: 0 0 18px;
    }
    .article-figure-left, .article-figure-right {
        float: none;
        width: 100%;
        max-width: 100%;
        margin: 20px 0;
        text-align: center;
    }
    .article-figure-left img, .article-figure-right img { margin: 0 auto; }
}

/*EDITOR*/
.editor-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.editor-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
    color: #8a72b0;
    flex: 1;
}
.editor-label input, .editor-label select {
    width: 100%;
}
.editor-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.required-mark {
    color: #f5a300;
    font-size: 0.8rem;
    font-weight: 400;
}

.editor-block {
    position: relative;
    border: 1px solid #ffe0f2;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
    background-color: #fff8fd;
}
.editor-block-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-bottom: 8px;
}
.editor-icon-btn {
    min-height: 30px;
    padding: 2px 10px;
    font-size: 0.9rem;
    background-color: #f3e8fc;
    color: #a06bff;
    border-radius: 6px;
}
.editor-icon-btn:hover:not(:disabled) { background-color: #ffe0f4; }
.editor-icon-btn:disabled { opacity: 0.3; cursor: default; }
.editor-icon-btn.editor-block-del:hover:not(:disabled) { background-color: #ff4d6d; color: #fff; }

.editor-text-input {
    width: 100%;
    resize: vertical;
}
.editor-paste-zone {
    border: 2px dashed #e6c8f0;
    border-radius: 8px;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    cursor: text;
    text-align: center;
}
.editor-paste-zone:focus {
    outline: none;
    border-color: #ff6ec4;
    background-color: #fff0f8;
}
.editor-paste-zone img {
    max-width: 100%;
    max-height: 320px;
    border-radius: 6px;
}
.editor-paste-hint {
    color: #a07ac0;
    font-size: 0.85rem;
}
.editor-caption-input {
    width: 100%;
    margin-top: 8px;
}

.editor-add-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.editor-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .editor-row { flex-direction: column; }
}
