/* ======================================
   百德进件登记系统 - 全局样式
   ====================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --success: #22c55e;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --border: #e2e8f0;
    --bg: #f8fafc;
    --text: #1e293b;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --white: #ffffff;
    --sidebar-width: 220px;
    --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }

/* ========== Layout ========== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f1a3a 0%, #162a5e 50%, #1e3a8a 100%);
    color: #fff;
    padding: 20px 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
}
.sidebar-brand h2 { font-size: 16px; font-weight: 700; }
.sidebar-nav { padding: 0 12px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.15); color: #fff; font-weight: 600; }
.nav-logout { margin-top: 24px; color: rgba(255,255,255,0.5); }

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 24px 28px;
    min-width: 0;
}

/* ========== Page Header ========== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 700; }

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}
.btn-outline { background: var(--white); border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-outline-blue { background: var(--primary-light); border: 1.5px solid #bfdbfe; color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }

/* ========== Forms ========== */
.form-control {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s;
    outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
textarea.form-control { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
select.form-control { cursor: pointer; }

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.required { color: var(--danger); margin-left: 2px; }

.form-card {
    background: var(--white);
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.form-section { padding: 24px; }
.form-section + .form-section { border-top: 1px solid var(--border); }
.form-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; color: var(--text); }
.form-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ========== Alerts ========== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
}
.alert-error { background: var(--danger-light); color: var(--danger); }
.alert-success { background: var(--success-light); color: #166534; }
.alert-warning { background: var(--warning-light); color: #92400e; }
.alert-info { background: var(--primary-light); color: var(--primary); }

/* ========== Data Table ========== */
.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.data-table th {
    background: #f1f5f9;
    padding: 12px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.data-table td {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}
.data-table .actions { display: flex; gap: 6px; white-space: nowrap; }
.data-table .empty-cell { text-align: center; color: var(--text-muted); padding: 40px; }
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
}

/* ========== Search ========== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-bar .form-control { width: 260px; }

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
}
.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--white);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    transition: all 0.15s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ========== Detail Card ========== */
.detail-card {
    background: var(--white);
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
}
.detail-section { padding: 24px; }
.detail-section + .detail-section { border-top: 1px solid var(--border); }
.detail-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.detail-item {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    align-items: flex-start;
}
.detail-item:last-child { border-bottom: none; }
.detail-item .label {
    width: 140px;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    padding-top: 1px;
}
.detail-item .value { flex: 1; font-size: 14px; min-width: 0; }
.detail-item.full-width { flex-direction: column; }
.detail-item.full-width .label { margin-bottom: 6px; }

/* ========== Upload Area ========== */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    position: relative;
    background: #fafbfc;
    transition: all 0.2s;
}
.upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.upload-area .upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-area .upload-text { font-size: 13px; color: var(--text-light); }
.upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-preview {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.upload-preview .preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.upload-preview .preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.upload-preview .preview-item .remove-btn {
    position: absolute;
    top: 4px; right: 4px;
    width: 22px; height: 22px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}
.upload-preview .preview-item .remove-btn:hover { background: var(--danger); }

.upload-progress {
    margin-top: 8px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}
.upload-progress .bar {
    height: 100%;
    width: 0;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s;
}

/* ========== Image Modal ========== */
.image-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.image-modal.show { display: flex; }
.image-modal img { max-width: 90%; max-height: 90%; border-radius: 8px; }
.image-modal .close-btn {
    position: absolute;
    top: 20px; right: 28px;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
}

/* ========== Modal Overlay ========== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 5000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--white);
    border-radius: 14px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-light);
    padding: 0 4px;
}
.modal-body { padding: 20px; }

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--primary); color: #fff; }

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        padding: 16px 0;
    }
    .sidebar-brand { padding: 0 8px 16px; text-align: center; }
    .sidebar-brand h2 { font-size: 14px; }
    .nav-item { justify-content: center; padding: 10px 8px; font-size: 18px; }
    .nav-item { font-size: 0; }
    .nav-item::before { font-size: 18px; content: attr(data-icon); }
    .main-content { margin-left: 60px; padding: 16px; }
    .detail-item { flex-direction: column; }
    .detail-item .label { width: auto; margin-bottom: 4px; }
    .search-bar .form-control { width: 100%; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 10px; }
}
