/* ============================================================
   全局字体变量 — 改一处即全局生效
   ============================================================ */
:root {
    /* 字体大小基准 */
    --fs-xs:      0.75rem;   /* 12px */
    --fs-sm:      0.875rem;  /* 14px */
    --fs-base:    1rem;      /* 16px */
    --fs-lg:      1.125rem;  /* 18px */
    --fs-xl:      1.25rem;   /* 20px */
    --fs-2xl:     1.5rem;    /* 24px */
    --fs-3xl:     1.875rem;  /* 30px */

    --content-max-width: 960px;

    --clr-primary:       #2563eb;
    --clr-primary-light: #4a5568;
    --clr-primary-dark:  #1d4ed8;

    /* 辅助色 */
    --clr-secondary:    #ed8936;
    --clr-success:      #48bb78;
    --clr-warning:      #ecc94b;
    --clr-danger:       #f56565;
    --clr-info:         #4299e1;

    /* 基础颜色 - 白色主题 */
    --clr-bg:            #ffffff;
    --clr-surface:       #ffffff;
    --clr-surface-light: #edf2f7;
    --clr-border:        #e2e8f0;
    --clr-border-focus:  #cbd5e1;

    /* 文字颜色 */
    --clr-text:         #2d3748;
    --clr-text-muted:   #718096;
    --clr-text-light:   #a0aec0;
    --clr-text-white:   #ffffff;

    /* 阴影和透明度 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03), 0 1px 1px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);

    --card-shadow: 0 8px 20px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);

    --clr-shadow: rgba(0, 0, 0, 0.06);
    --clr-overlay: rgba(0, 0, 0, 0.4);
    --clr-danger-dark:  #c53030;
    --clr-success-dark: #2f855a;

    /* 圆角和间距 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --gap-xs: 0.5rem;
    --gap-sm: 1rem;
    --gap-md: 1.5rem;
    --gap-lg: 2rem;

    /* 输入高度 */
    --input-h: 2.75rem;
}

/* ============================================================
   基础重置
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--clr-bg);
    color: var(--clr-text);
    font-size: var(--fs-base);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ============================================================
   通用容器
   ============================================================ */
.container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--gap-md) var(--gap-sm);
}
.req-container,
.req-list-container,
.home-main {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--gap-md) var(--gap-sm);
    box-sizing: border-box;
}

/* ============================================================
   页面标题
   ============================================================ */
.page-title {
    font-size: var(--fs-2xl);
    font-weight: 700;
    color: var(--clr-text);
    text-align: center;
    margin-bottom: var(--gap-md);
    letter-spacing: -0.02em;
}

/* ============================================================
   卡片
   ============================================================ */
.card {
    background: var(--clr-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: var(--gap-md);
    margin-bottom: var(--gap-sm);
    transition: box-shadow 0.2s ease;
    border: 1px solid var(--clr-border);
}
.card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
}
.card-title {
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--clr-text);
    padding-bottom: var(--gap-xs);
    border-bottom: 1px solid var(--clr-border);
    margin-bottom: var(--gap-sm);
}

/* ============================================================
   表单
   ============================================================ */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-sm);
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: var(--gap-sm);
}

.form-group label {
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--clr-text-muted);
    margin-bottom: 6px;
}

.form-group label .required {
    color: var(--clr-danger);
    margin-left: 2px;
}
.required {
    color: var(--clr-danger);
}
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="date"],
input[type="tel"],
input[type="search"],
textarea,
select {
    width: 100%;
    height: var(--input-h);
    padding: 0 12px;
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-md);
    font-size: var(--fs-base);
    font-family: inherit;
    color: var(--clr-text);
    background: var(--clr-surface);
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

textarea {
    height: auto;
    padding: 10px 12px;
    resize: vertical;
    line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input:disabled,
textarea:disabled,
select:disabled {
    background: var(--clr-bg);
    color: var(--clr-text-muted);
    cursor: not-allowed;
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: var(--input-h);
    padding: 0 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--fs-base);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
}

.btn:active { transform: translateY(1px); }
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--clr-primary-dark);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--clr-primary-dark);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-danger {
    background: var(--clr-danger);
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    background: var(--clr-danger-dark);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-success {
    background: var(--clr-success);
    color: #fff;
}
.btn-success:hover:not(:disabled) {
    background: var(--clr-success-dark);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--clr-primary-dark);
    border: 1.5px solid var(--clr-primary-dark);
}
.btn-outline:hover:not(:disabled) {
    background: rgba(26, 32, 44, 0.06);
}

.btn-secondary {
    background: var(--clr-bg);
    color: var(--clr-text);
    border: 1.5px solid var(--clr-border);
}
.btn-secondary:hover:not(:disabled) {
    background: #e9edf3;
}

.btn-sm {

    padding: 0 12px;
    font-size: var(--fs-sm);
}

.btn-block { width: 100%; }

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-xs);
}

/* ============================================================
   右键菜单
   ============================================================ */
.context-menu {
    position: fixed;
    z-index: 10000;
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    padding: 4px 0;
    display: none;
}

.context-menu.show { display: block; }

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: var(--fs-sm);
    cursor: pointer;
    color: var(--clr-text);
    transition: background 0.1s;
}
.context-menu-item:hover { background: var(--clr-bg); }
.context-menu-item.danger { color: var(--clr-danger); }
.context-menu-divider {
    height: 1px;
    background: var(--clr-border);
    margin: 4px 0;
}

/* ============================================================
   模态框
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--clr-overlay);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: var(--gap-sm);
}
.modal-overlay.show { display: flex; }

.modal {
    background: var(--clr-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--gap-sm) var(--gap-md);
    border-bottom: 1px solid var(--clr-border);
    background: var(--clr-primary);
    color: #fff;
}

.modal-header h3 {
    font-size: var(--fs-lg);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: var(--fs-2xl);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

.modal-body {
    padding: var(--gap-md);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    gap: var(--gap-xs);
    justify-content: flex-end;
    padding: var(--gap-sm) var(--gap-md);
    border-top: 1px solid var(--clr-border);
}

/* ============================================================
   三级联动
   ============================================================ */
.linkage-box {
    display: flex;
    gap: var(--gap-xs);
    align-items: flex-start;
}

.linkage-box select {
    flex: 1;
    cursor: pointer;
}

/* ============================================================
   表格
   ============================================================ */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--clr-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
    background: var(--clr-surface);
}

thead { background: var(--clr-bg); }

th, td {
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
}

th {
    font-weight: 600;
    color: var(--clr-text);
    border-bottom: 2px solid var(--clr-border);
}

tbody tr {
    border-bottom: 1px solid var(--clr-border);
    transition: background 0.1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ============================================================
   图片预览
   ============================================================ */
.photo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-xs);
}

.photo-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--clr-border);
    overflow: hidden;
    cursor: pointer;
}
.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-thumb .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.85);
    color: #fff;
    border: none;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   图片轮播
   ============================================================ */
.carousel {
    position: relative;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    user-select: none;
}

.carousel-img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: contain;
    display: block;
    max-height: 60vh;
    margin: 0 auto;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    font-size: var(--fs-xl);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
}
.carousel-btn:hover { background: rgba(0, 0, 0, 0.75); }
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }
.carousel-btn:disabled { opacity: 0.3; cursor: default; }

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px;
}
.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
.carousel-dot.active { background: #fff; }

/* ============================================================
   全屏查看器
   ============================================================ */
.fullscreen-viewer {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 20000;
    align-items: center;
    justify-content: center;
}
.fullscreen-viewer.show { display: flex; }

.fullscreen-viewer img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
}

.fs-close {
    position: fixed;
    top: 12px;
    right: 16px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    font-size: var(--fs-xl);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20001;
}
.fs-close:hover { background: rgba(255,255,255,0.25); }

/* ============================================================
   Toast / 提示
   ============================================================ */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--clr-text);
    color: #fff;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-size: var(--fs-sm);
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    white-space: nowrap;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast.error { background: var(--clr-danger); }
.toast.success { background: var(--clr-success); }

#catTextArea {
    font-size: var(--fs-sm);
    line-height: 1.5;
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-family: monospace;
}

/* ============================================================
   标签徽章
   ============================================================ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: var(--fs-xs);
    font-weight: 600;
}
.badge-active    { background: #dcfce7; color: #15803d; }
.badge-disabled  { background: #fee2e2; color: #b91c1c; }
.badge-locked     { background: #fef9c3; color: #a16207; }

/* ============================================================
   状态栏 / 导航栏
   ============================================================ */
.nav-bar {
    background: var(--clr-bg);
    box-shadow: var(--card-shadow);

    border-bottom: 1px solid var(--clr-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    max-width: calc(var(--content-max-width) - 2 * var(--gap-sm));
    margin: 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 var(--gap-sm);
}

.nav-left {
    flex-shrink: 0;
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--clr-text-white);
    padding: 0 12px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
.nav-left a {
    text-decoration: none;
    color: var(--clr-text);
    font-weight: 600;
    font-size: var(--fs-lg);
}
.nav-left a:hover {
    color: var(--clr-info);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.nav-user {
    flex-shrink: 0;
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--clr-text);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.nav-user-arrow {
    font-size: 18px;
    transition: transform 0.2s;
    line-height: 1;
}
.nav-user:hover {
    color: var(--clr-info);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.user-dropdown {
    display: none;
    position: absolute;
    padding: 8px 0;
    top: 100%;
    right: 8px;
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 300px;
    z-index: 1001;
}
.user-dropdown.show {
    display: block;
}
.user-dropdown-item {
    padding: 10px 16px;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: background 0.15s;
}
.user-dropdown-item:hover {
    background: var(--clr-bg);
}
.user-info-panel {
    padding: 0 16px 8px 16px;
    margin-bottom: 4px;
    user-select: text;
    cursor: text;
}
.info-row {
    display: flex;
    font-size: var(--fs-sm);
    line-height: 1.6;
    margin: 6px 0;
    color: var(--clr-text);
}
.info-label {
    width: 86px;
    flex-shrink: 0;
    color: var(--clr-text-muted);
    font-weight: normal;
}
.info-value {
    flex: 1;
    color: var(--clr-text);
    word-break: break-word;
}
.dropdown-divider {
    height: 1px;
    background: var(--clr-border);
    margin: 6px 0;
}
.logout-item {
    color: var(--clr-danger);
    cursor: pointer;
}
.logout-item:hover {
    background: var(--clr-bg);
}



#navLinks {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0;
}

#navLinks li {
    margin: 0;
}

#navLinks a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--clr-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: background-color 0.2s;
}

#navLinks a:hover {
    background-color: var(--clr-surface-light);
}

#navLinks a.active {
    background-color: var(--clr-primary);
    color: #fff;
}

/* ============================================================
   分隔线
   ============================================================ */
.divider {
    height: 1px;
    background: var(--clr-border);
    margin: var(--gap-sm) 0;
}

/* ============================================================
   搜索提示列表（拼音搜索）
   ============================================================ */
.pinyin-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 2px);
    background: var(--clr-surface);
    border: 1.5px solid var(--clr-primary);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 500;
    max-height: 240px;
    overflow-y: auto;
    display: none;
}
.pinyin-dropdown.show { display: block; }

.pinyin-item {
    padding: 8px 12px;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--clr-border);
}
.pinyin-item:last-child { border-bottom: none; }
.pinyin-item:hover { background: #eff6ff; }
.pinyin-item.selected { background: var(--clr-primary); color: #fff; }
.pinyin-item.selected span { color: rgba(255,255,255,0.8) !important; }
.pinyin-highlight { color: #dc2626 !important; font-weight: 700; }
.pinyin-item.selected .pinyin-highlight { color: #dc2626 !important; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
    html { font-size: 15px; }

    .form-row {
        grid-template-columns: 1fr;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn {
        height: 2.75rem;
        font-size: var(--fs-base);
    }

    .carousel-img {
        max-height: 45vh;
    }

    .modal {
        max-height: 95vh;
    }

    table {
        font-size: var(--fs-xs);
    }
    th, td {
        padding: 8px 10px;
    }
}
@media (max-width: 640px) {
    .nav-bar {
        padding: 0 var(--gap-sm);
        min-height: 3rem;
    }

    .nav-left .home-link,
    .nav-center .home-link,
    .nav-user {
        padding: 0.4rem 0.8rem;
        font-size: var(--fs-sm);
    }

    .nav-center {
        display: none;
    }
}
@media (max-width: 480px) {
    html { font-size: 14px; }

    .container {
        padding: var(--gap-xs);
    }

    .card {
        padding: var(--gap-sm);
        border-radius: var(--radius-md);
    }
    .user-dropdown {
        min-width: 260px;
        right: 8px;
    }
    .info-label {
        width: 70px;
    }
}
