/**
 * EASYS Block Manager — スタイル
 * Version: 1.9.16
 */

/* ===========================================================
 * ツールバー（各記事上部）
 * =========================================================== */

.ebm-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: rgba(30, 41, 59, 0.92);
    color: #fff;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.4;
    border-radius: 6px 6px 0 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* 編集モードON時のブロック */
body.ebm-active .easys_content {
    overflow: visible !important;
}

/* files_pc.css の .moved が transform/filter を付けると position:fixed の基準が
   entry_post になってツールバー位置がズレるため、編集モード中はリセット。 */
body.ebm-active .easys_content_inner,
body.ebm-active [class*="entry_post_"] {
    transform: none !important;
    filter: none !important;
    transition: none !important;
}

/* 編集モードON時の記事バー */
body.ebm-active [class*="entry_post_"] {
    transition: outline 0.15s ease;
}

body.ebm-active [class*="entry_post_"]:hover {
    outline: 2px solid rgba(59, 130, 246, 0.7);
    outline-offset: -2px;
}

/* v1.9.3: ツールバー表示はJS mouseenter/mouseleaveで制御 (position:fixed方式) */
.ebm-toolbar.ebm-toolbar-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ブロック名ラベル */
.ebm-label {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 500;
    margin-right: 12px;
    font-size: 12px;
    letter-spacing: 0.02em;
}

/* ボタングループ */
.ebm-buttons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ===========================================================
 * ボタン共通
 * =========================================================== */

.ebm-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.ebm-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.ebm-btn svg {
    flex-shrink: 0;
}

/* 追加ボタン */
.ebm-btn-duplicate:hover {
    background: rgba(59, 130, 246, 0.5);
    border-color: rgba(59, 130, 246, 0.7);
}

/* 削除ボタン */
.ebm-btn-delete:hover {
    background: rgba(239, 68, 68, 0.5);
    border-color: rgba(239, 68, 68, 0.7);
}

/* ===========================================================
 * ローディングオーバーレイ
 * =========================================================== */

.ebm-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.7);
}

.ebm-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(59, 130, 246, 0.25);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: ebm-spin 0.7s linear infinite;
}

@keyframes ebm-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===========================================================
 * 通知メッセージ
 * =========================================================== */

.ebm-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    animation: ebm-slide-in 0.3s ease;
}

@keyframes ebm-slide-in {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ebm-notification-success {
    background: #065f46;
    color: #fff;
}

.ebm-notification-error {
    background: #991b1b;
    color: #fff;
}

.ebm-notification-text {
    flex: 1;
}

.ebm-notification-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.ebm-notification-close:hover {
    color: #fff;
}

/* ===========================================================
 * v1.9.0: ブログ投稿(.hentry)のホバー効果
 * =========================================================== */

body.ebm-active .hentry {
    transition: outline 0.15s ease;
}

body.ebm-active .hentry:hover {
    outline: 2px solid rgba(59, 130, 246, 0.7);
    outline-offset: -2px;
}

/* v1.9.3: .hentry ツールバーもJS制御に移行 */

/* ===========================================================
 * 制限ブロック: ツールバーとホバー効果を無効化
 * =========================================================== */

body.ebm-active .ebm-restricted .ebm-toolbar,
body.ebm-active .ebm-restricted [class*="entry_post_"] > .ebm-toolbar {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

body.ebm-active .ebm-restricted [class*="entry_post_"]:hover {
    outline: none !important;
}

body.ebm-active .ebm-restricted [class*="entry_post_"]:hover > .ebm-toolbar {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ===========================================================
 * v1.9.10: テーブル行レベル +/- ボタン
 * フローティング方式: document.bodyに1つだけ配置し、position:fixedで行横に表示
 * <td>内にDOMを挿入しないため、インラインエディタとの競合なし
 * =========================================================== */

/* 行ホバー時のハイライト */
body.ebm-active tr.ebm-row-hover {
    background-color: rgba(59, 130, 246, 0.08) !important;
    outline: 1px solid rgba(59, 130, 246, 0.4);
    outline-offset: -1px;
}

/* フローティング行ツールバー（bodyの直下に1つだけ存在） */
.ebm-row-toolbar {
    position: fixed;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    white-space: nowrap;
}

body.ebm-active .ebm-row-toolbar.ebm-row-toolbar-visible {
    opacity: 1;
    pointer-events: auto;
}

/* 行レベルボタン */
.ebm-row-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(100, 116, 139, 0.4);
    border-radius: 4px;
    background: rgba(30, 41, 59, 0.9);
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    line-height: 1;
    padding: 0;
}

.ebm-row-btn:hover {
    background: rgba(30, 41, 59, 1);
    border-color: rgba(100, 116, 139, 0.7);
}

/* +ボタン */
.ebm-row-btn-add:hover {
    background: rgba(59, 130, 246, 0.8);
    border-color: rgba(59, 130, 246, 0.9);
}

/* -ボタン */
.ebm-row-btn-delete:hover {
    background: rgba(239, 68, 68, 0.8);
    border-color: rgba(239, 68, 68, 0.9);
}

/* ===========================================================
 * v1.9.13: 子記事レベル +/- ボタン (B-01)
 * フローティング方式: テーブル行ツールバーと同パターン、別インスタンス
 * =========================================================== */

/* 子記事ホバー時のハイライト */
body.ebm-active .sub_post.ebm-sub-hover {
    outline: 2px dashed rgba(76, 175, 80, 0.7);
    outline-offset: -2px;
    background-color: rgba(76, 175, 80, 0.04);
}

/* フローティング子記事ツールバー（bodyの直下に1つだけ存在） */
.ebm-sub-toolbar {
    position: fixed;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    white-space: nowrap;
}

body.ebm-active .ebm-sub-toolbar.ebm-sub-toolbar-visible {
    opacity: 1;
    pointer-events: auto;
}

/* 子記事レベルボタン */
.ebm-sub-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(76, 175, 80, 0.5);
    border-radius: 4px;
    background: rgba(30, 41, 59, 0.9);
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    line-height: 1;
    padding: 0;
}

.ebm-sub-btn:hover {
    background: rgba(30, 41, 59, 1);
    border-color: rgba(76, 175, 80, 0.8);
}

/* +ボタン */
.ebm-sub-btn-add:hover {
    background: rgba(76, 175, 80, 0.8);
    border-color: rgba(76, 175, 80, 0.9);
}

/* -ボタン */
.ebm-sub-btn-delete:hover {
    background: rgba(239, 68, 68, 0.8);
    border-color: rgba(239, 68, 68, 0.9);
}

/* ===========================================================
 * v1.9.12: ギャラリー画像管理UI (D-01)
 * =========================================================== */

/* 画像ホバー時のオーバーレイ */
.ebm-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10;
}

/* オーバーレイ自体は常にpointer-events:noneのまま（下の要素を塞がない） */
/* ホバー時にopacityだけ変える */
body.ebm-active *:hover > .ebm-gallery-overlay {
    opacity: 1;
}

/* 削除ボタン（×）— ボタンだけpointer-eventsを有効化、easys-dimmedを上書き */
.ebm-gallery-delete-btn,
.easys-edit-mode .easys-dimmed .ebm-gallery-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    padding: 0;
    pointer-events: auto !important;
}

.ebm-gallery-delete-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

.ebm-gallery-delete-btn svg {
    width: 16px;
    height: 16px;
}

/* 追加ボタン（ギャラリー末尾） */
.ebm-gallery-add-btn {
    display: none;
    clear: both;
    padding: 16px 0;
    text-align: center;
}

body.ebm-active .ebm-gallery-add-btn,
.easys-edit-mode .ebm-gallery-add-btn.easys-dimmed {
    display: block;
    pointer-events: auto !important;
    opacity: 1 !important;
}

.ebm-gallery-add-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: 2px dashed rgba(59, 130, 246, 0.5);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.05);
    color: #3b82f6;
    font-size: 14px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    pointer-events: auto !important;
}

.ebm-gallery-add-trigger:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.8);
    color: #2563eb;
}

.ebm-gallery-add-trigger svg {
    flex-shrink: 0;
}

/* ===========================================================
 * v1.9.17: スライド画像管理UI (P-04)
 * 画像クリックで差し替え・削除モーダル + 追加ボタン
 * =========================================================== */

.ebm-slide-add-btn {
    display: none;
    padding: 16px 0;
    text-align: center;
}

body.ebm-active .ebm-slide-add-btn,
.easys-edit-mode .ebm-slide-add-btn.easys-dimmed {
    display: block;
    pointer-events: auto !important;
    opacity: 1 !important;
}

.ebm-slide-add-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: 2px dashed rgba(59, 130, 246, 0.5);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.05);
    color: #3b82f6;
    font-size: 14px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    pointer-events: auto !important;
}

.ebm-slide-add-trigger:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.8);
    color: #2563eb;
}

.ebm-slide-add-trigger svg {
    flex-shrink: 0;
}
