@import url('https://fonts.googleapis.com/css2?family=Oswald&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Caveat&family=Pacifico&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&family=Orelega+One&display=swap');


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Oswald', sans-serif;

}

:root {
    --primary-color: #7BA88E;      /* Мятно-зеленый */
    --secondary-color: #E6DFD3;    /* Серовато-бежевый */
    --accent-color: #bd5d25;       /* Грибной бежевый */
    --text-color: #3F4A3E;
    --transparent-color: rgba(63, 74, 62, 0.4);
    --dark-color: #157a0c;
    --light-color: #C8DCC8;
    --shadow: 0 5px 15px rgba(63, 74, 62, 0.12);
    --active-shadow: 0 5px 15px rgba(123, 168, 142, 0.35);
    --all-content-width: 1366px;
    --select-width: 320px;
    --select-font-size: 14px;
    --select-pad-x: 14px;
    --select-pad-y: 10px;
    --select-radius: 8px;
    --select-bg: #ffffff;
    --select-color: #111827;
    --select-border: 1px solid #d1d5db;
    --select-focus-color: #d4b8a5;
    --select-arrow-color: #6b7280;
    --select-arrow-size: 14px;
    --header-height: clamp(8.75rem, 7.051vw + 7.163rem, 15.625rem);

  }


.post-editor {
    max-width: var(--all-content-width);
    margin: 0 auto;
    padding: 32px 24px 72px;
    color: var(--text-color);
}

.post-editor h1 {
    margin: 0 0 24px;
    font-size: 30px;
    font-weight: 700;
    color: var(--dark-color);
    letter-spacing: -0.01em;
}

.post-editor h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 18px;
    font-size: 20px;
    font-weight: 700;
    color: var(--dark-color);
}

.post-editor h2::before {
    content: "";
    width: 4px;
    height: 20px;
    border-radius: 2px;
    background: var(--accent-color);
}

.post-editor hr {
    border: none;
    border-top: 1px dashed var(--secondary-color);
    margin: 36px 0;
}

/* ---------- 2. Поля формы (input / select / textarea) ---------- */

.post-editor input[type="text"],
.post-editor input[type="url"],
.post-editor input[type="datetime-local"],
.post-editor textarea,
.post-editor select {
    width: 100%;
    padding: 10px 14px;
    font: inherit;
    color: var(--text-color);
    background: #fff;
    border: 1.5px solid var(--secondary-color);
    border-radius: 10px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.post-editor input[type="text"]:focus,
.post-editor input[type="url"]:focus,
.post-editor input[type="datetime-local"]:focus,
.post-editor textarea:focus,
.post-editor select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(123, 168, 142, .22);
}

.post-editor ::placeholder {
    color: var(--transparent-color);
}

/* Select со своей стрелкой */
.post-editor select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237BA88E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

.post-editor textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.55;
}

/* ---------- 3. Основная форма поста (#post-form) ---------- */

#post-form {
    background: #fff;
    border: 1px solid var(--secondary-color);
    border-radius: 16px;
    padding: 26px 28px;
    box-shadow: var(--shadow);
}

#post-form p {
    margin: 0 0 18px;
}

#post-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--dark-color);
}

#post-form input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

#post-form input[type="file"] {
    width: 100%;
    padding: 9px 12px;
    background: #FCFBF7;
    border: 1.5px dashed var(--secondary-color);
    border-radius: 10px;
    font-size: 14px;
}

#post-form .helptext {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--transparent-color);
}

#post-form .errorlist {
    margin: 5px 0 0;
    padding-left: 18px;
    font-size: 13px;
    color: #b3402f;
}

/* ---------- 4. Кнопки ---------- */

/* «Сохранить» */
#post-form button[type="submit"] {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 11px 30px;
    font: inherit;
    font-size: 15px;
    color: #fff;
    background: var(--primary-color);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
}

#post-form button[type="submit"]:hover {
    background: #649378;
    box-shadow: var(--active-shadow);
}

#post-form button[type="submit"]:active {
    transform: translateY(1px);
}

/* «Удалить» внутри блока */
.block-row > button[type="button"], .del_img_btn {
    padding: 8px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-color);
    background: transparent;
    border: 1.5px solid rgba(189, 93, 37, .4);
    border-radius: 10px;
    cursor: pointer;
    transition: all .2s ease;
}

.block-row > button[type="button"]:hover, .del_img_btn:hover  {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

/* «+ Добавить блок» (кнопка сразу после контейнера) */
#blocks-container + button[type="button"] {
    width: 100%;
    margin-top: 16px;
    padding: 14px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--dark-color);
    background: transparent;
    border: 2px dashed rgba(123, 168, 142, .55);
    border-radius: 14px;
    cursor: pointer;
    transition: all .2s ease;
}

#blocks-container + button[type="button"]:hover {
    border-style: solid;
    border-color: var(--primary-color);
    background: rgba(200, 220, 200, .22);
    color: var(--dark-color);
}

/* ---------- 5. Контейнер блоков и карточка блока ---------- */

#blocks-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.block-row {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) auto auto;
    gap: 14px;
    align-items: start;
    padding: 18px 18px 18px 20px;
    background: #fff;
    border: 1px solid var(--secondary-color);
    border-radius: 16px;
    box-shadow: var(--shadow);
    animation: block-appear .3s ease;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.block-row:hover {
    border-color: rgba(123, 168, 142, .5);
}

/* Контентная зона блока (x-show-обёртки) */
.block-row > div {
    min-width: 0;
}

.block-row textarea {
    min-height: 96px;
}

.block-row input[type="url"] {
    width: 100%;
}

/* Превью одиночной картинки */
.block-row > div > img {
    display: block;
    margin-top: 12px;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--secondary-color);
}

.block-row video {
    max-width: 100%;
    border-radius: 12px;
}

@keyframes block-appear {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- 6. Drag & drop (Sortable.js) ---------- */

.drag-handle {
    padding: 6px 2px;
    font-size: 20px;
    line-height: 1;
    color: var(--transparent-color);
    cursor: grab;
    user-select: none;
    transition: color .2s ease;
}

.drag-handle:hover {
    color: var(--primary-color);
}

.drag-handle:active {
    cursor: grabbing;
}

/* «Призрак» на месте перетаскивания */
#blocks-container .sortable-ghost,
.gallery-thumbs .sortable-ghost {
    opacity: .45;
    border: 2px dashed var(--primary-color);
    background: rgba(200, 220, 200, .3);
    box-shadow: none;
}

/* Выбранный элемент */
#blocks-container .sortable-chosen {
    border-color: var(--primary-color);
    box-shadow: var(--active-shadow);
}

/* Летающая копия (fallback-режим Sortable) */
.sortable-drag {
    opacity: 1 !important;
    box-shadow: var(--active-shadow) !important;
    transform: rotate(1deg);
}

/* ---------- 7. Dropzone: кастомные зоны загрузки ---------- */

.dropzone-custom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    padding: 22px;
    text-align: center;
    background: #FBFAF6;
    border: 2px dashed rgba(123, 168, 142, .5);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}

.dropzone-custom:hover,
.dropzone-custom.dz-drag-hover {
    border-color: var(--primary-color);
    background: rgba(200, 220, 200, .25);
}

.dropzone-gallery {
    min-height: 120px;
    justify-content: flex-start;
}

/* Подсказка внутри зоны */
.dropzone-custom .dz-message {
    width: 100%;
}

.dropzone-custom.dz-started .dz-message {
    display: none;
}

.dropzone-custom .dz-icon {
    margin-bottom: 6px;
    font-size: 34px;
    transition: transform .2s ease;
}

.dropzone-custom.dz-drag-hover .dz-icon {
    transform: scale(1.15);
}

.dropzone-custom .dz-text {
    font-weight: 600;
    color: var(--dark-color);
}

.dropzone-custom .dz-subtext {
    margin-top: 3px;
    font-size: 13px;
    color: var(--transparent-color);
}

.dropzone-custom .dz-link {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
}

.dropzone-custom .dz-hint {
    margin-top: 9px;
    font-size: 12px;
    letter-spacing: .04em;
    color: var(--transparent-color);
}

/* Превью файлов, которые Dropzone.js вставляет в зону */
.dropzone-custom .dz-preview {
    display: inline-block;
    margin: 8px;
    padding: 6px;
    vertical-align: top;
    background: #fff;
    border: 1px solid var(--secondary-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.dropzone-custom .dz-image {
    overflow: hidden;
    border-radius: 9px;
}

.dropzone-custom .dz-image img {
    display: block;
    width: 100px;
    height: 100px;
    object-fit: cover;
}

.dropzone-custom .dz-progress {
    margin-top: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--secondary-color);
    overflow: hidden;
}

.dropzone-custom .dz-upload {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--primary-color);
    transition: width .3s ease;
}

.dropzone-custom .dz-success-mark,
.dropzone-custom .dz-error-mark {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
}

.dropzone-custom .dz-error-mark { color: #b3402f; }
.dropzone-custom .dz-success-mark { color: var(--primary-color); }

.dropzone-custom .dz-error-message {
    margin-top: 4px;
    font-size: 12px;
    color: #b3402f;
}

.dropzone-custom .dz-remove {
    margin-top: 6px;
    font-size: 12px;
    color: var(--accent-color);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}

/* ---------- 8. Галерея: сетка миниатюр ---------- */

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.gallery-thumbs > * {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform .2s ease, box-shadow .2s ease;
}

.gallery-thumbs > *:hover {
    transform: translateY(-2px);
    box-shadow: var(--active-shadow);
}

.gallery-thumbs img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Кнопка удаления миниатюры (появляется при наведении) */
.gallery-thumbs button {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 13px;
    line-height: 1;
    color: #fff;
    background: rgba(44, 65, 42, .65);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: opacity .2s ease, background .2s ease;
}



.gallery-thumbs button:hover {
    background: var(--accent-color);
}

/* ---------- 9. Состояния HTMX / Alpine ---------- */

/* Элемент, с которого ушёл запрос */
.htmx-request {
    opacity: .55;
    pointer-events: none;
}

/* Плавное исчезновение при hx-delete / замене outerHTML */
.htmx-swapping {
    opacity: 0;
    transition: opacity .18s ease;
}

/* Чтобы скрытые x-show блоки не мигали до инициализации Alpine,
   добавьте им атрибут x-cloak */
[x-cloak] {
    display: none !important;
}

/* ---------- 10. Адаптив ---------- */

@media (max-width: 720px) {
    .post-editor {
        padding: 20px 14px 56px;
    }

    .post-editor h1 {
        font-size: 24px;
    }

    #post-form {
        padding: 20px 18px;
    }

    .block-row {
        grid-template-columns: 1fr auto;
    }

    /* Select и контент — на всю ширину, ручка и «Удалить» — в нижний ряд */
    .block-row > select,
    .block-row > div {
        grid-column: 1 / -1;
    }

    .drag-handle {
        align-self: center;
    }
}

/* стили из основного блока*/

.users-btn {
    -webkit-appearance: none;
    /* Убирает системные стили iOS */
    appearance: none;
    color: var(--text-color) !important;
    background-color: var(--light-color);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    width: 200px;
    margin: 1rem 0;
    text-align: center;
    margin-left: 3rem;
}

.users-btn:hover {
    background-color: var(--accent-color) ;
    color: #fff !important;
}

/*  модалка по поводу главной страницы*/
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-box {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    max-width: 420px;
    width: 90%;
}
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    justify-content: flex-end;
}

.rt-toolbar {
    position: absolute;
    display: flex;
    gap: 4px;
    background: #222;
    padding: 6px;
    border-radius: 4px;
    z-index: 10;
}
.rt-toolbar button {
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.video-embed {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    margin: 1rem 0;
    border-radius: 12px;
    overflow: hidden;
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.rt-editable {
    min-height: 110px;
    padding: 10px 14px;
    background: #fff;
    border: 1.5px solid var(--secondary-color);
    border-radius: 10px;
    line-height: 1.55;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.rt-editable:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(123, 168, 142, .22);
}

/* Выбор поста для редактирования */

.post_choice_container{
    color: var(--text-color);
}
.post_choice_wrapper{
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;

}

.post_choice_block{
    list-style-type: none;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    min-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.post_choice_block:nth-child(odd){
    background-color: var(--secondary-color) ;
}

.post_choice_block img{
    max-width: 200px;
    height: auto;
}


/* Страница поста */

.blog_page_wrapper{
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap:clamp(0.5rem, 1.339vw - 0.357rem, 1.25rem);
    justify-content: center;   
}
.blog_detail_wrapper, .post_list_wrapper{
    padding: clamp(0.5rem, 1.339vw - 0.357rem, 1.25rem);
    text-align: justify;
    hyphens: auto;
    line-height: 1.3;
    display: flex;
    flex-direction: column;
    gap:1rem;
    align-items: center;
    
}
.post_detail_text{
font-size: clamp(0.875rem, 0.347vw + 0.583rem, 1rem);
}
.post-image{
    width: clamp(31.25rem, 16.779vw + 20.491rem, 40.625rem);
    height: auto;
}
.post-image img{
    width: 100%;
    height: auto;
    
}

.post_list_wrapper{
    display: flex;
    flex-direction: column;
    gap:1rem;
}


.post_link_block{
    padding: clamp(0.375rem, 0.868vw - 0.042rem, 1rem);
    border-radius: 0.5rem;
    text-align: left;
    box-shadow: var(--shadow);
}
.post_link_block h3{
    margin-bottom: 0.7rem;
}
.post_link_block p{
    font-size: clamp(0.75rem, 0.347vw + 0.583rem, 1rem);
}

.post_link_block:nth-child(odd){
    background-color: var(--secondary-color) ;
}

.post_list_image{
    width: clamp(4.688rem, 2.79vw + 2.902rem, 6.25rem);
    height: auto;
}
.post_list_image img{
    width: 100%;
    height: auto;
    float: left;
    margin-right: clamp(0.25rem, 1.042vw - 0.25rem, 1rem);
}

@media (max-width: 768px) {
    .blog_page_wrapper{
        display:flex;
        flex-direction: column;
    }
    .post_link_block{
        max-width: 340px;
        padding: clamp(0.5rem, 4.624vw - 0.54rem, 1rem);
    }
    .post_link_block p{
        font-size: clamp(0.875rem, 1.156vw + 0.615rem, 1rem);
    }
    .post_list_wrapper{
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
}

@media (max-width: 533px) {
    .blog_detail_wrapper{
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
        padding: clamp(0.5rem, 4.624vw - 0.54rem, 1rem);
    }
    .post-image{
    width: clamp(21.25rem, 93.023vw + 0.32rem, 31.25rem);
}
    
}

/* Слайдер */
.post-gallery .splide__slide {
position: relative;
text-align: center;
}



.post-gallery .caption {
margin-top: 0.5rem;
font-size: 0.9rem;
color: #666;
}
.splide__list{
max-height: 500px;;
}
.slide-inner {
position: relative;
height: 500px;
overflow: hidden;
border-radius: 8px;
}

.bg-blur {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
filter: blur(20px) brightness(0.7);
transform: scale(1.2); /* чтобы размытые края не просвечивали */
}

.main-img {
position: relative;
z-index: 1;
max-width: 100%;
max-height: 100%;
width: 100%;
height: 100%;
object-fit: contain;
display: block;
margin: 0 auto;
}

/* Ссылки для редоктирования поста*/

.post_edit_link{
list-style-type: none;
}
.post_edit_link a{
padding: 10px 20px;
text-decoration: none;
border: 1px solid var(--dark-color);
border-radius: 0.5rem;
color: var(--dark-color);

}



