/* =========================
   全局统一基础样式 (UI Base)
   说明：用于页面默认控件与组件的统一外观，减少新增元素时样式不一致问题
   ========================= */

/* ===== 主题变量 ===== */
:root {
    --ui-color-primary: #ff6600;
    --ui-color-secondary: #17a2b8;
    --ui-color-success: #28a745;
    --ui-color-danger: #dc3545;
    --ui-color-warning: #ffc107;
    --ui-color-warn: #ff6600;
    --ui-color-text: #333;
    --ui-color-muted: #666;
    --ui-color-muted-light: #999;
    --ui-color-border: #e0e0e0;
    --ui-color-surface: #fff;
    --ui-shadow-card: 0 10px 40px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* ===== 小字注释/提示（Hint） ===== */
.ui-hint {
    display: block;
    font-size: 10px;
    line-height: 1.2;
    color: var(--ui-color-muted);
}

.ui-hint-inline {
    display: inline-block;
    font-size: 10px;
    line-height: 1.2;
    color: var(--ui-color-muted);
    vertical-align: baseline;
}

.ui-hint--10 {
    font-size: 10px;
}

.ui-hint--11 {
    font-size: 11px;
}

.ui-hint--12 {
    font-size: 12px;
}

.ui-hint--muted {
    color: var(--ui-color-muted);
}

.ui-hint--light {
    color: var(--ui-color-muted-light);
}

.ui-hint--warn {
    color: var(--ui-color-warn);
}

.ui-hint--danger {
    color: var(--ui-color-danger);
}

.ui-hint--mt2 {
    margin-top: 2px;
}

.ui-hint--mt4 {
    margin-top: 4px;
}

.ui-hint--mt5 {
    margin-top: 5px;
}

.ui-hint--mb5 {
    margin-bottom: 5px;
}

.ui-hint--mb6 {
    margin-bottom: 6px;
}

.ui-hint--mb10 {
    margin-bottom: 10px;
}

.ui-hint--my8 {
    margin: 8px 0;
}

.ui-hint--my10-6 {
    margin: 10px 0 6px;
}

.ui-text-center {
    text-align: center;
}

.ui-ml-auto {
    margin-left: auto;
}

.ui-mr5 {
    margin-right: 5px;
}

.ui-font-bold {
    font-weight: bold;
}

.ui-font-normal {
    font-weight: normal;
}

/* ===== 弹窗按钮（Profile/Cloud 等） ===== */
.modern-btn,
.modal-footer-modern button {
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    margin: 0;
    width: auto;
}

.btn-cancel {
    background: #f0f2f5;
    color: #666;
}

.btn-cancel:hover {
    background: #e4e6eb;
    color: #333;
}

.btn-save {
    background: var(--ui-color-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.2);
}

.btn-save:hover {
    background: #e55a00;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 102, 0, 0.3);
}

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

.btn-admin {
    background: #6f42c1;
    color: white;
}

.btn-admin:hover {
    background: #5a32a3;
}

/* ===== 小型操作按钮（列表/批量应用） ===== */
.btn-sm-danger {
    background: var(--ui-color-danger);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 10px;
    cursor: pointer;
    width: auto;
    margin-top: 0;
}

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

.btn-batch-apply {
    background: transparent;
    border: 1px solid;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 8px;
    cursor: pointer;
    font-weight: normal;
    width: auto;
    margin-top: 0;
    line-height: 1.2;
    display: inline-block;
}

.btn-batch-primary {
    color: var(--ui-color-primary);
    border-color: var(--ui-color-primary);
}

.btn-batch-primary:hover {
    background: #fff0e6;
}

.btn-batch-info {
    color: var(--ui-color-secondary);
    border-color: var(--ui-color-secondary);
    font-size: 10px;
    padding: 0 4px;
}

.btn-batch-info:hover {
    background: #e0f7fa;
}

.card-header .btn-batch-apply {
    margin-left: auto;
    margin-right: 8px;
}

/* ===== 注释信息块（组合样式） ===== */
.ui-note-box {
    background: #f7f7f7;
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--ui-color-muted);
    line-height: 1.6;
}

.ui-preview-box {
    background: #eef;
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-bottom: 10px;
}

/* ===== 下拉菜单（select） ===== */
select {
    width: 100%;
    padding: 9px 32px 9px 12px;
    box-sizing: border-box;
    border: 1px solid var(--ui-color-border);
    border-radius: 6px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--ui-color-surface);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    font-size: 13px;
    color: var(--ui-color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.3;
}

select:hover {
    border-color: var(--ui-color-primary);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff6600' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-color: #fff9f5;
}

select:focus {
    border-color: var(--ui-color-primary);
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.15);
    outline: none;
    background-color: var(--ui-color-surface);
}

select:disabled {
    background-color: #f5f7fa;
    color: #aaa;
    cursor: not-allowed;
    border-color: #eee;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ccc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

select.input-invalid {
    border-color: var(--ui-color-danger) !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.15) !important;
}

/* ===== 输入框（input/textarea） ===== */
.modern-input,
input:not([type]),
input[type="text"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="email"],
input[type="url"],
input[type="tel"],
textarea {
    width: 100%;
    padding: 10px 12px;
    box-sizing: border-box;
    border: 1px solid var(--ui-color-border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    outline: none;
    background: #f9f9f9;
    color: var(--ui-color-text);
}

.modern-input:focus,
input:not([type]):focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
textarea:focus {
    border-color: var(--ui-color-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

.modern-input:disabled,
input:not([type]):disabled,
input[type="text"]:disabled,
input[type="number"]:disabled,
input[type="password"]:disabled,
input[type="search"]:disabled,
input[type="email"]:disabled,
input[type="url"]:disabled,
input[type="tel"]:disabled,
textarea:disabled {
    background: #f0f0f0;
    color: #888;
    cursor: not-allowed;
}

/* ===== 按钮（button）与颜色类 ===== */
button {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    color: white;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--ui-color-primary);
}

.btn-primary:hover {
    background: #e55a00;
}

.btn-secondary {
    background: var(--ui-color-secondary);
}

.btn-secondary:hover {
    background: #117a8b;
}

.btn-success {
    background: var(--ui-color-success);
}

.btn-success:hover {
    background: #1e7e34;
}

.btn-danger {
    background: var(--ui-color-danger);
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: var(--ui-color-warning);
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-disabled-look {
    opacity: 0.65;
    cursor: not-allowed;
    background-color: #e9ecef !important;
    border-color: #dee2e6 !important;
    color: #6c757d !important;
    box-shadow: none !important;
}

.btn-mini {
    width: 30px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-size: 16px;
}

.btn-active {
    box-shadow: inset 0 0 0 3px #ffffff, 0 0 0 5px #333;
    transform: scale(0.98);
    font-weight: 900;
}

.btn-primary.btn-active {
    background: #d14900;
}

.btn-inline {
    width: auto;
    margin-top: 0;
}

/* ===== 复选框（checkbox）统一外观 ===== */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border: 1px solid #cfcfcf;
    border-radius: 3px;
    background: #fff;
    display: inline-block;
    vertical-align: middle;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
}

input[type="checkbox"]:hover {
    border-color: var(--ui-color-primary);
}

input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.15);
}

input[type="checkbox"]:checked {
    border-color: var(--ui-color-primary);
    background-color: #fff;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff6600' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='20 6 9 17 4 12'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
}

input[type="checkbox"]:disabled {
    cursor: not-allowed;
    background: #f0f0f0;
    border-color: #e0e0e0;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1);
}

/* ===== 开关（switch） ===== */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    vertical-align: middle;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--ui-color-primary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--ui-color-primary);
}

input:checked + .slider:before {
    transform: translateX(16px);
}

/* ===== 分段切换（div/div） ===== */
.tabs,
.ui-segment {
    display: flex;
    margin-bottom: 20px;
    background: #f0f2f5;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.tab,
.ui-segment-item {
    flex: 1;
    padding: 9px 6px;
    text-align: center;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    border-radius: 6px;
    transition: all 0.3s ease;
    user-select: none;
    white-space: nowrap;
    min-width: 3.2em;
}

.tab:hover,
.ui-segment-item:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.tab.active,
.ui-segment-item.active {
    background: #fff;
    color: var(--ui-color-primary);
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* ===== 按键切换开关（button/button） ===== */
.radio-group {
    display: flex;
    background: #f0f0f0;
    padding: 4px;
    border-radius: 8px;
    width: 100%;
}

.btn-gen-mode {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    background-color: transparent;
    color: #666;
    border: none;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    margin: 0;
    font-weight: 500;
    margin-top: 0 !important;
}

.btn-gen-mode:hover:not(.active) {
    background-color: rgba(0, 0, 0, 0.05);
    color: #333;
}

.btn-gen-mode.active {
    background-color: #fff;
    color: var(--ui-color-primary) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: bold;
    border: none;
}

/* ===== 下滑拖动条（range） ===== */
.styled-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
    opacity: 0.9;
    padding: 0 !important;
    border: none !important;
    margin: 0;
    cursor: pointer;
    transition: opacity 0.2s;
}

.styled-slider:hover {
    opacity: 1;
}

.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--ui-color-primary);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
    margin-top: -6px;
}

.styled-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #e0e0e0;
    border-radius: 2px;
}

.styled-slider:active::-webkit-slider-thumb {
    transform: scale(1.2);
    background: #e55a00;
}

.styled-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: var(--ui-color-primary);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ===== 模态框（Modal） ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 11000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active,
.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--ui-color-surface);
    width: 400px;
    max-height: 85vh;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--ui-shadow-card);
    animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card {
    background: var(--ui-color-surface);
    width: 380px;
    max-width: 90%;
    border-radius: 12px;
    box-shadow: var(--ui-shadow-card);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.modal-content .modal-header {
    margin: -20px -20px 20px -20px;
    border-radius: 12px 12px 0 0;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-body .control-group {
    margin-bottom: 16px;
}

.modal-body h3 {
    font-size: 14px;
    margin: 20px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.modal-btn-group {
    display: flex;
    gap: 5px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: #999;
    width: 32px;
    height: 32px;
    line-height: 32px;
    padding: 0;
    margin: 0;
    text-align: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    color: #333;
    background: #f5f5f5;
}

/* ===== 模态框进度条（Progress in Modal） ===== */
.ui-progress {
    padding: 10px 0;
}

.ui-progress-label {
    margin-bottom: 6px;
    font-size: 14px;
    color: #333;
}

.ui-progress-value {
    margin-top: 6px;
    font-size: 12px;
    color: var(--ui-color-muted);
}

.ui-progress-text {
    font-size: 14px;
    color: #333;
}

.ui-progress-track {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.ui-progress-bar {
    width: 0%;
    height: 100%;
    background: var(--ui-color-primary);
    transition: width 0.2s;
}

#progressModal .ui-progress-track {
    height: 10px;
    border-radius: 5px;
    background: #eee;
}

#progressModal .ui-progress-bar {
    background: var(--ui-color-success);
}

/* ===== 调试模式样式 (Debug Mode) ===== */
/* 默认隐藏调试内容 */
.debug-only {
    display: none !important;
}

/* 当 body 包含 debug-mode 类时显示 */
body.debug-mode .debug-only {
    display: block !important;
}

body.debug-mode .ui-hint-inline.debug-only {
    display: inline-block !important;
}
