/* style.css - 主样式文件 */

/* 重置和基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    padding: 25px 30px;
}

header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

header p {
    opacity: 0.9;
    font-size: 14px;
}

/* 内容区域 */
.content {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
}

.form-container {
    flex: 1;
    min-width: 400px;
    padding: 30px;
    border-right: 1px solid #eee;
}

.response-container {
    flex: 1;
    min-width: 400px;
    padding: 30px;
    background-color: #f9fafc;
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
    font-size: 14px;
}

input, select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: border 0.3s;
}

input[name="token"] {
    padding-right: 40px;
}

input:focus, select:focus {
    border-color: #6a11cb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.1);
}

.required::after {
    content: " *";
    color: #e74c3c;
}

/* 按钮样式 */
.btn-submit {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    margin-top: 10px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(106, 17, 203, 0.2);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-check {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 5px;
}

.btn-check:hover {
    background: linear-gradient(135deg, #27ae60 0%, #219653 100%);
}

/* 清除按钮 */
.clear-token-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.clear-token-btn:hover {
    color: #ff4444;
}

.clear-token-btn:focus {
    outline: none;
}

/* 响应区域样式 */
.section-title {
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #6a11cb;
    color: #333;
}

.response-box {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 20px;
    border-radius: 6px;
    margin-top: 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    display: none;
}

/* 消息框样式 */
.error-box {
    background-color: #fff5f5;
    color: #c53030;
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    border-left: 4px solid #c53030;
}

.success-box {
    background-color: #f0fff4;
    color: #2f855a;
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    border-left: 4px solid #2f855a;
}

.info-box {
    background-color: #e8f4fd;
    color: #2c5282;
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    border-left: 4px solid #2c5282;
}

.record-box {
    background-color: #fef3c7;
    color: #92400e;
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    border-left: 4px solid #f59e0b;
}

/* 数据库信息框 */
.db-info-box {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.db-info-title {
    font-weight: bold;
    color: #495057;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.db-info-title i {
    margin-right: 8px;
    color: #6a11cb;
}

.db-field {
    display: flex;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #dee2e6;
}

.db-field:last-child {
    border-bottom: none;
}

.db-field-label {
    flex: 0 0 150px;
    font-weight: 500;
    color: #6c757d;
}

.db-field-value {
    flex: 1;
    color: #495057;
}

/* 加载动画 */
.loading {
    display: none;
    text-align: center;
    margin: 20px 0;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #6a11cb;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* 连接状态 */
.connection-status {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.connection-status.connected {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.connection-status.disconnected {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.status-icon {
    margin-right: 10px;
    font-size: 18px;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: white;
    border-radius: 15px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(-20px);
    transition: all 0.3s ease;
    max-width: 400px;
    width: 90%;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-icon {
    font-size: 80px;
    margin-bottom: 25px;
}

.modal-success .modal-icon {
    color: #2ecc71;
}

.modal-error .modal-icon {
    color: #e74c3c;
}

.modal-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.modal-message {
    font-size: 16px;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

.modal-button {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.modal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(106, 17, 203, 0.2);
}

/* Toast 消息样式 */
.toast-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    animation: slideIn 0.3s ease;
    color: white;
    font-weight: 500;
}

.toast-success {
    background-color: #2ecc71;
}

.toast-error {
    background-color: #e74c3c;
}

.toast-info {
    background-color: #3498db;
}

.toast-warning {
    background-color: #f39c12;
}

@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;
    }
}

/* 响应式设计 */
@media (max-width: 900px) {
    .content {
        flex-direction: column;
    }
    
    .form-container, .response-container {
        border-right: none;
        border-bottom: 1px solid #eee;
    }
}

/* 页脚样式 */
footer {
    text-align: center;
    padding: 20px;
    background-color: #f9f9f9;
    margin-top: 20px;
    border-radius: 0 0 10px 10px;
}

footer a {
    color: #333;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* 字段说明 */
.field-note {
    font-size: 12px;
    color: #777;
    margin-top: 5px;
}

/* 无响应消息 */
.no-response-message {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 50px;
}