@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* ---- Menubar ---- */

.websy-editor__menubar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    background: #f0f2f7;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
}

.websy-editor--has-menubar .websy-editor__toolbar {
    border-radius: 0;
}

.websy-editor__menu {
    position: relative;
}

.websy-editor__menu-btn {
    height: 28px;
    display: inline-flex;
    align-items: center;
    border: none;
    background: transparent;
    border-radius: 5px;
    cursor: pointer;
    color: #444444;
    padding: 0 10px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.websy-editor__menu-btn:hover,
.websy-editor__menu.is-open .websy-editor__menu-btn {
    background-color: #dde1ef;
    color: #111111;
}

.websy-editor__dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.13);
    min-width: 230px;
    z-index: 9999;
    padding: 4px;
    display: none;
    flex-direction: column;
}

.websy-editor__menu.is-open .websy-editor__dropdown {
    display: flex;
}

.websy-editor__dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px;
    border: none;
    background: transparent;
    border-radius: 5px;
    cursor: pointer;
    color: #333333;
    font-size: 13.5px;
    font-family: 'Inter', sans-serif;
    width: 100%;
    text-align: left;
    transition: background-color 0.12s ease;
}

.websy-editor__dropdown-item:hover {
    background-color: #f0f2f7;
}

.websy-editor__dropdown-item.active {
    background-color: #e4e8f5;
    color: #083B9D;
}

.we-dd-icon {
    font-size: 18px;
    line-height: 1;
    color: #666666;
    flex-shrink: 0;
    font-variation-settings: 'wght' 400;
}

.websy-editor__dropdown-item.active .we-dd-icon {
    color: #083B9D;
}

.we-dd-label {
    flex: 1;
    color: #000D54;
}

.we-dd-shortcut {
    font-size: 11.5px;
    color: #aaaaaa;
    flex-shrink: 0;
    font-family: 'Inter', monospace;
    letter-spacing: 0.01em;
}

.websy-editor__dropdown-sep {
    height: 1px;
    background-color: #ebebeb;
    margin: 4px 0;
}

.we-dd-group {
    padding: 5px 10px 3px;
    font-size: 10.5px;
    font-weight: 600;
    color: #999999;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    pointer-events: none;
    user-select: none;
}

/* ---- Editor wrapper ---- */

.websy-editor {
    font-family: 'Inter', sans-serif;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    width: 100%;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.websy-editor:focus-within {
    border-color: #083B9D;
    box-shadow: 0 0 0 3px rgba(8, 59, 157, 0.12);
}

.websy-editor__toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 8px;
    background: #f8f9fb;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
}

.websy-editor__btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: #555555;
    padding: 0;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.websy-editor__btn:hover {
    background-color: #ececec;
    color: #111111;
}

.websy-editor__btn.active {
    background-color: #d8dce3;
    color: #111111;
}

.websy-editor__btn .material-symbols-rounded {
    font-size: 20px;
    font-variation-settings: 'wght' 400;
    line-height: 1;
    user-select: none;
    margin-left: 0;
}

.websy-editor__separator {
    display: inline-block;
    width: 1px;
    height: 22px;
    background-color: #e0e0e0;
    margin: 0 4px;
    flex-shrink: 0;
}

.websy-editor__content {
    padding: 16px 20px;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.75;
    color: #333333;
    border-radius: 0 0 8px 8px;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}

.websy-editor__content p {
    margin: 0 0 0.75em 0;
}

.websy-editor__content p:last-child {
    margin-bottom: 0;
}

.websy-editor__content strong,
.websy-editor__content b {
    font-weight: 600;
}

.websy-editor__content em,
.websy-editor__content i {
    font-style: italic;
}

.websy-editor__content u {
    text-decoration: underline;
}

.websy-editor__content s,
.websy-editor__content strike {
    text-decoration: line-through;
}

.websy-editor__content sup {
    font-size: 0.75em;
    vertical-align: super;
    line-height: 0;
}

.websy-editor__content sub {
    font-size: 0.75em;
    vertical-align: sub;
    line-height: 0;
}

.websy-editor__content ul,
.websy-editor__content ol {
    margin: 0 0 0.75em 0;
    padding-left: 1.75em;
}

.websy-editor__content ul:last-child,
.websy-editor__content ol:last-child {
    margin-bottom: 0;
}

.websy-editor__content li {
    margin-bottom: 0.2em;
    line-height: 1.75;
}

.websy-editor__content ul ul,
.websy-editor__content ul ol,
.websy-editor__content ol ul,
.websy-editor__content ol ol {
    margin: 0.2em 0 0 0;
}

/* ---- Plovoucí tabulkový toolbar ---- */

.we-table-toolbar {
    position: fixed;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    background: #ffffff;
    border: 1px solid #dde1ef;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: translateY(4px);
}

.we-table-toolbar button .material-symbols-rounded {
    margin-left: 0;
}

.we-table-toolbar.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.we-table-toolbar__btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 5px;
    cursor: pointer;
    color: #444444;
    padding: 0;
    flex-shrink: 0;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.we-table-toolbar__btn:hover {
    background-color: #f0f2f7;
    color: #111111;
}

.we-table-toolbar__btn--danger:hover {
    background-color: #fdecea;
    color: #c0392b;
}

.we-table-toolbar__btn .material-symbols-rounded {
    font-size: 18px;
    line-height: 1;
    font-variation-settings: 'wght' 400;
    user-select: none;
}

.we-table-toolbar__sep {
    display: inline-block;
    width: 1px;
    height: 18px;
    background-color: #e0e0e0;
    margin: 0 3px;
    flex-shrink: 0;
}

/* ---- Tabulka v obsahu ---- */

.websy-editor__content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.75em 0;
    font-size: 14px;
}

.websy-editor__content table:last-child {
    margin-bottom: 0;
}

.websy-editor__content td,
.websy-editor__content th {
    border: 1px solid #d0d5e8;
    padding: 7px 12px;
    min-width: 40px;
    vertical-align: top;
    text-align: left;
}

.websy-editor__content th {
    background: #f0f2f7;
    font-weight: 600;
}

.websy-editor__content tr:nth-child(even) td {
    background: #fafbfd;
}

/* ---- Table picker ---- */

.we-table-picker {
    padding: 8px 10px 6px;
}

.we-table-picker__label {
    font-size: 11px;
    font-weight: 600;
    color: #999999;
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.we-table-picker__grid {
    display: grid;
    grid-template-columns: repeat(8, 20px);
    gap: 2px;
}

.we-table-picker__cell {
    width: 20px;
    height: 20px;
    border: 1px solid #dde1ef;
    border-radius: 2px;
    cursor: pointer;
    background: #ffffff;
    transition: background-color 0.08s ease, border-color 0.08s ease;
}

.we-table-picker__cell.is-active {
    background: #e4e8f5;
    border-color: #083B9D;
}

.we-table-picker__size {
    margin-top: 5px;
    font-size: 12px;
    color: #666666;
    text-align: center;
    height: 16px;
    line-height: 16px;
}

/* ---- Modal ---- */

.we-modal-overlay {
    position: fixed;
    width: 100vw;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.70);
    backdrop-filter: blur(5px);
    top: 0;
    left: 0;
    display: none;
    z-index: 1000000;
    align-items: flex-start;
    padding-top: 50px;
    justify-content: center;
}

.we-modal-overlay button .material-symbols-rounded  {
    margin-left: 0;
}

.we-modal-overlay--visible {
    display: flex;
}

.we-modal {
    padding: 30px;
    background-color: white;
    max-height: 90%;
    width: 95%;
    max-width: 640px;
    display: flex;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, .20);
    border-radius: 5px;
    overflow: auto;
    flex-direction: column;
    gap: 30px;
    font-family: var(--websy-font, 'Inter', sans-serif);
}

.we-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--websy-darker-grey, #c2c8ed);
}

.we-modal__title {
    margin: 0;
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--websy-text-color, #000D54);
}

.we-modal__close {
    background: var(--websy-darker-grey, #c2c8ed);
    color: var(--websy-blue, #001DB2);
    border: none;
    cursor: pointer;
    padding: 8px 0px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
}

.we-modal__close:hover {
    background-color: #d5d9f3;
}

.we-modal__close .material-symbols-rounded {
    font-size: 20px;
    line-height: 1;
}

.we-modal__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.we-modal__field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.we-modal__label {
    font-size: 13px;
    font-weight: 500;
    color: var(--websy-text-color, #000D54);
}

.we-modal__input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--websy-border, #E5E5E5);
    border-radius: 5px;
    font-size: 14px;
    font-family: var(--websy-font, 'Inter', sans-serif);
    color: var(--websy-text-color, #000D54);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #ffffff;
}

.we-modal__input:focus {
    border-color: var(--websy-blue, #001DB2);
    box-shadow: 0 0 0 3px rgba(0, 29, 178, 0.1);
}

.we-modal__footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.we-modal__btn {
    background-color: var(--websy-darker-grey, #c2c8ed);
    color: var(--websy-blue, #001DB2);
    border: none;
    padding: 8px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-family: var(--websy-font, 'Inter', sans-serif);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.we-modal__btn:hover {
    background-color: #d5d9f3;
    color: var(--websy-blue, #001DB2);
}

.we-modal__btn--primary {
    background-color: var(--websy-blue, #001DB2);
    color: white;
}

.we-modal__btn--primary:hover {
    background-color: var(--websy-darker-grey, #c2c8ed);
    color: var(--websy-blue, #001DB2);
}

/* ---- Selektor stránek v modálu odkazu ---- */

.we-modal__field--pages {
    gap: 8px;
}

.we-pages-list {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--websy-border, #E5E5E5);
    border-radius: 6px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.we-pages-list__item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    border-radius: 4px;
    padding: 6px 10px;
    padding-left: calc(10px + var(--depth, 0) * 14px);
    font-size: 13.5px;
    font-family: var(--websy-font, 'Inter', sans-serif);
    color: #333333;
    cursor: pointer;
    transition: background-color 0.1s ease, color 0.1s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.we-pages-list__item:hover {
    background-color: #f0f2f7;
    color: var(--websy-blue, #001DB2);
}

.we-pages-list__item.is-selected {
    background-color: #e4e8f5;
    color: var(--websy-blue, #001DB2);
    font-weight: 500;
}

.we-pages-list__arrow {
    flex-shrink: 0;
    color: #aaaaaa;
    font-size: 12px;
    font-style: normal;
}

.we-modal__divider {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    font-weight: 500;
    color: #aaaaaa;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.we-modal__divider::before,
.we-modal__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ebebeb;
}

.we-modal__field--check {
    flex-direction: row;
    align-items: center;
}

.we-modal__check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--websy-text-color, #000D54);
    cursor: pointer;
    user-select: none;
}

.we-modal__check {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--websy-blue, #001DB2);
}

/* ---- Resize obrázků ---- */

.we-img-resize {
    position: fixed;
    z-index: 9997;
    border: 2px solid #083B9D;
    pointer-events: none;
    box-sizing: border-box;
    display: none;
}

.we-img-resize.is-visible {
    display: block;
}

.we-img-resize__handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border: 2px solid #083B9D;
    border-radius: 2px;
    pointer-events: auto;
    box-sizing: border-box;
}

.we-img-resize__handle--nw { top: -5px;    left: -5px;   cursor: nw-resize; }
.we-img-resize__handle--ne { top: -5px;    right: -5px;  cursor: ne-resize; }
.we-img-resize__handle--sw { bottom: -5px; left: -5px;   cursor: sw-resize; }
.we-img-resize__handle--se { bottom: -5px; right: -5px;  cursor: se-resize; }

/* ---- Modal obrázku ---- */

.we-img-overlay {
    align-items: center;
    padding-top: 0;
}

.we-img-modal {
    max-width: 780px;
    width: 95%;
}

.we-img-field {
    gap: 8px;
}

.we-img-browser {
    display: flex;
    gap: 10px;
    height: 240px;
}

.we-img-list {
    flex: 0 0 220px;
    overflow-y: auto;
    border: 1px solid var(--websy-border, #E5E5E5);
    border-radius: 6px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.we-img-list__item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    transition: background-color 0.1s ease;
    min-width: 0;
}

.we-img-list__item:hover {
    background-color: #f0f2f7;
}

.we-img-list__item.is-selected {
    background-color: #e4e8f5;
}

.we-img-list__thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
    background: #f0f2f7;
}

.we-img-list__name {
    font-size: 12px;
    color: #333333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--websy-font, 'Inter', sans-serif);
}

.we-img-preview {
    flex: 1;
    border: 1px solid var(--websy-border, #E5E5E5);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fafbfc;
}

.we-img-preview__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.we-img-preview__placeholder {
    font-size: 13px;
    color: #bbbbbb;
    font-family: var(--websy-font, 'Inter', sans-serif);
}

/* ---- Modal zdrojového kódu ---- */

.we-source-overlay {
    align-items: center;
    padding-top: 0;
}

.we-source-modal {
    max-width: 860px;
    width: 95%;
    max-height: 90vh;
    height: 90vh;
}

.we-source-modal .we-modal__body {
    flex: 1;
    min-height: 0;
}

.we-source-textarea {
    width: 100%;
    height: 100%;
    min-height: 300px;
    padding: 12px;
    border: 1px solid var(--websy-border, #E5E5E5);
    border-radius: 5px;
    font-family: 'Consolas', 'Fira Mono', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #1a1a2e;
    background: #f7f8fc;
    resize: none;
    outline: none;
    box-sizing: border-box;
    tab-size: 4;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.we-source-textarea:focus {
    border-color: var(--websy-blue, #001DB2);
    box-shadow: 0 0 0 3px rgba(0, 29, 178, 0.1);
}

.we-link-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.we-pages-list__group {
    padding: 5px 10px;
    padding-left: calc(10px + var(--depth, 0) * 14px);
    font-size: 11px;
    font-weight: 600;
    color: #888888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    pointer-events: none;
    user-select: none;
}