/* 基础样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.0;
}

/* 容器样式 */
.container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

header {
    text-align: center;
    margin-bottom: -5px;
}

h2 {
    /* text-align: center; */

    color: #1a56db;
    margin-bottom: 6px;
    font-weight: 600;
}





.description {
    color: #64748b;
    font-size: 0.95rem;
    margin-top: 0;
}

/* 卡片式设计 */
.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* 面板标题样式 */
.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #1e40af;
    color: white;
    padding: 8px 15px;
    font-weight: 500;
}

.panel-header i {
    font-size: 1.1rem;
}

.panel-title {
    font-size: 1.05rem;
}

/* 控制面板内容样式 */
.control-panel {
    padding: 5px;
}

/* 连接设置水平布局 */
.connection-settings {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
}

/* 设置组样式 */
.settings-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    align-items: center;
}

.settings-subgroup {
    display: flex;
    gap: 10px;
    align-items: center;
    white-space: nowrap;
}

/* 文本区域样式 */
textarea {
    width: 98%;
    min-height: 100px;
    font-family: 'Consolas', 'Monaco', monospace;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    resize: vertical;
    white-space: pre;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

#receivedText {
    white-space: pre-wrap;
    word-break: break-all;
    background-color: #f8fafc;
}

#sendText {
    min-height: 100px;
}

#debugLog {
    min-height: 100px;
    font-family: monospace;
    font-size: 0.85rem;
    background-color: #f8fafc;
    color: #475569;
}

/* 按钮样式 */
button {
    padding: 8px 15px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.primary-btn {
    background-color: #2563eb;
    color: white;
}

.primary-btn:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

.secondary-btn {
    background-color: #f1f5f9;
    color: #334155;
}

.secondary-btn:hover {
    background-color: #e2e8f0;
    transform: translateY(-1px);
}

button.danger {
    background-color: #ef4444;
    color: white;
}

button.danger:hover {
    background-color: #dc2626;
}

button:disabled {
    background-color: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

/* 按钮组样式 */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* 状态指示器 */
.status {
    margin-left: auto;
    display: flex;
    align-items: center;
    color: #64748b;
    font-size: 0.9rem;
}

.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.connected {
    background-color: #10b981;
}

.disconnected {
    background-color: #ef4444;
}

.connecting {
    background-color: #f59e0b;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* 表单元素样式 */
select, input[type="text"], input[type="number"] {
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    min-width: 100px;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus, input[type="text"]:focus, input[type="number"]:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

.custom-baudrate {
    display: none;
    width: 100px;
}

.repeat-interval {
    width: 80px;
}

/* 复选框和标签样式 */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #334155;
    padding: 3px 0;
}

input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
}

/* 调试面板样式 */
.debug-panel {
    margin-top: 10px;
}

/* 字节计数器 */
.byte-counter {
    margin-left: auto;
    display: flex;
    align-items: center;
    color: #64748b;
    font-size: 0.9rem;
}

/* 新行选项 */
.newline-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 横向布局容器 */
.layout-row {
    display: flex;
    gap: 20px;
    width: 100%;
}

/* 左侧内容面板（占满剩余宽度） */
.content-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 右侧设置面板（固定宽度） */
.settings-card {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
}

/* 纵向排列的设置组 */
.vertical {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

/* 预设指令组样式 */
.preset-group {
    width: 100%;
    margin-top: 1px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preset-group label {
    font-size: 0.9rem;
    color: #334155;
    font-weight: 500;
}

.preset-group select {
    width: 100%;
    min-width: auto;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .connection-settings {
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .layout-row {
        flex-direction: column;
    }
    
    .settings-card {
        flex: none;
        width: 100%;
    }
    
    .connection-settings {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .status {
        margin-left: 0;
        margin-top: 10px;
    }
    
    .settings-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .settings-subgroup {
        width: 100%;
        justify-content: flex-start;
    }
    
    .button-group {
        flex-wrap: wrap;
    }
    
    button {
        flex-grow: 1;
        min-width: 45%;
        justify-content: center;
    }
    
    .byte-counter {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }
    
    body {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    button {
        min-width: 100%;
    }
    
    .settings-subgroup {
        flex-direction: column;
        align-items: flex-start;
    }
    
    select, input[type="number"] {
        width: 100%;
        min-width: auto;
    }
}
    