﻿/* За админ заглавната лента */
.admin-header, .site-header {
    position: sticky;
    top: 0;
    z-index: 1050; /* Над всичко останало */
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* За тулбара на редактора - под заглавната лента */
.tiptap-toolbar {
    position: sticky;
    top: 160px; /* Стойността на височината на твоя админ хедър */
    z-index: 1040;
    background: white;
}


.cms-block-standard {
    width: 100%;
}

.cms-block-specific {
    width: 100%;
}

.cms-block-empty {
    color: #888;
    font-style: italic;
    padding: 1rem 0;
}

/* EDIT MODE — рамка + hover */
.cms-block-host-edit {
    position: relative;
    border: 2px dashed transparent;
    padding: 0;
    margin: 0;
    background: none;
}

    .cms-block-host-edit:hover {
        border-color: #007bff;
        background: rgba(0, 123, 255, 0.05);
    }

/* Бутоните се появяват само при hover */
.hover-tools {
    position: absolute;
    top: -14px;
    right: -14px;
    display: none;
    gap: 6px;
}

.cms-block-host-edit:hover .hover-tools {
    display: flex;
}

.tiptap-editor {
    display: block;
    width: 100%;
    min-height: 150px;
    border: 1px solid #ccc;
    padding: 12px;
    border-radius: 6px;
}

    .tiptap-editor .ProseMirror {
        outline: none;
        min-height: 150px;
    }

/*           _______       ! ! !        __________        */

/* Основният контейнер */
.cms-image-text-block {
    border-radius: 8px; /* Опционално, за по-мек вид при наличие на фон */
    transition: background-color 0.3s ease;
    overflow: hidden; /* Важно за заоблянето на ъглите */
    transition: all 0.2s ease;
}

/* Основен стил за картинката */
.cms-image-text-block img {
    width: var(--image-width, auto);
    max-width: 100%;
    height: auto;
    transition: all 0.3s ease;
    /* Подобрява изобразяването */
    object-fit: cover;
    image-rendering: -webkit-optimize-contrast;
    aspect-ratio: attr(width) / attr(height); /* Запазва мястото на картинката преди да се зареди */
}

/* Това гарантира, че текстът и картинката са винаги подравнени, 
   независимо дали блокът има фон или не */
.cms-content-wrapper {
    padding: 2rem; /* Еднакво отстояние за всички блокове */
    width: 100%;
}

/* Контейнерът на текста */
.cms-block-text {
    flex: 1;
    display: block;
    line-height: 1.6;
}

    .cms-block-text a {
        /* Използва променливата, ако я има, иначе пада до синьо (#007bff) */
        color: var(--cms-link-color, #007bff) !important;
        text-decoration: underline;
        transition: filter 0.2s;
    }

        .cms-block-text a:hover {
            filter: brightness(1.2); /* Автоматично леко "светване" при посочване */
            text-decoration: double underline;
        }

/* Когато блокът е в Edit Mode, линковете също трябва да са видими */
.tiptap-editor a {
    color: var(--cms-link-color, #007bff);
}


/* TipTap Viewer - правим го inline, за да може текстът вътре да обтича картинката */
[id^="viewer-"] {
    display: inline;
}

/* Гарантираме, че TipTap и Viewer наследяват цвета */
.cms-block-text,
[id^="viewer-"],
.tiptap.ProseMirror {
    color: inherit; /* Взима цвета от GetTextStyles() */
}

/* РЕСПОНСИВ ЛОГИКА */
@media (max-width: 767.98px) {
    .cms-image-text-block img {
        /* На мобилни картинката е винаги центрирана и голяма */
        width: 100% !important;
        float: none !important;
        margin: 0 0 1.5rem 0 !important; /* Разстояние само отдолу */
        display: block;
    }

    /* Нулираме отместванията, които Bootstrap класовете (ms-md-4 / me-md-4) биха добавили */
    .cms-image-text-block .ms-md-4,
    .cms-image-text-block .me-md-4 {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* _________________________________________________________________ */

/* Стилизиране на таблиците  */
.table {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
    margin: 0;
    overflow: hidden;
}

.td,
.th {
    min-width: 1em;
    /* Светло сива пунктирана линия, за да виждаш клетките без да пречи на дизайна */
    border: 1px dashed #ced4da;
    padding: 3px 5px;
    vertical-align: top;
    box-sizing: border-box;
    position: relative;
}

/* Когато клетката е маркирана или активна */
.selectedCell:after {
    background: rgba(200, 200, 255, 0.4);
    content: "";
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    pointer-events: none;
    position: absolute;
    z-index: 2;
}

/* Когато минеш с мишката над таблица - показваме по-ясно рамките */
.table:hover td {
    border-color: #adb5bd;
}

/*   -----------------------------------------------------    */
/* The Sidebar Container */
.cms-inspector-pane {
    position: fixed;
    top: 0;
    right: -450px; /* Start hidden */
    width: 400px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    z-index: 2000; /* Above the sticky header */
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

    .cms-inspector-pane.open {
        right: 0;
    }

/* Background Overlay (Dimmer) */
.cms-inspector-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.1); /* Намали прозрачността, за да виждаш по-добре */
    z-index: 1999;
    backdrop-filter: none !important; /* ПРЕМАХНИ ТОВА, за да няма Blur */
}

.inspector-header {
    padding: 1rem;
    background: #212529;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
/*  _____________________________________________________  */

.upload-zone {
    border: 2px dashed #dee2e6 !important;
    background: #f8f9fa;
    transition: all 0.2s;
}

    .upload-zone:hover {
        background: #e9ecef;
        border-color: #0d6efd !important;
    }

.cursor-pointer {
    cursor: pointer;
}

.tiny-label {
    font-size: 0.65rem;
    font-weight: bold;
}

/*  ______________________________________  */