body {
    background: #f7f7f7;
    font-family: 'Segoe UI', 'Microsoft YaHei', Arial, sans-serif;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1080px;
    margin: 40px auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    padding: 32px 28px 24px 28px;
}

h2 {
    text-align: center;
    color: #333;
    margin-bottom: 24px;
}

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

textarea, input[type="text"] {
    width: 100%;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 10px;
    font-size: 15px;
    margin-bottom: 18px;
    box-sizing: border-box;
    background: #fafbfc;
    transition: border-color 0.2s;
}

/* 添加textarea的最大高度限制 */
textarea {
    min-height: 60px;
    max-height: 300px;
    resize: vertical;
}

/* 强制设置textarea#mails的高度 */
textarea#mails {
    min-height: 60px !important;
    max-height: 300px !important;
    height: auto !important;
    resize: vertical !important;
    transition: none !important; /* 禁用过渡效果，防止高度变化时的动画 */
}

textarea:focus, input[type="text"]:focus {
    border-color: #409eff;
    outline: none;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: nowrap;
    width: 100%;
}

.form-row-left {
    display: flex;
    align-items: center;
    gap: 0 !important;
    margin: 0;
    padding: 0;
    flex: 0 1 auto;
}

.form-row-right {
    display: flex;
    align-items: center;
    gap: 0px;
    justify-content: flex-end;
    margin-left: auto;
}

.form-row input[type="text"] {
    flex: 0 1 200px;
    width: auto;
    min-width: 0;
    margin-bottom: 0;
}

.form-row label {
    display: inline-block;
    margin-bottom: 0;
    margin-right: 4px;
    vertical-align: middle;
}

.form-row select {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
    background: #fafbfc;
    margin-right: 10px;
}

.form-row-right label {
    margin-right: 2px;
    margin-left: 6px;
}

.buy-link {
    color: #ff0000;
    text-decoration: none;
    margin-left: 10px;
    margin-right: 0;
    font-weight: bold;
    white-space: nowrap;
    line-height: 32px;
}

button[type="submit"] {
    background: #409eff;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 28px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

button[type="submit"]:hover {
    background: #3076c9;
}

.message {
    margin-left: 0;
    font-size: 15px;
    vertical-align: middle;
    white-space: nowrap;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    margin-bottom: 20px;
    flex-wrap: nowrap;
}

.action-button {
    background: #409eff;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 28px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.action-button:hover {
    background: #3076c9;
}

/* 响应式设计优化 */
@media (max-width: 700px) {
    .container { padding: 16px 6px; }
    .form-row { flex-direction: column; align-items: stretch; gap: 0; }
    .message { margin-left: 0; margin-top: 8px; }
    
    /* 移动端textarea高度限制 - 强制优先级 */
    textarea, textarea[id], textarea#mails {
        min-height: 50px !important;
        max-height: 120px !important;
        height: 120px !important;
        font-size: 14px !important;
        overflow-y: auto !important;
        transition: none !important; /* 禁用过渡效果 */
    }
    
    /* 确保在不同类型下保持一致高度 */
    .token-type-api textarea#mails,
    .token-type-taobao textarea#mails {
        height: 120px !important;
        max-height: 120px !important;
        min-height: 50px !important;
    }
    
    #token_type {
        margin-bottom: 10px;
        width: 100%;
    }
    
    #token-label {
        margin-left: 0 !important;
        margin-bottom: 5px !important;
    }
    
    .form-row-left {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    /* 移动端token输入框样式 */
    #token, .form-row input#token {
        width: 100% !important;
        height: 36px !important;
        max-height: 36px !important;
        min-height: 36px !important;
        box-sizing: border-box !important;
        margin: 0 0 10px 0 !important;
        flex: none !important;
    }
}

#token {
    width: 400px !important;
    flex: none !important;
    max-width: 100%;
    min-width: 120px;
    margin-left: -2px !important;
}

.form-row input#token {
    width: 400px !important;
    flex: 0 0 400px !important;
    min-width: 100px;
    max-width: 100%;
}

.form-row label[for="token"] {
    margin: 0 !important;
    padding: 0 !important;
}

.api-link-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    width: 100%;
}

.api-link-row label {
    display: inline-block;
    margin: 0;
    padding: 0;
    margin-right: 8px;
}

.flex-spacer {
    flex-grow: 1;
}

/* 新增token类型选择器样式 */
.token-type-select {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
    background: #fafbfc;
    margin-right: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: border-color 0.2s;
}

.token-type-select:focus {
    border-color: #409eff;
    outline: none;
}

/* 调整token标签样式 */
#token-label {
    white-space: nowrap;
    margin-left: 10px !important;
}

/* 响应式设计优化 */
@media (max-width: 700px) {
    #token_type {
        margin-bottom: 10px;
        width: 100%;
    }
    
    #token-label {
        margin-left: 0 !important;
        margin-bottom: 5px !important;
    }
    
    .form-row-left {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
}

/* 状态显示容器 */
.status-container {
    margin-left: 10px;
    font-size: 14px;
    display: inline-block;
}

.status-text {
    padding: 3px 8px;
    border-radius: 4px;
    background-color: #f5f5f5;
    white-space: nowrap;
}

/* 行数计数器 */
.line-count-container {
    margin-right: 15px;
    font-size: 14px;
    color: #444;
    white-space: nowrap;
}

.line-count-container span {
    font-weight: 500;
}

#line-count {
    color: #409eff;
    font-weight: bold;
    margin: 0 2px;
}

/* 响应式设计优化 */
@media (max-width: 700px) {
    #token_type {
        margin-bottom: 10px;
        width: 100%;
    }
    
    #token-label {
        margin-left: 0 !important;
        margin-bottom: 5px !important;
    }
    
    .form-row-left {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .status-container {
        margin-left: 0;
        margin-top: 5px;
        display: block;
    }
    
    .line-count-container {
        margin-bottom: 10px;
        margin-right: 0;
        width: 100%;
        text-align: left;
    }
}

/* 数据警告提示 */
.data-warning {
    background-color: #fff3cd;
    color: #856404;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 14px;
    border-left: 4px solid #ffc107;
}

/* 确保data-warning在没有内容且display:none时不显示 */
.data-warning:empty {
    display: none !important;
    padding: 0;
    margin: 0;
    border: none;
}

/* 行计数器样式 */
.line-counter {
    background-color: #f5f5f5;
    color: #555;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    margin-top: 5px;
    margin-bottom: 15px;
    display: inline-block;
    border: 1px solid #e0e0e0;
    position: relative;
    font-weight: 500;
}

