/* ============================================================
   通用表单收集系统 - 自定义样式
   Bootstrap 5 mobile-first 增强
   ============================================================ */

/* --- 触屏友好 --- */
.btn, .form-control, .form-select {
    min-height: 44px;
}

/* 防止 iOS 缩放 */
@media (max-width: 767.98px) {
    input, textarea, select {
        font-size: 16px !important;
    }
}

/* --- 管理端布局 --- */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 220px;
    background: #1e293b;
    color: #cbd5e1;
    flex-shrink: 0;
}

.admin-sidebar .nav-link {
    color: #cbd5e1;
    padding: 10px 20px;
    border-radius: 0;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: #334155;
    color: #fff;
}

.admin-main {
    flex: 1;
    padding: 20px 24px;
    background: #f1f5f9;
    overflow-x: hidden;
}

.admin-topbar {
    background: #fff;
    padding: 10px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (max-width: 767.98px) {
    .admin-sidebar {
        position: fixed;
        left: -220px;
        top: 0;
        bottom: 0;
        z-index: 1050;
        transition: left 0.3s;
    }
    .admin-sidebar.show {
        left: 0;
    }
    .admin-main {
        padding: 12px;
    }
}

/* --- 文件上传区 --- */
.upload-zone {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8fafc;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.upload-zone .upload-icon {
    font-size: 2rem;
    color: #64748b;
}

.upload-zone .upload-hint {
    color: #94a3b8;
    font-size: 0.875rem;
    margin-top: 4px;
}

/* 透明覆盖层，原生点击=打开文件选择器（全平台兼容，无需 JS click） */
.upload-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    font-size: 0;
}

/* 隐藏移动端原生"选择文件"按钮 */
.upload-input::-webkit-file-upload-button {
    visibility: hidden;
    width: 0;
    height: 0;
}
.upload-input::file-selector-button {
    visibility: hidden;
    width: 0;
    height: 0;
}

.upload-placeholder {
    pointer-events: none;
    z-index: 0;
}

.upload-preview-list {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
    margin-top: 8px;
}

.file-preview {
    position: relative;
    display: inline-block;
    margin: 8px;
}

.file-preview img {
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.file-preview .remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    border: none;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
}

.file-preview-name {
    font-size: 0.75rem;
    color: #64748b;
    text-align: center;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-info-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.file-info {
    background: #f1f5f9;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 4px 0;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- 状态标签增强 --- */
.badge-pending { background: #f59e0b; }
.badge-approved { background: #22c55e; }
.badge-rejected { background: #ef4444; }
.badge-published { background: #3b82f6; }
.badge-draft { background: #94a3b8; }

/* --- 查询码展示 --- */
.query-code-display {
    font-family: 'Courier New', monospace;
    font-size: 1.75rem;
    letter-spacing: 4px;
    background: #f1f5f9;
    padding: 12px 20px;
    border-radius: 8px;
    text-align: center;
    border: 2px dashed #cbd5e1;
}

/* --- 表单字段 --- */
.form-label.required::after {
    content: ' *';
    color: #ef4444;
    font-weight: bold;
}

.field-hint {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 2px;
}

.field-error {
    font-size: 0.8rem;
    color: #ef4444;
    margin-top: 2px;
}

/* --- 历史时间线 --- */
.timeline-item {
    position: relative;
    padding-left: 24px;
    padding-bottom: 16px;
    border-left: 2px solid #e2e8f0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}

.timeline-item:last-child {
    border-left-color: transparent;
}

/* --- 密码解锁卡片 --- */
.unlock-card {
    max-width: 420px;
    margin: 80px auto;
}

/* --- 成功页 --- */
.success-icon {
    font-size: 4rem;
    color: #22c55e;
}

/* --- 手机全宽弹窗 --- */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.5rem;
    }
}

/* --- 确认对话框 --- */
.confirm-modal .modal-body {
    font-size: 1.05rem;
}
