* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
}

header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 10px 20px;
    flex-shrink: 0;
    position: relative;
}
header img{width: 40px;height: 40px;float: left;margin-right: 10px;}
header h1 {
    font-size: 2em;
    font-weight: 300;
    margin: 0;
}
header .link{
    float: right;
    position: absolute;
    top:  20px;right: 20px;
}
header .link a{text-decoration: none;color: #fff;}
/* 基本配置区域 - 100vw宽度 */
.basic-config {
    background: white;
    padding: 10px 20px;
    border-bottom: 1px solid #e8f4fc;
    flex-shrink: 0;
}

.config-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.config-input {
    flex: 1;
    min-width: 250px;
}

.config-input input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e8f4fc;
    border-radius: 6px;
    font-size: 14px;
    background: #f8fbfe;
}

.config-input input:focus {
    outline: none;
    border-color: #3498db;
    background: white;
}

.connection-buttons {
    display: flex;
    gap: 10px;
    padding: 10px;
}
.connection-buttons  button{margin: 0;}

/* 内容区域 - 自适应高度 */
.content-area {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 0;
}

/* 左侧发送区域 */
.send-section-wrapper {
    flex: 0 0 600px;
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: white;
    border-right: 1px solid #e8f4fc;
    overflow: hidden;
}
.history-section{height: calc(100vh - 400px);position: relative;}
#historyList{height: calc(100% - 30px);}
/* 右侧日志区域 */
.log-section-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: white;
    overflow: hidden;
    height: 100%;
}

.connection-panel, .message-panel, .log-panel {
    /* background: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); */
    flex: 1;
    margin-bottom: 10px;
    height: 100%;
}

.connection-panel {
    margin-bottom: 0;
    box-shadow: none;
    padding: 0;
}

h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-icon {
    cursor: pointer;
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.toggle-icon.expanded {
    transform: rotate(180deg);
}

.input-group {
    margin-bottom: 10px;
}

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

input[type="text"], input[type="number"], textarea, select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e8f4fc;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: #f8fbfe;
}

input[type="text"]:focus, input[type="number"]:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #3498db;
    background: white;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-right: 10px;
    margin-bottom: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2980b9, #2471a3);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #9aaaac, #5c6a74);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #84abad, #6c7b7d);
    transform: translateY(-2px);
}

.btn-red {
    background: linear-gradient(135deg, #f71d82, #ce0060);
    color: white;
}

.btn-red:hover:not(:disabled) {
    background: linear-gradient(135deg, #f71d82, #ff0278);
    transform: translateY(-2px);
}


.btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.advanced-content {
    display: none;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
}

.advanced-content.visible {
    display: block;
}

.history-list {
    overflow-y: auto;overflow-x: hidden;
    border: 1px solid #e8f4fc;
    border-radius: 8px;
    background: #f8fbfe;
}

.history-item {
    padding: 10px;
    border-bottom: 1px solid #e8f4fc;
    transition: all 0.3s ease;position: relative;
}

.history-item:hover {
    background: #e3f2fd;
}

.history-item:last-child {
    border-bottom: none;
}

.history-content {
    flex: 1;
    font-size: 14px;
    color: #2c3e50;
    word-break: break-word;
    line-height: 1.4;
}

.history-text {
    display: block;
    margin-top: 2px;
    opacity: 0.9;
}

.history-empty {
    text-align: center;
    color: #95a5a6;
    font-style: italic;
    padding: 10px;
}

.history-actions {
    position: absolute;right: 10px;top: 10px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
    margin-left: 10px;
   cursor: pointer;
}
.history-actions-clear .clearHistoryBtn{color: #34495e;}
.history-actions-clear{opacity: 1;right: 40px;top: 0px;}
.history-item:hover .history-actions {
    opacity: 1;
}

.btn-history {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.btn-history::after {
    content: attr(title);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.btn-history:hover::after {
    opacity: 1;
}

.resend-btn {
    background: #27ae60;
    color: white;
}

.resend-btn:hover {
    background: #219653;
    transform: scale(1.1);
}

.reuse-btn {
    background: #3498db;
    color: white;
}

.reuse-btn:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.delete-btn {
    background: #e74c3c;
    color: white;
}

.delete-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.log-content {
    height: calc(100% - 75px);
    overflow-y: auto;
    background: #1e272e;
    color: #ecf0f1;
    padding: 10px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.log-entry {
    margin-bottom: 8px;
    border-left: 3px solid;
    padding-left: 10px;
}

.log-info {
    border-color: #3498db;
    color: #3498db;
}

.log-success {
    border-color: #27ae60;
    color: #27ae60;
}

.log-warning {
    border-color: #f39c12;
    color: #f39c12;
}

.log-error {
    border-color: #e74c3c;
    color: #e74c3c;
}

.log-debug {
    border-color: #9b59b6;
    color: #9b59b6;
}

.log-timestamp {
    color: #95a5a6;
    font-size: 12px;
    margin-right: 5px;
}

.log-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.badge {
    background: #e74c3c;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

/* 弹窗样式 */
.modal {
    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-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e8f4fc;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: #95a5a6;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #e74c3c;
}

.modal-body {
    padding: 20px;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .config-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .connection-buttons {
        justify-content: center;
        padding: 10px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .content-area {
        flex-direction: column;
    }
    
    .send-section-wrapper {
        border-right: none;
        border-bottom: 1px solid #e8f4fc;
    }
    
    .log-content,
    .history-list {
        height: 200px;
    }
}

.connection-status {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-connected {
    background: #27ae60;
}

.status-disconnected {
    background: #e74c3c;
}

.status-connecting {
    background: #f39c12;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}