/* public/assets/css/hardware/bluetooth-test.css */
.ble-wrapper { --p-bg: #ffffff; --p-border: #e2e8f0; --p-primary: #2563eb; --p-primary-hover: #1d4ed8; --p-success: #10b981; --p-danger: #ef4444; --p-text: #0f172a; --p-text-muted: #64748b; --p-code: #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); box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.ble-wrapper *, .ble-wrapper *::before, .ble-wrapper *::after { box-sizing: border-box; }

.ble-header { text-align: center; margin-bottom: 24px; border-bottom: 1px solid var(--p-border); padding-bottom: 24px; }
.ble-title { font-size: 1.7rem; font-weight: 800; color: var(--p-text); margin: 0 0 10px 0; }
.ble-subtitle { font-size: 0.95rem; color: var(--p-text-muted); max-width: 800px; margin: 0 auto; line-height: 1.6; }

.ble-workspace { display: flex; flex-direction: column; gap: 20px; }

/* Control Panel */
.ble-control-panel { background: #f8fafc; border-radius: 16px; border: 1px solid var(--p-border); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.ble-panel-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--p-border); padding-bottom: 12px; }
.ble-panel-title { font-size: 1.05rem; font-weight: 800; color: var(--p-text); text-transform: uppercase; letter-spacing: 0.5px; }

.ble-status-badge { font-size: 0.85rem; font-weight: 800; padding: 6px 12px; border-radius: 8px; background: #e2e8f0; color: #64748b; }
.ble-status-badge.connected { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

.ble-form-group { display: flex; flex-direction: column; gap: 8px; }
.ble-label { font-size: 0.9rem; font-weight: 700; color: #475569; }
.ble-input { width: 100%; padding: 12px 16px; border: 2px solid #cbd5e1; border-radius: 10px; font-size: 1rem; font-family: monospace; color: var(--p-code); outline: none; transition: 0.2s; background: #fff; }
.ble-input:focus { border-color: var(--p-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
.ble-hint { font-size: 0.8rem; color: #ef4444; line-height: 1.4; }

.ble-action-row { display: flex; gap: 16px; }
.ble-btn-primary, .ble-btn-danger { flex: 1; padding: 14px; border-radius: 10px; font-weight: 800; font-size: 1.05rem; cursor: pointer; border: none; transition: 0.2s; color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; }
.ble-btn-primary { background: var(--p-primary); box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3); }
.ble-btn-primary:hover { background: var(--p-primary-hover); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4); }
.ble-btn-danger { background: var(--p-danger); box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3); }
.ble-btn-danger:hover { background: #dc2626; transform: translateY(-2px); }

.ble-device-info { display: flex; gap: 24px; background: #ffffff; padding: 12px 16px; border-radius: 8px; border: 1px solid #e2e8f0; font-size: 0.9rem; color: #334155; }
.ble-device-info strong { color: var(--p-primary); margin-right: 6px; }
.code { font-family: 'Consolas', monospace; font-weight: 700; }

/* Split Layout */
.ble-layout-split { display: flex; gap: 20px; align-items: stretch; height: 500px; }
@media (max-width: 850px) { .ble-layout-split { flex-direction: column; height: auto; } }

/* Tree Panel */
.ble-tree-panel { flex: 1; background: #ffffff; border-radius: 16px; border: 1px solid var(--p-border); padding: 16px; display: flex; flex-direction: column; overflow: hidden; }
.ble-tree-container { flex: 1; overflow-y: auto; padding-right: 8px; margin-top: 12px; }
.ble-empty-state { text-align: center; color: #94a3b8; font-weight: 700; margin-top: 40px; font-size: 0.95rem; }

/* Tree Nodes UI */
.tree-svc { border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 12px; background: #f8fafc; overflow: hidden; }
.tree-svc-header { background: #e2e8f0; padding: 8px 12px; font-weight: 800; font-size: 0.85rem; color: #1e293b; display: flex; align-items: center; gap: 8px; }
.tree-svc-body { padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.tree-char { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #ffffff; border: 1px solid #cbd5e1; border-radius: 6px; cursor: pointer; transition: 0.2s; }
.tree-char:hover { border-color: var(--p-primary); box-shadow: 0 2px 5px rgba(37, 99, 235, 0.1); }
.tree-char.active { background: #eff6ff; border-color: var(--p-primary); box-shadow: inset 0 0 0 1px var(--p-primary); }
.tree-char-uuid { font-family: monospace; font-size: 0.85rem; color: #334155; font-weight: 700; }
.tree-char-props { display: flex; gap: 4px; }
.prop-badge { font-size: 0.65rem; font-weight: 800; padding: 2px 6px; border-radius: 4px; background: #e2e8f0; color: #475569; }
.prop-badge.R { background: #dcfce7; color: #166534; }
.prop-badge.W { background: #fee2e2; color: #991b1b; }
.prop-badge.N { background: #fef3c7; color: #92400e; }

/* Terminal Panel */
.ble-terminal-panel { flex: 1.2; background: #0f172a; border-radius: 16px; border: 2px solid #334155; display: flex; flex-direction: column; overflow: hidden; box-shadow: inset 0 5px 20px rgba(0,0,0,0.5); }
.ble-terminal-panel .ble-panel-title { color: #cbd5e1; background: #1e293b; margin: 0; padding: 12px 16px; border-bottom: 2px solid #334155; font-family: monospace; }

.ble-terminal-log { flex: 1; padding: 16px; overflow-y: auto; font-family: 'Consolas', monospace; font-size: 0.9rem; line-height: 1.5; color: #38bdf8; word-break: break-all; }
.ble-log-line { margin-bottom: 6px; border-bottom: 1px dashed rgba(51, 65, 85, 0.5); padding-bottom: 4px; }
.ble-log-line.system { color: #64748b; font-style: italic; }
.ble-log-line.error { color: #ef4444; font-weight: 700; }
.ble-log-line.tx { color: #f59e0b; }
.ble-log-line.tx::before { content: "TX -> "; font-weight: 800; }
.ble-log-line.rx { color: #10b981; }
.ble-log-line.rx::before { content: "RX <- "; font-weight: 800; }

.ble-io-controls { background: #1e293b; padding: 16px; border-top: 2px solid #334155; display: flex; flex-direction: column; gap: 12px; }
.ble-active-char { color: #cbd5e1; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.ble-active-char .code { color: #38bdf8; }
.ble-io-row { display: flex; gap: 10px; }
.ble-input-hex { flex: 1; padding: 10px 14px; border: 1px solid #475569; border-radius: 8px; font-family: monospace; font-size: 1rem; background: #0f172a; color: #f8fafc; outline: none; text-transform: uppercase; }
.ble-input-hex:focus { border-color: var(--p-primary); }
.ble-input-hex:disabled { background: #1e293b; cursor: not-allowed; opacity: 0.5; }
.ble-btn-action { padding: 0 20px; border-radius: 8px; font-weight: 800; font-size: 0.95rem; cursor: pointer; border: none; background: #f59e0b; color: #fff; transition: 0.2s; }
.ble-btn-action.btn-read { background: #10b981; }
.ble-btn-action:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.1); }
.ble-btn-action:disabled { background: #475569; cursor: not-allowed; color: #94a3b8; }

/* Dark Mode */
[data-theme="dark"] .ble-wrapper { background: #1e293b; border-color: #334155; --p-code: #f8fafc; }
[data-theme="dark"] .ble-title, [data-theme="dark"] .ble-panel-title { color: #f8fafc; }
[data-theme="dark"] .ble-subtitle, [data-theme="dark"] .ble-label { color: #94a3b8; }
[data-theme="dark"] .ble-control-panel, [data-theme="dark"] .ble-tree-panel { background: #0f172a; border-color: #475569; }
[data-theme="dark"] .ble-input { background: #1e293b; border-color: #475569; color: #f8fafc; }
[data-theme="dark"] .ble-status-badge { background: #334155; color: #cbd5e1; }
[data-theme="dark"] .ble-status-badge.connected { background: rgba(37, 99, 235, 0.2); color: #60a5fa; border-color: #1d4ed8; }
[data-theme="dark"] .ble-device-info { background: #1e293b; border-color: #475569; color: #cbd5e1; }
[data-theme="dark"] .tree-svc { background: #1e293b; border-color: #475569; }
[data-theme="dark"] .tree-svc-header { background: #334155; color: #f8fafc; }
[data-theme="dark"] .tree-char { background: #0f172a; border-color: #475569; }
[data-theme="dark"] .tree-char.active { background: rgba(37, 99, 235, 0.2); border-color: var(--p-primary); }
[data-theme="dark"] .tree-char-uuid { color: #cbd5e1; }