/* ============================================
   1. CSS Reset
   ============================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================
   2. CSS Variables
   ============================================ */
:root {
    --primary-color: #0A2540;
    --secondary-color: #1E4B8A;
    --accent-color: #F2C94C;
    --base-bg: #bac8d6;
    --surface-bg: #FFFFFF;
    --text-color: #334155;
    --text-light: #64748B;
    --border-color: #e2e8f0;
    --tb-border-color: #1a1818;
    --shadow-sm: 0 4px 15px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(10, 37, 64, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    /* sleft.css 侧边栏菜单变量 */
    --menu-primary: #f0f7ff;
    --bg-l1: #ffffff;
    --bg-l2: #f8fafc;
    --bg-l3: #f1f5f9;
    --active-l1: #e3f2fd;
    --active-l2: #e8f4fd;
    --active-l3: #edf7ff;
}

/* ============================================
   3. HTML & Body 基础样式
   ============================================ */
html {
    min-height: 100%;
}

body {
    margin: 0;
    padding: 0;
    max-width: 100%;
    overflow-x: hidden;
    font-family: 'Inter', 'Montserrat', Arial, sans-serif;
    background-color: #F8FAFC;
    color: #334155;
    font-size: clamp(14px, 1vw, 18px);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   4. Typography
   ============================================ */
h1 { font-size: clamp(1.8rem, 2.5vw, 2.8rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 2vw, 2.2rem); font-weight: 700; }
h3 { font-size: clamp(1.25rem, 1.5vw, 1.65rem); font-weight: 600; }
h4 { font-size: clamp(1.1rem, 1.2vw, 1.4rem); font-weight: 600; }
h5, h6 { font-size: clamp(1rem, 1vw, 1.15rem); }

p { font-size: clamp(0.85rem, 1.1vw, 1.1rem); color: var(--text-light); }
a { font-size: clamp(1rem, 1vw, 1.1rem); }
span { font-size: clamp(1rem, 1vw, 1.1rem); }

/* ============================================
   5. Layout - Container
   ============================================ */
.container {
    width: 92%;
    max-width: 1600px;
    margin: 0 auto;
    padding-left: clamp(12px, 1.2vw, 24px);
    padding-right: clamp(12px, 1.2vw, 24px);
}

/* ============================================
   6. Media Elements
   ============================================ */
img, video, canvas, svg {
    max-width: 100%;
    height: auto;
}

table {
    max-width: 100%;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   7. Utility Classes
   ============================================ */
.product-detail-card, .article-card, .search-content-card, .form-card {
    padding: clamp(16px, 3vw, 40px) !important;
}

.sticky-top, .sticky-sidebar {
    top: clamp(76px, 9vh, 110px) !important;
}

/* ============================================
   8. Table Styles (#datatable)
   ============================================ */
#datatable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    font-family: system-ui, -apple-system, sans-serif;
    box-shadow: var(--shadow-sm);
}

#datatable thead th {
    background-color: #F8FAFC;
    color: #475569;
    font-weight: 600;
    padding: 12px 15px;
    border-bottom: 2px solid var(--tb-border-color);
    border-right: 1px solid var(--tb-border-color);
    font-size: 14px;
    text-align: center;
}

#datatable td {
    padding: 10px 15px;
    border-bottom: 1px solid var(--tb-border-color);
    border-right: 1px solid var(--tb-border-color);
    font-size: 14px;
    color: #64748B;
    text-align: center;
    line-height: 1.5;
}

#datatable td:first-child {
    text-align: left;
    color: #1E293B;
    font-weight: 500;
    background-color: #FFFFFF;
}

#datatable tbody tr:nth-child(even) td:first-child {
    color: #94A3B8;
    font-size: 13px;
}

#datatable tbody tr:nth-child(4n+1),
#datatable tbody tr:nth-child(4n+2) {
    background-color: #FFFFFF;
}

#datatable tbody tr:nth-child(4n+3),
#datatable tbody tr:nth-child(4n) {
    background-color: #FBFCFD;
}

#datatable tr:last-child td {
    border-bottom: none;
}

#datatable tbody tr:hover td {
    background-color: #F1F7FF !important;
    transition: background 0.2s;
}

/* ============================================
   9. Buttons
   ============================================ */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-accent {
    background: var(--accent-color);
    color: var(--primary-color);
    border: none;
    padding: 12px 28px;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-accent:hover {
    background: #F5D576;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   10. Animations
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* ============================================
   11. Misc
   ============================================ */
/* 彻底隐藏任何意外产生的空下拉菜单 */
.nav-dropdown:empty,
.sub-menu:empty {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ============================================
   11b. 系统缩放检测 (devicePixelRatio)
   根据 Windows 系统显示比例调整页面
   ============================================ */

/* 100% 缩放 (默认) */
html.scale-100 {
    /* 默认样式，无需调整 */
}

/* 125% 缩放 */
html.scale-125 {
    font-size: 95%;
}

/* 150% 缩放 */
html.scale-150 {
    font-size: 90%;
}

/* 175% 缩放 */
html.scale-175 {
    font-size: 85%;
}

/* 200% 缩放 */
html.scale-200 {
    font-size: 80%;
}

/* 200% 以上缩放 */
html.scale-high {
    font-size: 75%;
}

/* 高 DPI 屏幕通用调整 (Retina, 4K 等) */
@media (min-resolution: 1.5dppx) {
    .container {
        max-width: 1400px;
    }
}

@media (min-resolution: 2dppx) {
    .container {
        max-width: 1200px;
    }
}

/* ============================================
   12. Responsive - Large Screens
   ============================================ */
@media (min-width: 1200px) {
    .container {
        width: 100%;
    }
}

@media (min-width: 1921px) {
    body {
        font-size: clamp(16px, 0.9vw, 20px);
        line-height: 1.7;
    }

    h1 { font-size: clamp(1.8rem, 2.5vw, 2.5rem); }
    h2 { font-size: clamp(1.5rem, 2vw, 2rem); }
    h3 { font-size: clamp(1.25rem, 1.5vw, 1.6rem); }
    h4 { font-size: clamp(1.1rem, 1.2vw, 1.4rem); }
}

@media (min-width: 2000px) {
    .container {
        max-width: 1600px;
    }
}

@media (min-width: 2561px) {
    body {
        font-size: clamp(16px, 0.9vw, 20px);
        line-height: 1.7;
    }

    h1 { font-size: clamp(2rem, 2.8vw, 3rem); }
    h2 { font-size: clamp(1.6rem, 2.2vw, 2.4rem); }
    h3 { font-size: clamp(1.35rem, 1.6vw, 1.8rem); }
    h4 { font-size: clamp(1.15rem, 1.3vw, 1.5rem); }

    p { font-size: clamp(1rem, 1.1vw, 1.5rem) !important; }
    a { font-size: clamp(1rem, 1vw, 1.5rem) !important; }
    span { font-size: clamp(1rem, 1vw, 1.5rem) !important; }
}

@media (min-width: 2700px) {
    .container {
        max-width: 2400px;
    }
}

/* ============================================
   13. Responsive - Small Screens
   ============================================ */
@media (max-width: 991.98px) {
    h1 { font-size: clamp(1.5rem, 6vw, 2rem) !important; }
    h2 { font-size: clamp(1.25rem, 5vw, 1.7rem) !important; }
    h3 { font-size: clamp(1.1rem, 4.5vw, 1.35rem) !important; }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination a, .pagination span {
        padding: 8px 12px !important;
    }
}
