/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
}

/* 区块样式 */
.section {
    background: white;
    margin-bottom: 20px;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-item {
    margin-bottom: 15px;
}

.label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-wrapper .input {
    flex: 1;
}

/* 复选框样式 */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #6c757d;
    color: white;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn.primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
    min-width: 60px;
}

.btn-close {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.submit-btn {
    width: 100%;
    margin-top: 10px;
}

.help-text {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
    line-height: 1.4;
}

/* 设备和WiFi列表样式 */
.device-list, .wifi-list {
    background: white;
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.list-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.device-item, .wifi-item {
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.device-item:hover, .wifi-item:hover {
    border-color: #667eea;
    background-color: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
}

.device-name, .wifi-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.device-id, .device-rssi, .wifi-rssi {
    font-size: 12px;
    color: #666;
}

/* 接收数据样式 */
.received-data {
    max-height: 200px;
    overflow-y: auto;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 15px;
    background-color: #f8f9fa;
}

.received-item {
    margin-bottom: 10px;
    padding: 8px;
    background: white;
    border-radius: 5px;
    border-left: 4px solid #667eea;
}

.received-time {
    font-size: 12px;
    color: #666;
    margin-bottom: 3px;
}

.received-content {
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.received-text {
    padding: 12px 15px;
    background-color: #f8f9fa;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #333;
    word-break: break-all;
    min-height: 40px;
    display: flex;
    align-items: center;
}

/* 状态栏样式 */
.status-bar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
}

/* 日志样式 */
.log-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
}

.log-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.log-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    height: 70%;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #e1e5e9;
}

.log-header h3 {
    margin: 0;
    color: #333;
}

.log-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
}

.log {
    margin-bottom: 5px;
    padding: 5px;
    border-radius: 3px;
    word-wrap: break-word;
    word-break: break-all;
}

.warn {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .section {
        padding: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .log-window {
        width: 95%;
        height: 80%;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section {
    animation: fadeIn 0.5s ease-out;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* WiFi扫描加载样式 */
.scan-wifi-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.scan-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e1e5e9;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #667eea;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}