:root {
    --primary-color: #3498db;
    --secondary-color: #2980b9;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --gray-color: #95a5a6;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f5f7fa;
    padding: 20px;
}

.container {
    max-width: 1350px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    overflow: visible;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    text-align: center;
}

header h1 {
    margin-bottom: 10px;
    font-size: 2.2rem;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

header a {
    color: white;
    text-decoration: underline;
}

/* HTTPS警告横幅 */
.warning-banner {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 12px 30px;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(231, 76, 60, 0.3);
}

.warning-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.warning-content i {
    font-size: 24px;
    flex-shrink: 0;
}

.warning-text {
    flex: 1;
}

.warning-text a {
    color: white;
    text-decoration: underline;
    font-weight: bold;
}

.warning-text a:hover {
    text-decoration: none;
}

main {
    padding: 8px 30px 22px 30px;
    overflow: visible;
    position: relative;
}

/* 主要内容区域布局 */
.content-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.form-container {
    flex: 1;
    min-width: 0;
}

.result-container {
    flex: 1;
    min-width: 0;
    margin-top: 0;
    border-top: none;
    padding-top: 0;
    border-left: 1px solid #eee;
    padding-left: 30px;
}

.form-group {
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
    margin-bottom: 5px;
}

label {
    display: block;
    margin: 4px 0;
    font-weight: 600;
    color: var(--dark-color);
}

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

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.password-container {
    position: relative;
    z-index: 2;
    width: 100%;
}

.password-container input {
    width: 100%;
    padding-right: 50px;
    box-sizing: border-box;
    pointer-events: auto !important;
    opacity: 1 !important;
    position: relative;
    z-index: 1;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-color);
    cursor: pointer;
    font-size: 18px;
    z-index: 3;
    padding: 5px;
    width: auto;
    height: auto;
}

.password-toggle:hover {
    color: var(--dark-color);
    background: none;
}

#apiKey:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    outline: none;
}

/* 安全提示 */
.security-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 4px 12px;
    background-color: #fff8e1;
    border: 1px solid #ffd54f;
    border-radius: 4px;
    font-size: 14px;
    color: #e65100;
}

.security-notice i {
    color: #e76620;
}

.security-notice a {
    color: #ffa216;
}

.security-notice.safe {
    background-color: #e1ffe5;
    border: 1px solid #3cc853;
    color: #1c7e45;
}

.security-notice.safe i {
    color: #27cb02;
}

.tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
    color: var(--primary-color);
    cursor: help;
    z-index: 1000;
}

.tooltip-content {
    visibility: hidden;
    width: 370px;
    background-color: var(--dark-color);
    color: white;
    text-align: left;
    border-radius: 6px;
    padding: 12px;
    position: absolute;
    z-index: 1001;
    bottom: 125%;
    left: 50%;
    transform: translateX(calc(-50% + 20px));
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    word-wrap: break-word;
}

.tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

.tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--dark-color) transparent transparent transparent;
}

textarea {
    resize: vertical;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

button:hover {
    background: var(--secondary-color);
}

button:disabled {
    background: var(--gray-color);
    cursor: not-allowed;
}

button:disabled:hover {
    background: var(--gray-color);
    transform: none;
}

/* 调试模式区域 */
.debug-section {
    padding: 8px 25px;
    margin-bottom: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

/* HTTPS环境下隐藏调试模式区域 */
.debug-section.hidden {
    display: none;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 8px;
}

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

.debug-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-color);
}

.debug-notice i {
    color: #6c757d;
}

.result-container {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.result-container h2 {
    margin-bottom: 15px;
    color: var(--dark-color);
}

.output-section {
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 5px;
    background: #f9f9f9;
}

.output-section h3 {
    margin-bottom: 10px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.output-section .content {
    font-family: 'Courier New', Courier, monospace;
    white-space: pre-wrap;
    background: white;
    padding: 10px;
    border-radius: 3px;
    border: 1px solid #eee;
    max-height: 300px;
    overflow-y: auto;
}

/* 确保URL输入组和代码输入组的切换平滑 */
#urlGroup, #codeGroup {
    transition: opacity 0.3s ease;
}

.stdout h3 {
    color: var(--success-color);
}

.stderr h3 {
    color: var(--warning-color);
}

.error h3 {
    color: var(--danger-color);
}

.message h3 {
    color: var(--danger-color);
}

.loading {
    opacity: 0.7;
    pointer-events: none;
}

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

.pulse {
    animation: pulse 1.5s infinite;
}

@media (max-width: 768px) {
    body {
        padding: 8px;
    }

    header {
        padding: 12px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    main {
        padding: 6px 15px 8px 15px;
    }

    .content-wrapper {
        flex-direction: column;
        gap: 0;
    }

    .form-container {
        width: 100%;
    }

    .result-container {
        width: 100%;
        border-left: none;
        padding-left: 0;
        border-top: 1px solid #eee;
        padding-top: 20px;
    }

    .tooltip-content {
        width: 280px;
        font-size: 11px;
        left: 50%;
        transform: translateX(calc(-50% + 10px));
    }

    .warning-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .security-notice, .debug-notice {
        font-size: 13px;
    }
}
