/* ========================================
   EnterpriseCMS - 表单模块样式 v2.0
   ======================================== */

/* ========================================
   富文本编辑器
   ======================================== */
.editor-wrapper {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.editor-toolbar {
    background: var(--gray-50);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.editor-toolbar button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--gray-600);
    transition: all 0.15s;
}

.editor-toolbar button:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.editor-toolbar .toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 6px;
}

.editor-toolbar label.upload-btn {
    height: 32px;
    padding: 0 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 500;
}

.editor-content {
    min-height: 350px;
    padding: 16px;
    background: #fff;
    overflow-y: auto;
}

.editor-content:focus {
    outline: none;
}

.editor-content p { margin-bottom: 12px; }
.editor-content h2 { font-size: 20px; color: var(--gray-800); margin: 20px 0 12px; font-weight: 600; }
.editor-content h3 { font-size: 16px; color: var(--gray-700); margin: 16px 0 10px; font-weight: 600; }
.editor-content img { max-width: 100%; height: auto; border-radius: var(--radius); margin: 12px 0; }
.editor-content a { color: var(--primary); text-decoration: underline; }
.editor-content blockquote { margin: 16px 0; padding: 12px 16px; background: var(--gray-50); border-left: 4px solid var(--primary); border-radius: 0 var(--radius) var(--radius) 0; }

/* ========================================
   图片上传
   ======================================== */
.upload-wrapper {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.upload-input-group {
    flex: 1;
    display: flex;
    gap: 10px;
}

.upload-url-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

.upload-url-input:focus {
    outline: none;
    border-color: var(--primary);
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.upload-btn:hover {
    background: var(--primary-dark);
}

.upload-file-input {
    display: none;
}

.upload-preview {
    width: 120px;
    height: 120px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--gray-50);
    transition: all 0.15s;
}

.upload-preview.has-image {
    border-style: solid;
    border-color: var(--primary);
}

.upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-preview .placeholder {
    text-align: center;
    color: var(--gray-400);
}

.upload-preview .placeholder .icon {
    font-size: 24px;
    margin-bottom: 4px;
}

/* 多图上传 */
.upload-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.upload-list-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.upload-list-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-list-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}

.upload-list-item:hover .remove-btn {
    opacity: 1;
}

/* ========================================
   颜色选择器
   ======================================== */
.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-picker .color-item {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
}

.color-picker .color-item:hover,
.color-picker .color-item.active {
    border-color: var(--gray-800);
    transform: scale(1.1);
}

/* ========================================
   日期时间选择器
   ======================================== */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: #fff;
}

input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus {
    outline: none;
    border-color: var(--primary);
}

/* ========================================
   数字输入框
   ======================================== */
input[type="number"] {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    width: 120px;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
}

/* ========================================
   范围滑块
   ======================================== */
input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

/* ========================================
   进度条
   ======================================== */
.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ========================================
   标签输入
   ======================================== */
.tag-input {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    min-height: 44px;
}

.tag-input .tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.tag-input .tag .tag-close {
    width: 14px;
    height: 14px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tag-input input {
    flex: 1;
    min-width: 100px;
    border: none;
    background: none;
    font-size: 14px;
    padding: 4px 0;
}

.tag-input input:focus {
    outline: none;
}

/* ========================================
   分割线
   ======================================== */
.form-divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

/* ========================================
   内联表单
   ======================================== */
.form-inline {
    display: flex;
    gap: 12px;
    align-items: center;
}

.form-inline .form-group {
    margin-bottom: 0;
}

/* ========================================
   表单底部操作栏
   ======================================== */
.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

/* ========================================
   错误状态
   ======================================== */
.has-error .form-control {
    border-color: var(--danger);
}

.has-error .error-message {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

/* ========================================
   成功状态
   ======================================== */
.has-success .form-control {
    border-color: var(--success);
}