/* 全局样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 0;
}

/* Header 样式 */
header {
    background-color: #004C97;
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: 1.5px;
}

/* Container 样式 */
.container {
    width: 80%;
    max-width: 1200px;
    margin: 40px auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 30px;
}

/* 控制区域样式 */
.controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.controls input[type="text"], 
.controls button {
    padding: 12px 15px;
    margin-bottom: 15px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #ddd;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.controls input[type="text"] {
    background-color: #fafafa;
}

.controls button {
    background-color: #004C97;
    color: white;
    cursor: pointer;
    border: none;
    font-weight: bold;
}

.controls button:hover {
    background-color: #0369a1;
    transform: scale(1.05);
}

/* 消息显示区域样式 */
pre {
    flex: 2;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-size: 14px;
    line-height: 1.6;
    height: 450px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 自定义 Alert 样式 */
.custom-alert {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    border-radius: 5px;
    font-size: 18px;
    color: white;
    font-weight: bold;
    opacity: 0.95;
    animation: fadeIn 0.5s ease-in-out, fadeOut 0.5s ease-in 2.5s;
    z-index: 999;
}

.custom-alert.success {
    background-color: #28a745;
}

.custom-alert.error {
    background-color: #dc3545;
}

.custom-alert.info {
    background-color: #17a2b8;
}

.custom-alert.warning {
    background-color: #ffc107;
}

/* Topic 和 Payload 样式 */
.topic {
    color: #004C97;
    font-weight: bold;
    margin-bottom: 5px;
} 

.payload {
    color: #555;
    padding-left: 10px;
    font-family: monospace;
}


/* 分隔线 */
hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 10px 0;
}

/* 按钮 Hover 效果 */
button:focus {
    outline: none;
    box-shadow: 0 0 8px rgba(0, 76, 151, 0.6);
}

select {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background-color: white;
    font-size: 14px;
    transition: box-shadow 0.2s ease;
    margin: 10px 0;
}

select:focus {
    outline: none;
    box-shadow: 0 0 8px rgba(0, 76, 151, 0.6);
}

/* 弹出框的动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 0.95;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 0.95;
    }
    to {
        opacity: 0;
    }
}

/* 圖片預覽區域 */
/* 圖片預覽區域 */
.image-preview {
    margin-top: 20px;
    text-align: center;
}

.image-preview h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #004C97;
}

.image-preview img {
    max-width: 200px; /* 限制圖片的最大寬度 */
    max-height: 200px; /* 限制圖片的最大高度 */
    width: 100%; /* 設定圖片寬度為 100% 的容器大小 */
    border-radius: 10px;
    border: 2px solid #ddd;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    object-fit: contain; /* 保持圖片比例，必要時留白 */
    overflow: hidden;
}

.toggle-button {
    margin: 8px 0;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #004C97;
    background-color: #e6f0fb;
    border: 1px solid #b0d4f1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-button:hover {
    background-color: #cde6fb;
    color: #003366;
    transform: scale(1.05);
}
