/**
 * HTML/CSS Live Editor - Layout Styles
 * Version: 2.0.5
 */

/* 全画面モード */
.html-css-live-editor.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
}

body.admin-bar .html-css-live-editor.fullscreen-mode {
    top: 32px !important;
    height: calc(100vh - 32px) !important;
}

@media screen and (max-width: 782px) {
    body.admin-bar .html-css-live-editor.fullscreen-mode {
        top: 46px !important;
        height: calc(100vh - 46px) !important;
    }
}

body.editor-fullscreen {
    overflow: hidden !important;
}

.html-css-live-editor.fullscreen-mode .editor-main {
    height: calc(100vh - 80px) !important;
}

body.admin-bar .html-css-live-editor.fullscreen-mode .editor-main {
    height: calc(100vh - 112px) !important;
}

@media screen and (max-width: 782px) {
    body.admin-bar .html-css-live-editor.fullscreen-mode .editor-main {
        height: calc(100vh - 126px) !important;
    }
}

/* ★ プレビュー縮尺：手動スケール用クラス（自動スケールはJSがインラインで上書き） */
/* transform-origin は main.css で top left 統一済み */
.preview-wrapper.scale-100 { transform: scale(1.00); }
.preview-wrapper.scale-90  { transform: scale(0.90); }
.preview-wrapper.scale-80  { transform: scale(0.80); }
.preview-wrapper.scale-70  { transform: scale(0.70); }
.preview-wrapper.scale-60  { transform: scale(0.60); }
.preview-wrapper.scale-50  { transform: scale(0.50); }
.preview-wrapper.scale-40  { transform: scale(0.40); }
.preview-wrapper.scale-30  { transform: scale(0.30); }

/* リサイズハンドルのホバー効果 */
.horizontal-resize-handle:hover,
.vertical-resize-handle:hover {
    background: rgba(52, 152, 219, 0.3) !important;
}
.horizontal-resize-handle:hover div,
.vertical-resize-handle:hover div {
    background: white !important;
}

/* リサイズ中 */
.resizing {
    user-select: none !important;
    pointer-events: none !important;
}
.resizing .preview-frame,
.resizing .code-editor {
    pointer-events: none !important;
}

.resize-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(52, 152, 219, 0.05);
    z-index: 9998;
    pointer-events: none;
    display: none;
}
.resize-overlay.active { display: block; }

/* 全画面ボタン */
.fullscreen-toggle { transition: all 0.3s; }
.fullscreen-toggle:hover         { background: #34495e !important; }
.fullscreen-toggle.active        { background: #e74c3c !important; }
.fullscreen-toggle.active:hover  { background: #c0392b !important; }

/* プレビュー縮尺 / デザイン幅 コントロール */
.preview-scale-controls,
.preview-design-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.scale-select:focus,
.design-width-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* レスポンシブ：768px以下のみ縦積み */
@media (max-width: 768px) {
    .editor-main {
        flex-direction: column;
    }
    .preview-section,
    .editor-section {
        flex: 1 1 auto !important;
        min-width: auto !important;
    }
    .controls-panel { flex: 0 0 150px; }
    .editor-controls { flex-wrap: wrap; gap: 0.25rem; }
    .editor-controls button { font-size: 0.8rem; padding: 0.4rem 0.8rem; }
    .editor-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
        height: auto;
        min-height: 80px;
    }
}