<?php
/**
 * 存储类型设置 - 新版界面
**/
define('IN_ADMIN', true);
include("../includes/common.php");
$title='存储类型设置';
include './head.php';
if($islogin==1){}else exit("<script language='javascript'>window.location.href='./login.php';</script>");
?>
<div class="container">
    <!-- 页面标题 -->
    <div class="page-header-section">
        <div class="page-title">
            <div class="page-title-icon"><i class="fa fa-database"></i></div>
            <h1>存储类型设置</h1>
        </div>
    </div>
<!-- 存储类型选择 -->
    <div class="card storage-main-card">
        <div class="card-header">
            <h3><i class="fa fa-hdd-o"></i> 存储类型选择</h3>
        </div>
        <div class="card-body">
            <form onsubmit="return saveSetting(this)" method="post" class="settings-form">
                <div class="form-row">
                    <div class="form-group">
                        <label class="form-label">切换存储类型</label>
                        <select class="form-control" name="storage" id="storage_select" default="<?php echo $conf['storage']?>">
                            <option value="local">本地存储</option>
                            <option value="oss">阿里云OSS</option>
                            <option value="qcloud">腾讯云COS</option>
                            <option value="obs">华为云OBS</option>
                            <option value="upyun">又拍云</option>
                            <option value="qiniu">七牛云</option>
                            <option value="rainyun">雨云存储</option>
                            <?php if (defined('SAE_ACCESSKEY')) { ?>
                            <option value="sae">SaeStorage</option>
                            <?php } ?>
                        </select>
                        <div class="alert alert-warning storage-warning">
                            <i class="fa fa-exclamation-triangle"></i>
                            <span>已有文件的情况下请勿随意变更存储类型，否则之前上传的文件全部无法下载！</span>
                        </div>
                    </div>
                </div>

                <div id="cloud_stor" class="cloud-storage-options" style="display:none;">
                    <div class="form-row two-col">
                        <div class="form-group">
                            <label class="form-label">文件上传方式</label>
                            <select class="form-control" name="uploadfile_type" default="<?php echo $conf['uploadfile_type']?>">
                                <option value="0">网站中转</option>
                                <option value="1">直接链接</option>
                            </select>
                            <span class="help-text">网站中转：上传文件先经过本站服务器，然后上传到云存储<br>直接链接：文件直接上传到云存储，不经过本站服务器，上传速度更快</span>
                        </div>
                        <div class="form-group">
                            <label class="form-label">文件下载方式</label>
                            <select class="form-control" name="downfile_type" id="downfile_type" default="<?php echo $conf['downfile_type']?>">
                                <option value="0">网站中转</option>
                                <option value="1">直接链接</option>
                            </select>
                            <span class="help-text">网站中转：下载文件经过本站服务器中转<br>直接链接：需支付流量费用，下载速度更快</span>
                        </div>
                    </div>

                    <div id="downfile_type_form" class="form-row" style="<?php echo $conf['downfile_type']!='1'?'display:none;':''; ?>">
                        <div class="form-group">
                            <label class="form-label">文件下载域名</label>
                            <div class="input-group domain-input-group">
                                <select class="form-control protocol-select" name="downfile_protocol" default="<?php echo $conf['downfile_protocol']; ?>">
                                    <option value="0">http://</option>
                                    <option value="1">https://</option>
                                </select>
                                <input type="text" class="form-control" name="downfile_domain" value="<?php echo htmlspecialchars($conf['downfile_domain']); ?>" placeholder="留空则使用云存储默认域名"/>
                            </div>
                            <span class="help-text">填写Bucket绑定的域名，也可使用CDN域名</span>
                        </div>
                    </div>
                </div>

                <div class="form-actions">
                    <button type="submit" class="btn btn-primary">
                        <i class="fa fa-save"></i> 保存设置
                    </button>
                </div>
            </form>
        </div>
    </div>

    <!-- 存储提供商配置 -->
    <div class="storage-providers">
        <!-- 本地存储 -->
        <div class="provider-card" id="card_local">
            <div class="provider-header">
                <div class="provider-icon local">
                    <i class="fa fa-server"></i>
                </div>
                <div class="provider-info">
                    <h4>本地存储</h4>
                    <p>将文件存储在服务器本地磁盘</p>
                </div>
                <span class="provider-badge default">默认</span>
            </div>
            <div class="provider-body">
                <form onsubmit="return saveSetting(this)" method="post" class="settings-form">
                    <div class="form-row">
                        <div class="form-group">
                            <label class="form-label">本地存储路径</label>
                            <input type="text" name="filepath" value="<?php echo htmlspecialchars($conf['filepath']); ?>" class="form-control" placeholder="默认存储在网站file目录"/>
                            <span class="help-text">不填写则默认存储在网站file目录下，如需填写，只能填写以服务器根目录/开始的绝对路径</span>
                        </div>
                    </div>
                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary btn-sm">
                            <i class="fa fa-save"></i> 保存
                        </button>
                    </div>
                </form>
            </div>
        </div>

        <?php if (defined('SAE_ACCESSKEY')) { ?>
        <!-- SaeStorage -->
        <div class="provider-card" id="card_sae">
            <div class="provider-header">
                <div class="provider-icon sae">
                    <i class="fa fa-cloud"></i>
                </div>
                <div class="provider-info">
                    <h4>SaeStorage</h4>
                    <p>新浪云存储服务</p>
                </div>
            </div>
            <div class="provider-body">
                <form onsubmit="return saveSetting(this)" method="post" class="settings-form">
                    <div class="form-row">
                        <div class="form-group">
                            <label class="form-label">SAE Storage名称</label>
                            <input type="text" name="storagename" value="<?php echo htmlspecialchars($conf['storagename']); ?>" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary btn-sm">
                            <i class="fa fa-save"></i> 保存
                        </button>
                    </div>
                </form>
            </div>
        </div>
        <?php } ?>

        <!-- 阿里云OSS -->
        <div class="provider-card" id="card_oss">
            <div class="provider-header">
                <div class="provider-icon oss">
                    <i class="fa fa-cloud"></i>
                </div>
                <div class="provider-info">
                    <h4>阿里云OSS</h4>
                    <p>阿里云对象存储服务</p>
                </div>
                <a href="https://www.aliyun.com/product/oss?userCode=1cyrqim7" target="_blank" rel="noreferrer" class="provider-link">
                    <i class="fa fa-external-link"></i> 开通地址
                </a>
            </div>
            <div class="provider-body">
                <form onsubmit="return saveSetting(this)" method="post" class="settings-form">
                    <div class="form-row two-col">
                        <div class="form-group">
                            <label class="form-label">AccessKey Id</label>
                            <input type="text" name="oss_ak" value="<?php echo htmlspecialchars($conf['oss_ak']); ?>" class="form-control"/>
                        </div>
                        <div class="form-group">
                            <label class="form-label">AccessKey Secret</label>
                            <input type="text" name="oss_sk" value="<?php echo htmlspecialchars($conf['oss_sk']); ?>" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-row two-col">
                        <div class="form-group">
                            <label class="form-label">OSS EndPoint</label>
                            <input type="text" name="oss_endpoint" value="<?php echo htmlspecialchars($conf['oss_endpoint']); ?>" class="form-control" placeholder="如：oss-cn-hangzhou.aliyuncs.com"/>
                        </div>
                        <div class="form-group">
                            <label class="form-label">OSS Bucket</label>
                            <input type="text" name="oss_bucket" value="<?php echo htmlspecialchars($conf['oss_bucket']); ?>" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary btn-sm">
                            <i class="fa fa-save"></i> 保存
                        </button>
                    </div>
                </form>
            </div>
        </div>

        <!-- 腾讯云COS -->
        <div class="provider-card" id="card_qcloud">
            <div class="provider-header">
                <div class="provider-icon qcloud">
                    <i class="fa fa-cloud"></i>
                </div>
                <div class="provider-info">
                    <h4>腾讯云COS</h4>
                    <p>腾讯云对象存储服务</p>
                </div>
                <a href="https://cloud.tencent.com/act/cps/redirect?redirect=10042&cps_key=11eaac2f518cd09a6288f4b1912228b8" target="_blank" rel="noreferrer" class="provider-link">
                    <i class="fa fa-external-link"></i> 开通地址
                </a>
            </div>
            <div class="provider-body">
                <form onsubmit="return saveSetting(this)" method="post" class="settings-form">
                    <div class="form-row two-col">
                        <div class="form-group">
                            <label class="form-label">SecretId</label>
                            <input type="text" name="qcloud_id" value="<?php echo htmlspecialchars($conf['qcloud_id']); ?>" class="form-control"/>
                        </div>
                        <div class="form-group">
                            <label class="form-label">SecretKey</label>
                            <input type="text" name="qcloud_key" value="<?php echo htmlspecialchars($conf['qcloud_key']); ?>" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-row two-col">
                        <div class="form-group">
                            <label class="form-label">存储桶地域</label>
                            <input type="text" name="qcloud_region" value="<?php echo htmlspecialchars($conf['qcloud_region']); ?>" class="form-control" placeholder="如：ap-shanghai"/>
                        </div>
                        <div class="form-group">
                            <label class="form-label">存储桶名称</label>
                            <input type="text" name="qcloud_bucket" value="<?php echo htmlspecialchars($conf['qcloud_bucket']); ?>" class="form-control" placeholder="格式：BucketName-APPID"/>
                        </div>
                    </div>
                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary btn-sm">
                            <i class="fa fa-save"></i> 保存
                        </button>
                    </div>
                </form>
            </div>
        </div>

        <!-- 华为云OBS -->
        <div class="provider-card" id="card_obs">
            <div class="provider-header">
                <div class="provider-icon obs">
                    <i class="fa fa-cloud"></i>
                </div>
                <div class="provider-info">
                    <h4>华为云OBS</h4>
                    <p>华为云对象存储服务</p>
                </div>
                <a href="https://www.huaweicloud.com/product/obs.html" target="_blank" rel="noreferrer" class="provider-link">
                    <i class="fa fa-external-link"></i> 开通地址
                </a>
            </div>
            <div class="provider-body">
                <form onsubmit="return saveSetting(this)" method="post" class="settings-form">
                    <div class="form-row two-col">
                        <div class="form-group">
                            <label class="form-label">AccessKeyId</label>
                            <input type="text" name="obs_ak" value="<?php echo htmlspecialchars($conf['obs_ak']); ?>" class="form-control"/>
                        </div>
                        <div class="form-group">
                            <label class="form-label">SecretAccessKey</label>
                            <input type="text" name="obs_sk" value="<?php echo htmlspecialchars($conf['obs_sk']); ?>" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-row two-col">
                        <div class="form-group">
                            <label class="form-label">OBS EndPoint</label>
                            <input type="text" name="obs_endpoint" value="<?php echo htmlspecialchars($conf['obs_endpoint']); ?>" class="form-control"/>
                        </div>
                        <div class="form-group">
                            <label class="form-label">OBS桶名称</label>
                            <input type="text" name="obs_bucket" value="<?php echo htmlspecialchars($conf['obs_bucket']); ?>" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary btn-sm">
                            <i class="fa fa-save"></i> 保存
                        </button>
                    </div>
                </form>
            </div>
        </div>

        <!-- 又拍云 -->
        <div class="provider-card" id="card_upyun">
            <div class="provider-header">
                <div class="provider-icon upyun">
                    <i class="fa fa-cloud"></i>
                </div>
                <div class="provider-info">
                    <h4>又拍云</h4>
                    <p>又拍云存储服务</p>
                </div>
                <a href="https://console.upyun.com/register/?invite=jUSQy3jyE" target="_blank" rel="noreferrer" class="provider-link">
                    <i class="fa fa-external-link"></i> 开通地址
                </a>
            </div>
            <div class="provider-body">
                <form onsubmit="return saveSetting(this)" method="post" class="settings-form">
                    <div class="form-row two-col">
                        <div class="form-group">
                            <label class="form-label">服务名称</label>
                            <input type="text" name="upyun_name" value="<?php echo htmlspecialchars($conf['upyun_name']); ?>" class="form-control"/>
                        </div>
                        <div class="form-group">
                            <label class="form-label">操作员名称</label>
                            <input type="text" name="upyun_user" value="<?php echo htmlspecialchars($conf['upyun_user']); ?>" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-row">
                        <div class="form-group">
                            <label class="form-label">操作员密码</label>
                            <input type="text" name="upyun_pwd" value="<?php echo htmlspecialchars($conf['upyun_pwd']); ?>" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary btn-sm">
                            <i class="fa fa-save"></i> 保存
                        </button>
                    </div>
                </form>
            </div>
        </div>

        <!-- 七牛云 -->
        <div class="provider-card" id="card_qiniu">
            <div class="provider-header">
                <div class="provider-icon qiniu">
                    <i class="fa fa-cloud"></i>
                </div>
                <div class="provider-info">
                    <h4>七牛云</h4>
                    <p>七牛云对象存储服务</p>
                </div>
                <a href="https://s.qiniu.com/j6zy63" target="_blank" rel="noreferrer" class="provider-link">
                    <i class="fa fa-external-link"></i> 开通地址
                </a>
            </div>
            <div class="provider-body">
                <form onsubmit="return saveSetting(this)" method="post" class="settings-form">
                    <div class="form-row two-col">
                        <div class="form-group">
                            <label class="form-label">AccessKey</label>
                            <input type="text" name="qiniu_ak" value="<?php echo htmlspecialchars($conf['qiniu_ak']); ?>" class="form-control"/>
                        </div>
                        <div class="form-group">
                            <label class="form-label">SecretKey</label>
                            <input type="text" name="qiniu_sk" value="<?php echo htmlspecialchars($conf['qiniu_sk']); ?>" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-row two-col">
                        <div class="form-group">
                            <label class="form-label">存储空间名称</label>
                            <input type="text" name="qiniu_bucket" value="<?php echo htmlspecialchars($conf['qiniu_bucket']); ?>" class="form-control"/>
                        </div>
                        <div class="form-group">
                            <label class="form-label">空间绑定域名</label>
                            <input type="text" name="qiniu_domain" value="<?php echo htmlspecialchars($conf['qiniu_domain']); ?>" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary btn-sm">
                            <i class="fa fa-save"></i> 保存
                        </button>
                    </div>
                </form>
            </div>
        </div>

        <!-- 雨云存储 -->
        <div class="provider-card" id="card_rainyun">
            <div class="provider-header">
                <div class="provider-icon rainyun">
                    <i class="fa fa-cloud"></i>
                </div>
                <div class="provider-info">
                    <h4>雨云存储</h4>
                    <p>雨云对象存储服务</p>
                </div>
                <a href="https://www.rainyun.com" target="_blank" rel="noreferrer" class="provider-link">
                    <i class="fa fa-external-link"></i> 开通地址
                </a>
            </div>
            <div class="provider-body">
                <form onsubmit="return saveSetting(this)" method="post" class="settings-form">
                    <div class="form-row two-col">
                        <div class="form-group">
                            <label class="form-label">AccessKey</label>
                            <input type="text" name="rainyun_ak" value="<?php echo htmlspecialchars($conf['rainyun_ak']); ?>" class="form-control"/>
                        </div>
                        <div class="form-group">
                            <label class="form-label">SecretKey</label>
                            <input type="text" name="rainyun_sk" value="<?php echo htmlspecialchars($conf['rainyun_sk']); ?>" class="form-control"/>
                        </div>
                    </div>
                    <div class="form-row two-col">
                        <div class="form-group">
                            <label class="form-label">存储空间名称</label>
                            <input type="text" name="rainyun_bucket" value="<?php echo htmlspecialchars($conf['rainyun_bucket']); ?>" class="form-control" placeholder="Bucket名称"/>
                        </div>
                        <div class="form-group">
                            <label class="form-label">Endpoint</label>
                            <input type="text" name="rainyun_endpoint" value="<?php echo htmlspecialchars($conf['rainyun_endpoint']); ?>" class="form-control" placeholder="如：s3.rainyun.com"/>
                        </div>
                    </div>
                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary btn-sm">
                            <i class="fa fa-save"></i> 保存
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script src="https://s4.zstatic.net/ajax/libs/layer/2.3/layer.js"></script>
<script>
// 初始化下拉框默认值
var items = $("select[default]");
for (i = 0; i < items.length; i++) {
    $(items[i]).val($(items[i]).attr("default")||0);
}

// 存储类型切换
function updateStorageCards() {
    var storage = $("#storage_select").val();
    
    // 显示/隐藏云存储选项
    if(storage == 'local' || storage == 'sae'){
        $("#cloud_stor").hide();
    } else {
        $("#cloud_stor").show();
    }
    
    // 高亮当前选中的存储提供商卡片
    $(".provider-card").removeClass("active");
    $("#card_" + storage).addClass("active");
}

$("#storage_select").change(updateStorageCards);

// 下载方式切换
$("select[name='downfile_type']").change(function(){
    if($(this).val() == '1'){
        $("#downfile_type_form").show();
    }else{
        $("#downfile_type_form").hide();
    }
});

// 初始化
updateStorageCards();

// 保存设置
function saveSetting(obj){
    var ii = layer.load(2, {shade:[0.1,'#fff']});
    $.ajax({
        type : 'POST',
        url : 'ajax.php?act=set',
        data : $(obj).serialize(),
        dataType : 'json',
        success : function(data) {
            layer.close(ii);
            if(data.code == 0){
                layer.alert('设置保存成功！', {
                    icon: 1,
                    closeBtn: false
                }, function(){
                  window.location.reload()
                });
            }else{
                layer.alert(data.msg, {icon: 2})
            }
        },
        error:function(data){
            layer.msg('服务器错误');
            return false;
        }
    });
    return false;
}

// 域名输入处理
function checkURL(obj) {
    var url = $(obj).val();
    if (url.indexOf(" ")>=0){
        url = url.replace(/ /g,"");
    }
    if (url.indexOf("，")>=0){
        url = url.replace(/，/g,",");
    }
    if (url.toLowerCase().indexOf("http://")==0){
        url = url.slice(7);
    }
    if (url.toLowerCase().indexOf("https://")==0){
        url = url.slice(8);
    }
    if (url.slice(url.length-1)=="/"){
        url = url.slice(0,url.length-1);
    }
    $(obj).val(url);
}

$("input[name='downfile_domain']").blur(function(){
    if($(this).val() != ''){
        checkURL(this);
    }
});
</script>

<style>
/* 设置页面专用样式 */
.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.tab-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    background: var(--gray-50);
    border: 1px solid transparent;
}

.tab-item:hover {
    background: var(--gray-100);
    color: var(--text-primary);
    text-decoration: none;
}

.tab-item.active {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.tab-item i {
    font-size: 14px;
}

/* 存储警告 */
.storage-warning {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.storage-warning i {
    color: #f59e0b;
    font-size: 16px;
}

.storage-warning span {
    color: #92400e;
}

/* 云存储选项 */
.cloud-storage-options {
    padding: 24px;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    margin-top: 16px;
}

/* 域名输入组 */
.domain-input-group {
    display: flex;
}

.protocol-select {
    width: 120px !important;
    border-radius: var(--border-radius) 0 0 var(--border-radius) !important;
    border-right: none !important;
}

.domain-input-group .form-control:not(.protocol-select) {
    border-radius: 0 var(--border-radius) var(--border-radius) 0 !important;
    flex: 1;
}

/* 存储提供商卡片 */
.storage-providers {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.provider-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all var(--transition);
}

.provider-card:hover {
    box-shadow: var(--shadow-md);
}

.provider-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1), var(--shadow-md);
}

.provider-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
}

.provider-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.provider-icon.local {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}

.provider-icon.oss {
    background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
    color: #ea580c;
}

.provider-icon.qcloud {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #2563eb;
}

.provider-icon.obs {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.provider-icon.upyun {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    color: #9333ea;
}

.provider-icon.qiniu {
    background: linear-gradient(135deg, #ccfbf1 0%, #99f6e4 100%);
    color: #0d9488;
}

.provider-icon.rainyun {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

.provider-icon.sae {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4f46e5;
}

.provider-info {
    flex: 1;
}

.provider-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.provider-info p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.provider-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.provider-badge.default {
    background: var(--primary-gradient);
    color: #fff;
}

.provider-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.provider-link:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    text-decoration: none;
}

.provider-body {
    padding: 24px;
}

/* 表单样式 */
.settings-form {
    max-width: 100%;
}

.form-row {
    margin-bottom: 20px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-row.two-col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.help-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.input-group {
    display: flex;
}

.input-group .form-control {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    flex: 1;
}

.input-addon {
    height: 42px;
    padding: 0 16px;
    background: var(--gray-100);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.form-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.form-actions .btn {
    min-width: 120px;
}

/* 响应式 */
@media (max-width: 767px) {
    .form-row.two-col {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .settings-tabs {
        padding: 12px;
        gap: 6px;
    }
    
    .tab-item {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .provider-header {
        flex-wrap: wrap;
        padding: 16px;
    }
    
    .provider-link {
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }
    
    .provider-body {
        padding: 16px;
    }
    
    .domain-input-group {
        flex-direction: column;
    }
    
    .protocol-select {
        width: 100% !important;
        border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
        border-right: 1px solid var(--border-color) !important;
        border-bottom: none !important;
    }
    
    .domain-input-group .form-control:not(.protocol-select) {
        border-radius: 0 0 var(--border-radius) var(--border-radius) !important;
    }
}
</style>

</body>
</html>
