/* ==================== 通用按钮样式 ==================== */
.btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-family: 'PingFang SC', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 100%;
    border: none;
    outline: none;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-primary {
    background-color: #2966FF;
    color: #FFFFFF;
    border: none;
    border-radius: 4px;
    font-family: 'PingFang SC', sans-serif;
    font-size: 12px;
    font-weight: 500;
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background-color: #4A48C7;
}

.btn-secondary {
    background-color: transparent;
    color: #2966FF;
    border: 1px solid #2966FF;
}

.btn-secondary:hover {
    background-color: #F0F0FF;
}

.btn-danger {
    background-color: #FF4D4F;
    color: #FFFFFF;
}

.btn-danger:hover {
    background-color: #E63E0A;
}

.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 4px;
    font-family: 'PingFang SC', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-sm.btn-primary {
    background-color: #2966FF;
    color: #FFFFFF;
    border: none;
    border-radius: 4px;
    font-family: 'PingFang SC', sans-serif;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-sm.btn-primary:hover {
    background-color: #4A48C7;
}

.btn-sm.btn-danger {
    background-color: #FF4D4F;
    color: #FFFFFF;
}

.btn-sm.btn-danger:hover {
    background-color: #E63E0A;
}

.btn-sm.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== 通用表单样式 ==================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    font-family: 'PingFang SC', sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #262626;
    margin-bottom: 8px;
    display: block;
}

.form-group .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    cursor: pointer;
}

.form-group .checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

/* 椭圆形开关样式 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #E6E6E6;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #2966FF;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #E6E6E6;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'PingFang SC', sans-serif;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #2966FF;
}

.form-control::placeholder {
    color: #A6A6A6;
}

.form-hint {
    font-size: 12px;
    color: #A6A6A6;
    margin-top: 8px;
    font-family: 'PingFang SC', sans-serif;
}

.required {
    color: #ff4d4f;
}

.error-message {
    color: #ff4d4f;
    font-size: 12px;
    margin-top: 8px;
    text-align: center;
}

/* ==================== 通用抽屉样式 ==================== */
/* 抽屉蒙层 */
.drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    /* 蒙层不响应点击事件，不允许通过点击蒙层关闭抽屉 */
    pointer-events: none;
}

.drawer-overlay.show {
    display: block;
}

.drawer {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow-y: auto;
    /* 阻止事件冒泡到蒙层 */
    pointer-events: auto;
}

.drawer-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    /* 阻止事件冒泡，防止点击抽屉内容时关闭 */
    pointer-events: auto;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #E6E6E6;
}

.drawer-header h3 {
    margin: 0;
    font-family: 'PingFang SC', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #262626;
}

.drawer-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.drawer-body input[type="text"],
.drawer-body input[type="password"] {
    width: 100%;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #E6E6E6;
    border-radius: 4px;
    font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #262626;
    outline: none;
    font-variation-settings: 'wdth' 100;
    box-sizing: border-box;
}

.drawer-body input::placeholder {
    color: #A6A6A6;
    font-variation-settings: 'wdth' 100;
}

.drawer-body input[type="date"] {
    width: 100%;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #E6E6E6;
    border-radius: 4px;
    font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #262626;
    outline: none;
    font-variation-settings: 'wdth' 100;
    box-sizing: border-box;
}

.drawer-body select {
    width: 100%;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #E6E6E6;
    border-radius: 4px;
    font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #262626;
    background-color: #FFFFFF;
    cursor: pointer;
    outline: none;
    font-variation-settings: 'wdth' 100;
    box-sizing: border-box;
}

.drawer-body textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #E6E6E6;
    border-radius: 4px;
    font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #262626;
    outline: none;
    font-variation-settings: 'wdth' 100;
    box-sizing: border-box;
    resize: vertical;
    line-height: 1.5;
}

.drawer-body textarea::placeholder {
    color: #A6A6A6;
    font-variation-settings: 'wdth' 100;
}

.drawer-body textarea:focus {
    outline: none;
    border-color: #2966FF;
}

.drawer-body input:focus,
.drawer-body select:focus {
    outline: none;
    border-color: #2966FF;
}

.drawer-body select:disabled {
    background-color: #F5F5F5;
    color: #999999;
    cursor: not-allowed;
    opacity: 1; /* 保持不透明度为1，使用背景色和文字色来表示禁用状态 */
}

.drawer-footer {
    padding: 20px;
    border-top: 1px solid #E6E6E6;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

/* ==================== 通用模态框样式 ==================== */
/* 模态框遮罩层 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    /* 蒙层不响应点击事件，不允许通过点击蒙层关闭抽屉 */
    pointer-events: none;
}

.modal.show {
    display: flex; /* 使用flex确保居中弹窗正确显示 */
    opacity: 1;
    pointer-events: auto; /* 显示时允许点击 */
    align-items: center; /* 垂直居中 */
    justify-content: center; /* 水平居中 */
}

/* 右侧抽屉容器 */
.modal-content {
    position: fixed;
    right: -600px;
    top: 0;
    width: 600px;
    /* 阻止事件冒泡，防止点击抽屉内容时关闭 */
    pointer-events: auto;
    height: 100%;
    background-color: #FFFFFF;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    z-index: 2001;
    overflow: hidden;
}

.modal.show .modal-content {
    right: 0;
}

/* 居中弹窗样式（用于删除确认等对话框） */
.modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%);
    width: auto;
    max-width: 400px;
    height: auto;
    background-color: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 2001;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.modal.show .modal-dialog {
    opacity: 1;
    transform: translate(-50%, -50%);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .modal-content {
        width: 100%;
        right: -100%;
    }
    
    .modal-dialog {
        width: 90%;
        max-width: 90%;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #E6E6E6;
    flex-shrink: 0;
}

.modal-header h3 {
    font-family: 'PingFang SC', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #262626;
    margin: 0;
}

.close {
    font-size: 24px;
    font-weight: bold;
    color: #A6A6A6;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.close:hover {
    color: #262626;
}

.modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    /* 自定义滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: #E6E6E6 #FFFFFF;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #FFFFFF;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #E6E6E6;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #D0D0D0;
}

.modal-body input {
    width: 100%;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #E6E6E6;
    border-radius: 4px;
    font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #262626;
    outline: none;
    font-variation-settings: 'wdth' 100;
    box-sizing: border-box;
}

.modal-body input[type="text"],
.modal-body input[type="password"] {
    width: 100%;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #E6E6E6;
    border-radius: 4px;
    font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #262626;
    outline: none;
    font-variation-settings: 'wdth' 100;
    box-sizing: border-box;
}

.modal-body input::placeholder {
    color: #A6A6A6;
    font-variation-settings: 'wdth' 100;
}

.modal-body input[type="date"] {
    width: 100%;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #E6E6E6;
    border-radius: 4px;
    font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #262626;
    outline: none;
    font-variation-settings: 'wdth' 100;
    box-sizing: border-box;
}

.modal-body select {
    width: 100%;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #E6E6E6;
    border-radius: 4px;
    font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #262626;
    background-color: #FFFFFF;
    cursor: pointer;
    outline: none;
    font-variation-settings: 'wdth' 100;
    box-sizing: border-box;
}

.modal-body input:focus,
.modal-body select:focus {
    outline: none;
    border-color: #2966FF;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #E6E6E6;
}

/* Token失效提示对话框样式 */
#token-expired-modal {
    z-index: 99999 !important; /* 确保在所有元素之上 */
    display: none; /* 默认隐藏 */
    position: fixed !important; /* 确保使用固定定位 */
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important; /* 使用视口宽度 */
    height: 100vh !important; /* 使用视口高度 */
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: auto !important; /* 确保可以接收点击事件 */
}

#token-expired-modal.show {
    display: flex; /* 显示时使用flex布局 */
    opacity: 1;
}

#token-expired-modal .modal-dialog {
    width: 400px;
    max-width: 90%;
    background-color: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
    position: relative !important;
    z-index: 100000 !important; /* 确保对话框在遮罩层之上 */
    pointer-events: auto !important; /* 确保对话框可以接收点击事件 */
}

#token-expired-modal .modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E6E6E6;
}

#token-expired-modal .modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    margin: 0;
}

#token-expired-modal .modal-body {
    padding: 24px;
    text-align: center;
}

#token-expired-modal .modal-body p {
    font-size: 14px;
    color: #666666;
    line-height: 1.5;
    margin: 0;
}

#token-expired-modal .modal-footer {
    display: flex;
    justify-content: center;
    padding: 16px 24px;
    border-top: 1px solid #E6E6E6;
}

#token-expired-modal .modal-footer .btn {
    min-width: 80px;
    height: 36px;
    padding: 0 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    pointer-events: auto !important; /* 确保按钮可以点击 */
    position: relative !important;
    z-index: 100001 !important; /* 确保按钮在最上层 */
}

#token-expired-modal .modal-footer .btn-primary {
    background-color: #2966FF;
    color: #FFFFFF;
}

#token-expired-modal .modal-footer .btn-primary:hover {
    background-color: #4E4BCF;
}

/* 移动端适配 */
@media (max-width: 768px) {
    #token-expired-modal .modal-dialog {
        width: 90%;
        max-width: 90%;
    }
}

/* ==================== Toast 提示 ==================== */
.toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    pointer-events: none;
}

.toast {
    background-color: rgba(0, 0, 0, 0.75);
    color: #FFFFFF;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'PingFang SC', sans-serif;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.hide {
    opacity: 0;
    transform: translateY(-20px);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .toast-container {
        top: 60px;
        left: 20px;
        right: 20px;
        transform: none;
    }
    
    .toast {
        width: 100%;
        text-align: center;
    }
}

/* ==================== 通用标签和徽章 ==================== */
.admin-badge {
    background-color: #FFE3DC;
    color: #EC552B;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    font-family: 'PingFang SC', sans-serif;
}

.status-active {
    background-color: #F6FFED;
    color: #52C41A;
}

.status-inactive {
    background-color: #FFF2E8;
    color: #FF4D4F;
}

/* ==================== 空状态提示 ==================== */
.empty-message {
    text-align: center;
    padding: 40px;
    color: #A6A6A6;
    font-family: 'PingFang SC', sans-serif;
    font-size: 14px;
    font-weight: 400;
}
