/**
 * 卡儿酷3C认证 WebHID上位机 - 全局样式文件
 * 
 * 本文件包含整个应用的所有CSS样式定义，按功能模块组织：
 * 1. 全局重置样式
 * 2. 页面布局样式
 * 3. 头部导航样式
 * 4. 按钮样式
 * 5. 状态标签样式
 * 6. 表单控件样式
 * 7. 动画效果
 * 8. 日志面板样式
 */

/* ========== 1. 全局重置样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100%;
    min-height: 100vh;
    color: #333;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* ========== 2. 页面布局样式 ========== */

/* 连接页面样式 */
#page-connect {
    display: block;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    height: 100vh;
    overflow: hidden;
}

/* 主页面样式 */
#page-main {
    display: none;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#page-main.show {
    display: flex;
}

/* 连接容器 */
.connect-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 80px);
    padding: 10px;
}

/* 品牌Logo */
.brand-logo {
    font-size: 120px;
    font-weight: bold;
    color: white;
    margin-bottom: 20px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* 品牌名称 */
.brand-name {
    font-size: 40px;
    color: white;
    margin-bottom: 10px;
    font-weight: 300;
}

/* 品牌副标题 */
.brand-subtitle {
    font-size: 30px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 40px;
}

/* 页脚 */
.footer {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 20px;
    color: rgba(255, 255, 255, 0.6);
}

/* 连接面板 */
.connect-panel {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    min-width: 350px;
}

.connect-panel h2 {
    color: #1e40af;
    margin-bottom: 20px;
    font-size: 18px;
}

/* VID/PID输入组 */
.vid-pid-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.vid-pid-item {
    flex: 1;
}

.vid-pid-item label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #666;
}

.vid-pid-item input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: monospace;
    font-size: 14px;
    color: #333;
    background: white;
}

/* 菜单项 */
.menu-item {
    padding: 12px 16px;
    margin: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #4b5563;
    transition: all 0.2s;
}

.menu-item:hover {
    background: #e5e7eb;
    color: #374151;
}

.menu-item.active {
    background: #3b82f6;
    color: white;
}

/* 内容面板 */
.content-panel {
    min-height: 100%;
}

/* 主容器 */
.main-container {
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: row;
    height: calc(100vh - 60px);
    flex: 1;
    overflow: hidden;
}

/* 通用面板 */
.panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ========== 3. 头部导航样式 ========== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: #1e40af;
    color: white;
}

.header-title {
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
}

.header-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* ========== 4. 按钮样式 ========== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-right: 10px;
    margin-bottom: 10px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 主按钮 */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

/* 成功按钮 */
.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

/* 危险按钮 */
.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

/* 次要按钮 */
.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.4);
}

/* 禁用状态 */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 5. 状态标签样式 ========== */
.status {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 10px;
}

.status-connected {
    background: #22c55e;
    color: white;
}

.status-disconnected {
    background: #ef4444;
    color: white;
}

/* ========== 6. 表单控件样式 ========== */
input, select, textarea {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    color: white;
    font-family: 'Consolas', monospace;
    font-size: 14px;
    width: 100%;
    margin-bottom: 10px;
    transition: border-color 0.3s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

/* ========== 7. 动画效果 ========== */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 产品信息面板样式 */
#product-info-content {
    font-size: 16px;
    color: #333;
    line-height: 2.5;
}

#product-info-content span {
    color: #666;
    font-weight: bold;
}

#product-info-content div {
    margin-bottom: 8px;
}

/* 分电池信息表格样式 */
#cells-container {
    margin-top: 15px;
}

.cell-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 15px;
    color: #374151;
}

.cell-row .cell-label {
    font-weight: 600;
    color: #6b7280;
}

.cell-row .cell-value {
    color: #1f2937;
    font-weight: 500;
    font-family: 'Consolas', monospace;
}

/* 产品设置弹窗样式 */
#settings-modal input {
    background: #ffffff;
    color: #333;
    border: 1px solid #ddd;
    padding: 12px;
    font-size: 14px;
}

#settings-modal input:focus {
    border-color: #3b82f6;
    outline: none;
}

/* 连接面板按钮 */
.connect-btn {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
}

/* ========== 8. 日志面板样式 ========== */
.log-panel {
    background: #0a0a0a;
    border-radius: 8px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.log-time {
    color: #6b7280;
    margin-right: 10px;
}

.log-info {
    color: #60a5fa;
}

.log-success {
    color: #4ade80;
}

.log-error {
    color: #f87171;
}

.log-warning {
    color: #fbbf24;
}

.log-send {
    color: #a78bfa;
}

.log-receive {
    color: #34d399;
}