/* Toolbar Buttons Visibility Fix */
/* This CSS ensures toolbar buttons are always visible */

/* Force toolbar buttons to be visible with HIGH z-index */
.schema-settings-btn,
.schema-share-btn,
.schema-download-btn,
.schema-lock-toggle,
.account-circle {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    /* Much higher z-index to ensure they're above everything */
    z-index: 999999 !important;
    position: fixed !important;
    width: 40px !important;
    height: 40px !important;
    background: white !important;
    border-radius: 8px !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
}

/* Override any conflicting styles from loader or popups */
.canvas-loader ~ .schema-settings-btn,
.canvas-loader ~ .schema-share-btn,
.canvas-loader ~ .schema-download-btn,
.canvas-loader ~ .schema-lock-toggle,
.canvas-loader ~ .account-circle {
    z-index: 999999 !important;
}

/* Ensure buttons stay visible even when body has popup-open class */
body.popup-open .schema-settings-btn,
body.popup-open .schema-share-btn,
body.popup-open .schema-download-btn,
body.popup-open .schema-lock-toggle,
body.popup-open .account-circle {
    display: flex !important;
    visibility: visible !important;
}

/* Specific positioning for each button */
.schema-settings-btn {
    top: 20px !important;
    right: 72px !important;
    border: 1px solid #e5e5e5 !important;
}

.schema-share-btn {
    top: 20px !important;
    right: 124px !important;
    border: 1px solid #e5e5e5 !important;
}

.schema-download-btn {
    top: 20px !important;
    right: 176px !important;
    border: 1px solid #e5e5e5 !important;
}

.schema-lock-toggle {
    top: 20px !important;
    right: 228px !important;
    border: 1px solid #e5e5e5 !important;
}

.account-circle {
    top: 20px !important;
    right: 20px !important;
    border: 1px solid #e5e5e5 !important;
}

/* Ensure SVG icons inside buttons are visible */
.schema-settings-btn svg,
.schema-share-btn svg,
.schema-download-btn svg,
.schema-lock-toggle svg,
.account-circle svg {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: none !important;
}

/* Lock toggle specific styles */
.schema-lock-toggle input {
    display: none !important;
}

.schema-lock-toggle .lock-toggle-slider {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.schema-lock-toggle .lock-open {
    display: block !important;
}

.schema-lock-toggle .lock-closed {
    display: none !important;
}

.schema-lock-toggle input:checked + .lock-toggle-slider .lock-open {
    display: none !important;
}

.schema-lock-toggle input:checked + .lock-toggle-slider .lock-closed {
    display: block !important;
}

/* Locked state styling */
.schema-lock-toggle:has(input:checked) {
    border-color: #f59e0b !important;
    background: #fffbeb !important;
}

/* =================================================== */
/* LOCK MODE - блокировка редактирования текста        */
/* =================================================== */

/* Блокируем редактирование в попапе карточки */
body.locked-mode #card-detail-overlay input,
body.locked-mode #card-detail-overlay textarea,
body.locked-mode #card-detail-overlay [contenteditable] {
    pointer-events: none !important;
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    background: #f5f5f5 !important;
}

/* Блокируем кнопки редактирования в попапе */
body.locked-mode #card-detail-overlay button:not(.close-btn):not([onclick*="closeCardDetail"]) {
    pointer-events: none !important;
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Блокируем inline редактирование на canvas */
body.locked-mode .inline-edit-input {
    pointer-events: none !important;
}

/* Визуальный индикатор блокировки - оранжевая полоска сверху */
body.locked-mode::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    z-index: 999999;
    pointer-events: none;
}

/* Блокируем контекстное меню (правый клик) */
body.locked-mode #card-context-menu {
    display: none !important;
}