/* public/assets/css/life/led-marquee.css */
/* 【核心修复】：重置盒模型，彻底阻止边框导致的 100% 宽度水平溢出 */
.led-tool-wrapper *, .led-tool-wrapper *::before, .led-tool-wrapper *::after { box-sizing: border-box; }

.led-tool-wrapper { --p-bg: #ffffff; --p-border: #e2e8f0; --p-primary: #ec4899; --p-text: #0f172a; width: 100%; max-width: 1200px; margin: 0 auto; background: var(--p-bg); border-radius: 20px; padding: 24px; border: 1px solid var(--p-border); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05); }
.led-header-main { font-size: 1.5rem; font-weight: 800; color: var(--p-text); margin-bottom: 8px; text-align: center; }
.led-subtitle { color: #64748b; font-size: 0.95rem; padding-bottom: 20px; border-bottom: 1px solid var(--p-border); margin-bottom: 24px; text-align: center; max-width: 800px; margin-left: auto; margin-right: auto; line-height: 1.6; }

.led-editor-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 24px; align-items: start; position: relative; }

.led-panel { display: flex; flex-direction: column; background: #ffffff; border: 1px solid var(--p-border); border-radius: 16px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.02); }
.led-panel-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; background: #f8fafc; border-bottom: 1px solid var(--p-border); }
.led-panel-title { font-size: 1rem; font-weight: 700; color: #334155; }
.led-panel-body { padding: 20px; flex: 1; display: flex; flex-direction: column; gap: 20px; }
.led-panel-footer { padding: 16px 20px; background: #f8fafc; border-top: 1px solid var(--p-border); display: flex; flex-direction: column; gap: 12px; }

@media(min-width: 851px) { #ledPreviewPanel { position: sticky; top: 24px; } }
@media(max-width: 850px) { 
    .led-editor-grid { display: flex; flex-direction: column; }
    #ledPreviewPanel { order: -1; } 
    #ledSettingsPanel { order: 1; }
}

.led-segmented-control { display: flex; background: #f1f5f9; border-radius: 10px; padding: 4px; margin: 16px 20px 0; }
.led-tab-btn { flex: 1; padding: 10px; background: transparent; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 700; color: #64748b; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.led-tab-btn.active { background: #ffffff; color: var(--p-primary); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.led-tab-content { display: none; flex-direction: column; gap: 16px; animation: fadeIn 0.3s; }
.led-tab-content.active { display: flex; }

.led-switch-group { display: flex; gap: 16px; flex-wrap: wrap; }
.led-switch-group.vertical { flex-direction: column; gap: 12px; }
.led-switch-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: #f8fafc; border-radius: 10px; border: 1px solid var(--p-border); transition: 0.2s; }
.led-switch-item:hover { border-color: #cbd5e1; }
.led-switch-label { font-size: 0.95rem; font-weight: 600; color: #334155; }
.led-switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.led-switch input { opacity: 0; width: 0; height: 0; }
.led-slider-toggle { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .3s; border-radius: 26px; }
.led-slider-toggle:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.led-switch input:checked + .led-slider-toggle { background-color: var(--p-primary); }
.led-switch input:checked + .led-slider-toggle:before { transform: translateX(20px); }
.led-switch-item.highlight-rgb input:checked + .led-slider-toggle { background-image: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899); background-color: transparent; }
.led-switch-item.highlight-audio input:checked + .led-slider-toggle { background-color: #8b5cf6; }

.led-section-title { font-size: 1.05rem; font-weight: 800; color: #1e293b; border-bottom: 2px solid #f1f5f9; padding-bottom: 8px; margin-bottom: 4px; }
.led-global-settings { display: flex; flex-direction: column; gap: 16px; }

/* 画板基础 */
.led-draw-board-wrapper { 
    width: 100%; 
    aspect-ratio: 3 / 1; 
    height: auto; 
    background: #0f172a; 
    border-radius: 10px; 
    border: 2px solid #cbd5e1; 
    position: relative; 
    overflow: hidden; 
    touch-action: none; 
}
.led-draw-canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
.led-draw-hint { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #64748b; font-size: 0.9rem; pointer-events: none; opacity: 0.6; }
.led-mini-btn { padding: 6px 12px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; border: 1px solid #cbd5e1; background: #ffffff; color: #475569; cursor: pointer; transition: 0.2s; white-space: nowrap; }
.led-mini-btn.active { background: #e0f2fe; border-color: #38bdf8; color: #0284c7; }
.led-mini-btn.danger { background: #fef2f2; border-color: #fecaca; color: #ef4444; }
.led-mini-btn:hover { filter: brightness(0.95); transform: translateY(-1px); }

/* --- 【核心重构】：全屏手绘防溢出安全布局 --- */
.led-draw-fullscreen-mode {
    position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important; height: 100vh !important; height: 100dvh !important;
    z-index: 99999999 !important; background: #0f172a !important;
    border-radius: 0 !important; border: none !important;
    /* 使用 Flex 垂直流式布局，彻底抛弃 Absolute 定位带来的系统遮挡问题 */
    display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important;
    padding: 20px !important; gap: 24px !important;
}

/* 通过 max-width / max-height 智能约束画板，永远不会超出屏幕 */
.led-draw-fullscreen-mode .led-draw-canvas { 
    width: 100%; max-width: 100vw; height: auto; max-height: 75vh; max-height: 75dvh;
    aspect-ratio: 3 / 1; background: #0f172a; flex-shrink: 0; box-shadow: 0 0 20px rgba(0,0,0,0.5); border: 2px solid #334155; border-radius: 10px;
}

/* 按钮自然流动在画板下方 */
.led-draw-close-fs { display: none; background: #ec4899; color: #fff; border: none; padding: 14px 40px; border-radius: 30px; font-weight: 700; font-size: 1.1rem; box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4); cursor: pointer; flex-shrink: 0; }
.led-draw-fullscreen-mode .led-draw-close-fs { display: block; }
.led-draw-fullscreen-mode .led-draw-hint { display: none !important; }

.led-form-group { display: flex; flex-direction: column; gap: 8px; }
.led-form-group-row { display: flex; gap: 16px; align-items: flex-end; }
@media(max-width: 600px) { .led-form-group-row { flex-direction: column; align-items: stretch; gap: 12px; } }

.led-label { font-size: 0.9rem; font-weight: 600; color: #64748b; }
.led-textarea { width: 100%; height: 80px; padding: 12px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 1.05rem; font-weight: 600; color: #1e293b; background: #ffffff; outline: none; transition: 0.2s; resize: none; box-sizing: border-box; }
.led-textarea:focus { border-color: var(--p-primary); box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1); }
.led-select { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 0.95rem; color: #1e293b; background: #f8fafc; outline: none; cursor: pointer; }
.led-slider-group { display: flex; align-items: center; gap: 12px; font-size: 1.2rem; }
.led-slider { flex: 1; accent-color: var(--p-primary); cursor: pointer; }

.led-color-picker-wrap { display: flex; align-items: center; gap: 10px; background: #f1f5f9; padding: 8px; border-radius: 10px; border: 1px solid #cbd5e1; }
.led-color-picker-wrap input[type="color"] { width: 32px; height: 32px; padding: 0; border: none; border-radius: 6px; cursor: pointer; }
.led-color-picker-wrap input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.led-color-picker-wrap input[type="color"]::-webkit-color-swatch { border: 1px solid #94a3b8; border-radius: 6px; }

.led-file-input { display: block; width: 100%; font-size: 0.9rem; color: #475569; padding: 8px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; cursor: pointer; }
.led-file-input::file-selector-button { background: #e2e8f0; border: none; padding: 6px 12px; border-radius: 6px; font-weight: 600; color: #334155; cursor: pointer; margin-right: 12px; transition: 0.2s; }

.led-btn-primary, .led-btn-success, .led-btn-ble { flex: 1; padding: 14px 20px; border-radius: 10px; font-weight: 700; font-size: 1.05rem; cursor: pointer; border: none; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; color: white; }
.led-btn-primary { background: var(--p-primary); box-shadow: 0 4px 12px rgba(236, 72, 153, 0.25); }
.led-btn-primary:hover { background: #db2777; transform: translateY(-1px); }
.led-btn-success { background: #10b981; }
.led-btn-success:hover:not(:disabled) { background: #059669; transform: translateY(-1px); }
.led-btn-success:disabled { background: #cbd5e1; box-shadow: none; cursor: not-allowed; }
.led-btn-ble { background: #3b82f6; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25); }
.led-btn-ble:hover { background: #2563eb; transform: translateY(-1px); }

.led-canvas-container { 
    width: 100%; 
    aspect-ratio: 16 / 9; 
    height: auto; 
    border-radius: 10px; 
    overflow: hidden; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    background: #000; 
    position: relative; 
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8); 
    border: 2px solid #334155;
}
#ledCanvas { width: 100%; height: 100%; display: block; object-fit: contain; cursor: pointer; }
.led-fs-hint { display: none; }

.led-record-status { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; background: rgba(15, 23, 42, 0.8); color: #22d3ee; border-radius: 8px; margin-top: 12px; font-weight: 600; font-size: 0.9rem; }
.led-status-dot { width: 10px; height: 10px; background: #ef4444; border-radius: 50%; animation: pulseRed 1s infinite; }
@keyframes pulseRed { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); } 70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
.led-fs-close-btn { display: none; }

/* 全屏沉浸播放模式 */
.led-fullscreen-mode {
    position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important; height: 100vh !important; height: 100dvh !important;
    z-index: 9999999 !important; background: #000 !important;
    margin: 0 !important; padding: 0 !important; border-radius: 0 !important;
}
.led-fullscreen-mode .led-canvas-container { 
    aspect-ratio: auto; width: 100vw; height: 100vh; border: none; box-shadow: none; border-radius: 0;
}
.led-fullscreen-mode #ledSettingsPanel {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 90vw; max-width: 600px; max-height: 90vh; overflow-y: auto;
    z-index: 99999999; box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    display: none; 
}
.led-fullscreen-mode.show-settings #ledSettingsPanel { display: flex; }
.led-fullscreen-mode .led-fs-close-btn { display: block; background: #fef2f2; border: 1px solid #fecaca; color: #ef4444; border-radius: 6px; padding: 4px 12px; cursor: pointer; font-weight: 600; }
.led-fullscreen-mode .led-fs-hint { display: block; position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.5); color: #fff; padding: 8px 16px; border-radius: 20px; font-size: 0.9rem; pointer-events: none; opacity: 0.8; animation: fadeOutHint 3s forwards; }
@keyframes fadeOutHint { 0% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
.led-fullscreen-mode .led-panel-footer { display: none; }

/* 全屏沉浸播放模式 */
.led-fullscreen-mode {
    position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100vw !important; height: 100vh !important; height: 100dvh !important;
    z-index: 9999999 !important; background: #000 !important;
    margin: 0 !important; padding: 0 !important; border-radius: 0 !important;
}

/* 【核心修复】：移动端竖屏全屏时，强制 CSS 旋转 90 度实现真·横屏沉浸弹幕体验 */
@media (max-width: 850px) and (orientation: portrait) {
    .led-fullscreen-mode {
        top: 50% !important; left: 50% !important;
        width: 100vh !important; width: 100dvh !important;
        height: 100vw !important;
        transform: translate(-50%, -50%) rotate(90deg) !important;
        transform-origin: center center !important;
    }
    .led-fullscreen-mode #ledSettingsPanel {
        width: 90vh !important;
        max-width: 90vh !important;
        max-height: 90vw !important;
    }
}

.led-fullscreen-mode .led-canvas-container { 
    aspect-ratio: auto; width: 100%; height: 100%; border: none; box-shadow: none; border-radius: 0;
}
.led-fullscreen-mode #ledSettingsPanel {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 90vw; max-width: 600px; max-height: 90vh; overflow-y: auto;
    z-index: 99999999; box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    display: none; 
}
.led-fullscreen-mode.show-settings #ledSettingsPanel { display: flex; }
.led-fullscreen-mode .led-fs-close-btn { display: block; background: #fef2f2; border: 1px solid #fecaca; color: #ef4444; border-radius: 6px; padding: 4px 12px; cursor: pointer; font-weight: 600; }
.led-fullscreen-mode .led-fs-hint { display: block; position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.5); color: #fff; padding: 8px 16px; border-radius: 20px; font-size: 0.9rem; pointer-events: none; opacity: 0.8; animation: fadeOutHint 3s forwards; }
@keyframes fadeOutHint { 0% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
.led-fullscreen-mode .led-panel-footer { display: none; }

/* 黑夜模式 */
[data-theme="dark"] .led-tool-wrapper { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .led-header-main { color: #f8fafc; }
[data-theme="dark"] .led-panel { background: #0f172a; border-color: #475569; }
[data-theme="dark"] .led-panel-header, [data-theme="dark"] .led-panel-footer { background: #1e293b; border-color: #475569; color: #cbd5e1; }
[data-theme="dark"] .led-textarea, [data-theme="dark"] .led-select { background: #020617; border-color: #475569; color: #f8fafc; }
[data-theme="dark"] .led-label, [data-theme="dark"] .led-section-title { color: #94a3b8; border-color: #334155;}
[data-theme="dark"] .led-color-picker-wrap { background: #020617; border-color: #475569;}
[data-theme="dark"] .led-file-input { background: #0f172a; border-color: #475569; color: #cbd5e1; }
[data-theme="dark"] .led-segmented-control { background: #1e293b; }
[data-theme="dark"] .led-tab-btn.active { background: #0f172a; }
[data-theme="dark"] .led-switch-item { background: #1e293b; border-color: #475569; }
[data-theme="dark"] .led-switch-label { color: #cbd5e1; }
[data-theme="dark"] .led-slider-toggle { background-color: #475569; }
[data-theme="dark"] .led-draw-board-wrapper { border-color: #475569; }
[data-theme="dark"] .led-mini-btn { background: #1e293b; border-color: #475569; color: #cbd5e1; }