/* =========================================
   Kavenlai Power-KS62 Pro 控制台 - 统一优化样式表
   ========================================= */
:root {
    --bg-color: #0f0f11;
    --panel-bg: #18181b;
    --card-bg: #27272a;
    --border-color: #3f3f46;
    --text-main: #f4f4f5;
    --text-sub: #a1a1aa;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0; padding: 0;
    display: flex; flex-direction: column; align-items: center;
    min-height: 100vh; box-sizing: border-box;
}
/* 顶部品牌导航栏 */
.top-header-bar {
    width: 100%; background: #e4e4e7; color: #18181b;
    display: flex; flex-direction: column; align-items: center;
}
.header-content {
    width: 1150px; height: 75px; display: flex;
    justify-content: space-between; align-items: center; padding: 0 10px;
}
.brand-left { display: flex; align-items: center; gap: 15px; }
.brand-texts { display: flex; flex-direction: column; }
.product-title { font-size: 16px; font-weight: bold; color: #111; }
.brand-slogan { font-size: 13px; color: #555; margin-top: 2px; }
.brand-right { display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; color: #444; gap: 3px; }
.service-link { color: #2563eb; text-decoration: none; font-weight: 500; }
.service-link:hover { text-decoration: underline; }
.header-divider { width: 100%; height: 2px; background-color: #60a5fa; }
/* 主体容器 */
.main-body-container {
    padding: 20px 0; display: flex; flex-direction: column; align-items: center; flex: 1; width: 1150px; box-sizing: border-box;
}
/* 顶部连接状态栏 */
.top-connection-bar {
    display: flex; justify-content: space-between; align-items: center;
    background-color: var(--panel-bg); border: 1px solid var(--border-color);
    padding: 12px 20px; border-radius: 8px; margin-bottom: 20px; width: 100%; box-sizing: border-box;
}
/* ==================== 键盘预览区 - 深色功能框风格 ==================== */
.keyboard-preview {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 22px 24px;
    width: 540px; /* 原480px，加大宽度 */
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-sizing: border-box;
}
/* 顶部栏：Logo + Layer */
.preview-top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.preview-brand {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.logo-image {
    height: 32px;
    object-fit: contain;
}
.preview-model {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}
.preview-layers-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}
.layer-section {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-sub);
}
.layer-section-label {
    font-size: 12px;
    color: var(--text-sub);
    min-width: 80px;
}
.layer-dots-bar {
    display: flex;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 0;
    width: auto;
}
.layer-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    font-size: 11px;
    color: var(--text-sub);
    font-weight: 500;
    cursor: pointer;
    transition: 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.layer-dot.active {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}
.layer-dot:hover:not(.active) {
    border-color: var(--accent-color);
    color: var(--accent-color);
}
/* 底部内容：按键 + 旋钮 */
.preview-bottom-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
}
.matrix-preview {
    display: grid;
    grid-template-columns: repeat(3, 78px);
    grid-template-rows: repeat(2, 78px);
    gap: 12px;
}
.preview-key {
    background: transparent;
    border: 1px solid #f4f4f5;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    box-sizing: border-box;
}
.preview-key:hover {
    border-color: #3b82f6;
}
.preview-key.active {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}
.pk-id {
    font-size: 13px;
    color: #4ade80;
    font-weight: 700;
}
.pk-val {
    font-size: 12px;
    color: var(--text-sub);
    text-align: center;
    margin-bottom: 4px;
    font-weight: 600;
}
.right-control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    height: 100%;
    min-height: 170px;
}
.encoders-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}
.encoder-group {
    display: flex;
    align-items: center;
    gap: 12px;
}
.enc-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-sub);
    font-size: 16px;
    cursor: pointer;
    transition: 0.15s;
    user-select: none;
}
.enc-press {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.15s;
    user-select: none;
}
.enc-btn:hover, .enc-press:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}
/* 宏队列展示框 */
.macro-queue-box {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 290px; /* 原350px，缩小宽度 */
    padding: 15px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    box-sizing: border-box; 
}
.mq-header {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; font-weight: bold; color: var(--text-sub); margin-bottom: 10px;
}
.mq-clear-single {
    background: #3f3f46;
    border: none;
    color: #f4f4f5;
    font-size: 12px; /* 原11px，加大字号 */
    padding: 5px 12px; /* 原3px 8px，加大内边距，按钮整体变大 */
    border-radius: 4px;
    cursor: pointer;
}
.mq-clear-single:hover { background: #ef4444; color: white; }
.mq-content {
    flex: 1; background: #18181b; border: 1px solid var(--border-color);
    border-radius: 6px; padding: 10px; display: flex; flex-wrap: wrap;
    align-content: flex-start; gap: 6px; min-height: 140px; max-height: 180px; overflow-y: auto; box-sizing: border-box;
}
.mq-placeholder { font-size: 12px; color: #52525b; margin: auto; text-align: center; }
.macro-chip {
    background: #27272a; border: 1px solid #52525b; color: #4ade80;
    font-size: 12px; padding: 4px 8px; border-radius: 4px; display: flex;
    align-items: center; cursor: pointer; transition: 0.1s; position: relative;
}
.macro-chip:hover { border-color: #ef4444; background: #3f2020; color: #ef4444; }
.macro-chip.delay-chip { color: #facc15; }
.macro-chip.insert-cursor-target { border-color: #3b82f6; box-shadow: 0 0 6px rgba(59,130,246,0.6); }

/* ========== 修改：右侧按钮区 顶部1个+底部3个对齐 ========== */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    justify-content: flex-start;
}
/* 第二个按钮起自动沉底，实现底部三个对齐 */
.action-buttons .side-btn:nth-child(2) {
    margin-top: auto;
}
.side-btn {
    background: var(--card-bg); border: 1px solid var(--border-color);
    color: var(--text-main); padding: 10px 16px; border-radius: 6px;
    cursor: pointer; font-size: 13px; font-weight: 500; width: 125px; text-align: center; transition: 0.15s;
    box-sizing: border-box;
}
.side-btn:hover { background: #3f3f46; border-color: var(--accent-color); }

/* 底部功能工具箱面板 */
.toolbox-panel {
    background: var(--panel-bg); border: 1px solid var(--border-color);
    border-radius: 10px; width: 1150px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.5); box-sizing: border-box;
}
.toolbox-tabs {
    width: 100%; background: #18181b; border-bottom: 1px solid var(--border-color);
    display: flex; flex-direction: row; overflow-x: auto;
}
.tab-item {
    padding: 12px 24px; color: var(--text-sub); font-size: 13px; cursor: pointer;
    border-bottom: 3px solid transparent; transition: 0.1s; text-align: center; white-space: nowrap;
}
.tab-item:hover { color: var(--text-main); background: #27272a; }
.tab-item.active {
    color: var(--text-main); background: var(--card-bg); border-bottom-color: var(--accent-color); font-weight: bold;
}
.toolbox-content { flex: 1; padding: 22px 25px; display: flex; flex-direction: column; gap: 12px; background: #202023; }
.keyboard-row { display: flex; gap: 8px; justify-content: center; width: 100%; box-sizing: border-box; }
.k-key {
    background: var(--card-bg); border: 1px solid var(--border-color);
    color: var(--text-main); border-radius: 6px; height: 48px; min-width: 48px;
    padding: 0 8px; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 500; cursor: pointer; user-select: none; transition: 0.1s;
}
.k-key:hover { background: var(--accent-color); border-color: var(--accent-hover); color: white; transform: translateY(-1px); }
.k-key.w-1-25 { width: 62px; }
.k-key.w-1-5  { width: 72px; }
.k-key.w-1-75 { width: 84px; }
.k-key.w-2    { width: 100px; }
.k-key.w-2-25 { width: 114px; }
.k-key.w-2-75 { width: 140px; }
.k-key.w-space { width: 340px; }
.k-key.active-mod-glow {
    background-color: #1e3a8a !important; border-color: #3b82f6 !important;
    color: #ffffff !important; box-shadow: 0 0 12px rgba(59, 130, 246, 0.4); transform: translateY(-1px);
}
.delay-inline-group {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    background-color: #18181b; padding: 15px; border-radius: 8px;
    border: 1px solid #27272a; width: fit-content; margin: 10px auto 0 auto; box-sizing: border-box;
}
.delay-inline-group input[type="number"] {
    width: 80px; background-color: #27272a; border: 1px solid #52525b; color: #fff; padding: 6px 8px; border-radius: 4px; text-align: center;
}
.delay-inline-group select { background-color: #27272a; border: 1px solid #52525b; color: #fff; padding: 6px 10px; border-radius: 4px; }
/* LED 灯光面板 */
.led-config-container { color: #e4e4e7; padding: 10px; width: 100%; display: flex; flex-direction: column; gap: 20px; }
.led-section-title { font-size: 15px; font-weight: 600; color: #ffffff; margin: 20px 0 12px 0; }
.led-table {
    width: 100%; border-collapse: collapse; margin-bottom: 20px;
    background-color: #18181b; border-radius: 6px; overflow: hidden; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3); table-layout: fixed;
}
.led-table th, .led-table td { border: 1px solid #3f3f46; padding: 8px 12px; text-align: center; vertical-align: middle; }
.led-table th { background-color: #27272a; color: #a1a1aa; font-weight: 500; font-size: 13px; position: relative; }
.led-table td { font-size: 14px; }
.led-table td:first-child { font-weight: 600; color: #f4f4f5; background-color: #27272a; }
.led-table select {
    width: 100%; padding: 6px; background-color: #27272a; color: #f4f4f5;
    border: 1px solid #52525b; border-radius: 4px; outline: none; cursor: pointer; font-size: 13px;
}
.led-color-cell { padding: 0 !important; }
.led-table input[type="color"] { width: 100%; height: 38px; border: none; padding: 0; background: none; cursor: pointer; display: block; }
.led-test-btn {
    background-color: #3b82f6; border: none; color: #fff; font-size: 11px;
    padding: 3px 8px; border-radius: 4px; cursor: pointer; margin-left: 6px; transition: 0.2s;
}
.led-test-btn:hover { background-color: #2563eb; }
.led-test-btn.testing { background-color: #ef4444; }
#consoleLog {
    width: 100%; background: #0f172a; color: #4ade80;
    font-family: monospace; padding: 10px; border-radius: 6px; height: 55px;
    overflow-y: auto; font-size: 12px; box-sizing: border-box;
}
.site-footer { width: 100%; background: var(--panel-bg); display: flex; flex-direction: column; align-items: center; margin-top: auto; }
.footer-divider { width: 100%; height: 1px; background-color: var(--border-color); }
.footer-content { width: 1150px; height: 45px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-sub); }
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-box-mini { background: var(--panel-bg); border: 1px solid var(--border-color); padding: 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,0.6); }
.modal-btns-mini { display: flex; gap: 12px; justify-content: center; }
.side-btn-mini {
    background: var(--card-bg); border: 1px solid var(--border-color);
    color: var(--text-main); padding: 10px 20px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: bold; min-width: 65px; text-align: center; transition: 0.15s;
}
.side-btn-mini:hover { background: #3f3f46; border-color: var(--accent-color); color: #4ade80; }
/* 单页应用推广页样式 */
.landing-container {
    display: flex; align-items: center; justify-content: center;
    width: 100%; min-height: 100vh; background-color: var(--bg-color);
}
.landing-box {
    background: var(--panel-bg); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 40px; width: 450px; text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.landing-box h2 { margin: 15px 0 10px 0; font-size: 22px; color: #f4f4f5; }
.status-text { font-size: 14px; color: #ef4444; font-weight: bold; margin-bottom: 25px; }
.landing-actions { display: flex; justify-content: center; gap: 15px; }
.landing-actions .side-btn { width: 140px; padding: 12px 0; font-size: 14px; }
.landing-actions .side-btn:disabled { opacity: 0.4; cursor: not-allowed; border-color: #3f3f46; background: #27272a; color: #a1a1aa; }
.template-header { cursor: pointer; transition: 0.2s; }
.template-header:hover { color: #ffffff; }
.template-header.active-tpl { color: #4ade80; border-bottom: 2px solid #4ade80; }
/* 置顶着陆页与 iframe 布局 */
.landing-wrapper {
    display: flex; flex-direction: column;
    width: 100%; height: 100vh; background-color: var(--bg-color); overflow: hidden;
}
.landing-top-bar {
    position: sticky; top: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 35px; background: rgba(24, 24, 27, 0.92);
    backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.5);
}
.landing-brand { display: flex; align-items: center; }
.landing-title { font-size: 17px; font-weight: 700; color: #f4f4f5; letter-spacing: 0.5px; }
.landing-status-group { display: flex; align-items: center; gap: 15px; }
.landing-status-group .status-text { margin-bottom: 0; line-height: 1; margin-right: 5px; }
.landing-status-group .side-btn { width: 110px; padding: 8px 0; font-size: 13px; }
.landing-promo-container { flex: 1; width: 100%; height: calc(100vh - 65px); }
.promo-iframe { width: 100%; height: 100%; border: none; }
.custom-modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.custom-modal-card {
    background: #18181b; border: 1px solid #27272a; border-radius: 16px;
    padding: 24px; width: 380px; color: #fff; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
    text-align: center;
}
.keyboard-icon { font-size: 40px; margin-bottom: 10px; }
.modal-desc { color: #a1a1aa; font-size: 13px; margin: 15px 0; line-height: 1.5; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }
.btn-cancel { background: #27272a; color: #a1a1aa; border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer; }
.btn-primary-glow { background: #3b82f6; color: white; border: none; padding: 8px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; box-shadow: 0 0 15px rgba(59,130,246,0.5); }
.btn-primary-glow:hover { background: #2563eb; }


/* 保存成功动画 */
@keyframes layerDotFlash {
    0%, 100% { 
        background-color: #4ade80 !important; 
        color: #18181b !important; 
        box-shadow: 0 0 20px #4ade80 !important;
        transform: scale(1.25) !important;
    }
    50% { 
        background-color: #27272a !important; 
        color: #f4f4f5 !important; 
        box-shadow: none !important;
        transform: scale(1.0) !important;
    }
}
.layer-dot.saving-flash {
    animation: layerDotFlash 0.3s ease-in-out 3 !important;
}
@keyframes boardSaveGlow {
    0%, 100% { 
        border-color: #4ade80 !important; 
        box-shadow: 0 0 30px rgba(74, 222, 128, 0.8) !important; 
    }
    50% { 
        border-color: #3b82f6 !important; 
        box-shadow: 0 0 25px rgba(59, 130, 246, 0.6) !important; 
    }
}
.keyboard-preview.saving-glow, .keyboard-board.saving-glow {
    animation: boardSaveGlow 0.4s ease-in-out 2 !important;
}

/* =========================================
   新布局：左右分栏 + 状态栏右移
   ========================================= */
.top-main-layout {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    width: 100%;
    margin-bottom: 25px;
    gap: 15px;
    box-sizing: border-box;
}

.right-column-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 20px;
    box-sizing: border-box;
}

.right-bottom-row {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    flex: 1;
    box-sizing: border-box;
}

/* 覆盖原状态栏底边距 */
.top-connection-bar {
    margin-bottom: 0;
    width: 100%;
}

/* 宏队列撑满高度 */
.macro-queue-box {
    flex: 1;
}
/* ================= EC11 公共层特殊状态 (禁止选中与FN高亮) ================= */
.ec11-disabled {
    pointer-events: none !important; /* 彻底禁止鼠标点击 */
    opacity: 0.3 !important;         /* 变暗变透明 */
    cursor: not-allowed !important;  
    filter: grayscale(100%);         /* 变成灰色 */
}
.highlight-fn {
    color: #facc15 !important;       /* 亮黄色字体 (与你的 delay-chip 颜色呼应) */
    border-color: #facc15 !important;
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.3) !important;
    font-weight: 900 !important;
}
/* ===== 灯光表头与控件样式 ===== */
.led-cell-wrap {
    display:flex;
    gap:4px;
    align-items:center;
    box-sizing: border-box;
}
.led-brightness-select{
    width:70px;
    flex-shrink:0;
    box-sizing: border-box;
}
.led-mode-select{
    flex:1;
    min-width:90px;
    box-sizing: border-box;
}

/* 区块标题 */
.led-section-title {
    margin: 8px 0;
    font-size: 16px;
    font-weight: 500;
    box-sizing: border-box;
}

/* 外层容器 */
.led-config-container {
    padding: 4px 12px 8px;
    width: 100%;
    box-sizing: border-box;
}

/* 表格 */
.led-table {
    margin-bottom: 8px;
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    box-sizing: border-box;
}

/* 模板表头整体 */
.template-header {
    min-width: 160px;
    max-width: 180px;
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    vertical-align: top;
    cursor: pointer;
    box-sizing: border-box;
}

/* 标题行：两端对齐，按钮自然靠右 */
.tpl-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    width: 100%;
    box-sizing: border-box;
}

/* 模板名称 */
.tpl-title-text {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

/* 亮度/速度行：统一左对齐，行间距拉开，不贴在一起 */
.tpl-header-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: nowrap !important;
    width: 100%;
    margin-bottom: 10px;
    box-sizing: border-box;
}
/* 最后一行去掉底边距 */
.tpl-header-row:last-child {
    margin-bottom: 0;
}

/* 标签文字 */
.tpl-label-bright {
    white-space: nowrap;
    font-size: 12px;
    flex-shrink: 0;
    min-width: 36px;
    box-sizing: border-box;
}

/* 亮度、速度下拉：宽度完全一致 */
.tpl_brightness_select,
.tpl_speed_select {
    width: 100px;
    max-width: 100px;
    flex-shrink: 0;
    font-size: 12px;
    padding: 2px 4px;
    box-sizing: border-box;
}

/* 测试按钮 */
.led-test-btn {
    padding: 4px 10px;
    flex-shrink: 0;
    font-size: 12px;
    box-sizing: border-box;
}
