/**
 * Trex Dual Preview — dual-preview.css
 *
 * Gutenberg エディタ内モーダル用スタイル。
 * BEM ライクなクラス命名（.tdp-*）で名前空間を確保し、
 * エディタ既存スタイルとの干渉を防ぐ。
 *
 * @package TrexDualPreview
 * @version 2.4.0
 * @author  Pro Engineer Trex
 */

/* ============================================================
   トリガーボタン（サイドバー）
   ============================================================ */

.tdp-trigger-btn {
	width: 100%;
	justify-content: center !important;
	margin-top: 8px !important;
	font-weight: 600 !important;
	border-color: #7c3aed !important;
	color: #7c3aed !important;
}

.tdp-trigger-btn:hover {
	background: #f5f0ff !important;
	border-color: #5b21b6 !important;
	color: #5b21b6 !important;
}

.tdp-trigger-btn:disabled {
	opacity: 0.4 !important;
	cursor: not-allowed !important;
}

/* ============================================================
   モーダル オーバーレイ
   z-index は Gutenberg の最前面（100000）を超える値にする。
   ============================================================ */

.tdp-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.75);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	animation: tdpFadeIn 0.18s ease;
}

@keyframes tdpFadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

/* ============================================================
   モーダル本体
   height: 92vh を固定し、内部要素が flex で縦幅を分割する。
   ============================================================ */

.tdp-modal {
	background: #1a1a2e;
	border-radius: 14px;
	width: 96vw;
	max-width: 1360px;
	height: 92vh;
	max-height: 92vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
	animation: tdpSlideUp 0.2s ease;
}

@keyframes tdpSlideUp {
	from { transform: translateY(16px); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}

/* ============================================================
   モーダル ヘッダー
   ============================================================ */

.tdp-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 20px;
	flex-shrink: 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	background: #16213e;
}

.tdp-title {
	font-size: 14px;
	font-weight: 700;
	color: #e2e8f0;
}

.tdp-header-right {
	display: flex;
	align-items: center;
	gap: 12px;
}

.tdp-open-link {
	color: #a78bfa !important;
	text-decoration: none !important;
	font-size: 13px;
}
.tdp-open-link:hover {
	color: #c4b5fd !important;
	text-decoration: underline !important;
}

.tdp-close-btn {
	color: #94a3b8 !important;
	min-width: unset !important;
	padding: 4px 8px !important;
}
.tdp-close-btn:hover {
	color: #fff !important;
	background: rgba(255, 255, 255, 0.1) !important;
}

/* ============================================================
   プレビューエリア
   flex: 1 + min-height: 0 でヘッダー・フッター以外の残り高さを占有する。
   ============================================================ */

.tdp-preview-area {
	display: flex;
	flex: 1;
	min-height: 0;
	background: #0f0f23;
	overflow: hidden;
}

/* ============================================================
   PC / SP パネル
   ============================================================ */

.tdp-panel {
	display: flex;
	flex-direction: column;
	align-items: center;
	overflow: hidden;
	padding: 12px 16px;
}

/* PC パネル：固定幅、SP パネルに残りを譲る */
.tdp-panel--pc {
	flex: 0 0 auto;
	border-right: 1px solid rgba(255, 255, 255, 0.08);
}

/* SP パネル：残り幅をすべて使う */
.tdp-panel--sp {
	flex: 1 1 auto;
}

.tdp-panel-label {
	font-size: 11px;
	font-weight: 700;
	color: #94a3b8;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	margin-bottom: 8px;
	flex-shrink: 0;
}

/* ============================================================
   デバイスシェル共通
   flex: 1 1 auto で縦いっぱいに伸長する。
   ============================================================ */

.tdp-shell {
	display: flex;
	flex-direction: column;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
	flex: 1 1 auto;
	min-height: 0;
}

/* PC シェル */
.tdp-shell--pc {
	border-radius: 8px;
	border: 3px solid #334155;
	background: #1e293b;
	overflow: hidden;
}

/* SP シェル */
.tdp-shell--sp {
	border-radius: 36px;
	border: 5px solid #334155;
	background: #0f172a;
	overflow: hidden;
}

/* ============================================================
   PC ブラウザ装飾バー
   ============================================================ */

.tdp-bar--browser {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 7px 10px;
	background: #1e293b;
	flex-shrink: 0;
}

.tdp-dot {
	display: inline-block;
	width: 9px;
	height: 9px;
	border-radius: 50%;
}
.tdp-dot--red    { background: #ef4444; }
.tdp-dot--yellow { background: #f59e0b; }
.tdp-dot--green  { background: #22c55e; }

.tdp-url {
	margin-left: 6px;
	flex: 1;
	font-size: 10px;
	color: #64748b;
	background: #0f172a;
	padding: 2px 10px;
	border-radius: 4px;
}

/* ============================================================
   SP ノッチバー / ホームバー
   ============================================================ */

.tdp-bar--notch,
.tdp-bar--home {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 7px 0;
	background: #0f172a;
	flex-shrink: 0;
}

.tdp-notch         { width: 56px; height: 6px; background: #334155; border-radius: 3px; }
.tdp-home-indicator { width: 44px; height: 5px; background: #475569; border-radius: 3px; }

/* ============================================================
   クリップ領域
   overflow: hidden でスケール後の iframe をマスクする。
   flex: 1 1 auto でシェル内の残り高さを占有する。
   ============================================================ */

.tdp-clip--fill {
	position: relative;
	overflow: hidden;
	background: #fff;
	flex: 1 1 auto;
	min-height: 0;
}

/* ============================================================
   iframe
   幅・高さ・transform は JS が動的に設定する。
   ============================================================ */

.tdp-iframe {
	position: absolute;
	top: 0;
	left: 0;
	border: none;
	display: block;
	transform-origin: top left;
}

/* ============================================================
   クリップ内ローディングインジケーター
   ============================================================ */

.tdp-loading {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	font-size: 13px;
	color: #64748b;
	background: #1e293b;
	z-index: 10;
}

.tdp-spinner {
	display: inline-block;
	width: 28px;
	height: 28px;
	border: 3px solid #334155;
	border-top-color: #7c3aed;
	border-radius: 50%;
	animation: tdpSpin 0.7s linear infinite;
}

@keyframes tdpSpin {
	to { transform: rotate(360deg); }
}

/* ============================================================
   モーダル フッター
   ============================================================ */

.tdp-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 20px;
	flex-shrink: 0;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	background: #16213e;
}

.tdp-footer-note {
	font-size: 13px;
	color: #e2e8f0;
	font-weight: 500;
}

/* ============================================================
   スライダー UI
   ============================================================ */

.tdp-slider-wrap {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	margin-top: 10px;
	padding: 8px 12px;
	flex-shrink: 0;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 8px;
}

.tdp-slider-label {
	font-size: 11px;
	font-weight: 600;
	color: #94a3b8;
	white-space: nowrap;
}

.tdp-slider {
	flex: 1;
	cursor: pointer;
	accent-color: #7c3aed;
	height: 4px;
}

.tdp-slider-val {
	font-size: 12px;
	font-weight: 700;
	color: #e2e8f0;
	min-width: 54px;
	text-align: right;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

/* ============================================================
   注記フッター（モーダル・全画面共通）
   ============================================================ */

/* モーダル内フッターの注記を縦並びに */
.tdp-footer-notes {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.tdp-footer-note {
	font-size: 11px;
	color: #94a3b8;
	line-height: 1.5;
}

/* 全画面ページのフッター */
#tdp-page-footer {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	display: flex;
	gap: 16px;
	align-items: center;
	padding: 6px 20px;
	background: rgba(22, 33, 62, 0.92);
	backdrop-filter: blur(4px);
	border-top: 1px solid rgba(255, 255, 255, 0.06);
	z-index: 100;
}

#tdp-page-footer p {
	font-size: 11px;
	color: #64748b;
	line-height: 1.4;
}
