/* Main Stylesheet - Supplements Bootstrap 5 */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-color: #dee2e6;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* ============================================
   General Page Structure
   ============================================ */
html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #212529;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

footer {
    margin-top: auto;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: #212529;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

p.lead {
    font-size: 1.25rem;
    font-weight: 300;
    color: #495057;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

a:hover {
    color: #0b5ed7;
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   Navigation Components
   ============================================ */
.navbar {
    box-shadow: var(--shadow-sm);
}

.navbar-collapse {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.navbar-nav .nav-link {
    margin: 0 0.5rem;
    transition: color 0.15s ease-in-out;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

.navbar-nav .nav-link.active {
    color: var(--primary-color) !important;
    font-weight: 600;
}

/* Dropdown Menu Styling */
.dropdown-menu {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    border-radius: 0.375rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--light-color);
    color: var(--primary-color);
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--primary-color);
}

/* ============================================
   Breadcrumb Navigation
   ============================================ */
.breadcrumb {
    background-color: transparent;
    padding: 0.5rem 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #6c757d;
}

.breadcrumb-item.active {
    color: #6c757d;
    font-weight: 500;
}

.breadcrumb-item a {
    color: var(--primary-color);
}

.breadcrumb-item a:hover {
    color: #0b5ed7;
}

/* ============================================
   Hero Section
   ============================================ */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0b5ed7 100%) !important;
    color: white !important;
}

.bg-gradient-primary h1,
.bg-gradient-primary .display-4 {
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.bg-gradient-primary p,
.bg-gradient-primary .lead {
    /* color: rgba(255, 255, 255, 0.95) !important; */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.hero-section {
    padding: 3rem 0;
    text-align: center;
}

.hero-section h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero-section p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.25rem;
}

@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 0;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section p {
        font-size: 1rem;
    }
}

/* ============================================
   Card Component
   ============================================ */
.card {
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 0.375rem;
    /* height: 100%; */  /* 注释掉以解决侧边栏卡片被压住的问题 */
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg) !important;
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    border-radius: 0.375rem 0.375rem 0 0;
}

/* 只对没有Bootstrap背景色类的card-header应用默认背景 */
.card-header:not([class*="bg-"]) {
    background-color: var(--light-color);
}

.card-body {
    flex: 1;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #212529;
}

.card-text {
    color: #495057;
    font-size: 0.95rem;
    line-height: 1.5;
}

.card-footer {
    background-color: transparent;
    border-top: 1px solid var(--border-color);
    padding: 1rem;
}

/* Card Variants */
.card.card-featured {
    border: 2px solid var(--primary-color);
    position: relative;
}

.card.card-featured::before {
    content: '推荐';
    position: absolute;
    top: -12px;
    right: 20px;
    background-color: var(--danger-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.card.card-success {
    border-left: 4px solid var(--success-color);
}

.card.card-warning {
    border-left: 4px solid var(--warning-color);
}

.card.card-danger {
    border-left: 4px solid var(--danger-color);
}

/* ============================================
   Button Components
   ============================================ */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0b5ed7;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

.btn-primary:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-secondary, .btn-success, .btn-danger, .btn-warning, .btn-info {
    font-weight: 500;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

/* ============================================
   Form Components
   ============================================ */
.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-size: 1rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    outline: none;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #212529;
}

.form-text {
    font-size: 0.875rem;
    color: #6c757d;
}

.invalid-feedback {
    color: var(--danger-color);
    font-size: 0.875rem;
    display: block;
    margin-top: 0.25rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

/* ============================================
   Table Styling
   ============================================ */
table {
    font-size: 0.95rem;
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: var(--light-color);
    border-bottom: 2px solid var(--border-color);
}

th {
    font-weight: 600;
    color: #212529;
    padding: 1rem;
    text-align: left;
    vertical-align: bottom;
}

td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background-color: var(--light-color);
}

tbody tr:focus-within {
    background-color: rgba(13, 110, 253, 0.1);
}

/* Responsive Table */
@media (max-width: 768px) {
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 0.75rem;
    }
}

/* ============================================
   List Components
   ============================================ */
.list-unstyled {
    padding-left: 0;
    list-style: none;
}

.list-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
}

.list-item:hover {
    background-color: var(--light-color);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.list-item a {
    display: block;
    color: var(--primary-color);
}

.list-item a:hover {
    color: #0b5ed7;
    text-decoration: none;
}

/* ============================================
   Accordion
   ============================================ */
.accordion-button {
    padding: 1rem;
    font-weight: 500;
    color: #212529;
    background-color: white;
    border: 1px solid var(--border-color);
}

.accordion-button:not(.collapsed) {
    background-color: var(--light-color);
    color: var(--primary-color);
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.accordion-body {
    padding: 1rem;
    color: #495057;
    line-height: 1.6;
}

/* ============================================
   Alert Component
   ============================================ */
.alert {
    border-radius: 0.375rem;
    border: 1px solid;
    font-size: 0.95rem;
}

.alert-primary {
    background-color: #cfe2ff;
    border-color: #b6d4fe;
    color: #084298;
}

.alert-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0a3622;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffecb5;
    color: #664d03;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #842029;
}

.alert-info {
    background-color: #cff4fc;
    border-color: #b6effb;
    color: #055160;
}

/* ============================================
   Badge Component
   ============================================ */
.badge {
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 0.375rem;
    display: inline-block;
}

.badge-primary {
    background-color: var(--primary-color);
    color: white;
}

.badge-success {
    background-color: var(--success-color);
    color: white;
}

.badge-danger {
    background-color: var(--danger-color);
    color: white;
}

.badge-warning {
    background-color: var(--warning-color);
    color: #212529;
}

/* ============================================
   Accessibility
   ============================================ */
.skip-to-content {
    position: absolute;
    left: -9999px;
    z-index: 9999;
    background-color: var(--primary-color);
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    font-weight: 600;
}

.skip-to-content:focus {
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

/* Focus Visible for All Interactive Elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Keyboard Navigation Indicator */
body.keyboard-nav button:focus,
body.keyboard-nav a:focus,
body.keyboard-nav input:focus,
body.keyboard-nav textarea:focus,
body.keyboard-nav select:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
}

/* ============================================
   Utility Classes
   ============================================ */
.text-muted {
    color: #6c757d !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.text-danger {
    color: var(--danger-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.text-info {
    color: var(--info-color) !important;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.bg-light {
    background-color: var(--light-color) !important;
}

.bg-dark {
    background-color: var(--dark-color) !important;
}

.bg-gradient-light {
    background: linear-gradient(135deg, #f8f9fa 0%, white 100%);
}

.border {
    border: 1px solid var(--border-color);
}

.border-bottom {
    border-bottom: 1px solid var(--border-color) !important;
}

.border-top {
    border-top: 1px solid var(--border-color) !important;
}

.border-left {
    border-left: 1px solid var(--border-color);
}

.border-right {
    border-right: 1px solid var(--border-color);
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.shadow {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

/* Spacing Utilities */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 1rem; padding-right: 1rem; }
.px-4 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-5 { padding-left: 3rem; padding-right: 3rem; }

.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 1rem; padding-bottom: 1rem; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-5 { padding-top: 3rem; padding-bottom: 3rem; }

/* ============================================
   Performance Optimization
   ============================================ */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

img[data-src] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

picture {
    display: block;
}

/* ============================================
   Mobile First - Responsive Design
   ============================================ */
@media (max-width: 576px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }
    
    .col {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .breadcrumb {
        font-size: 0.875rem;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 0.75rem;
    }
}

@media (min-width: 992px) {
    .d-lg-none {
        display: none !important;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: black;
    }
    
    a {
        color: #0d6efd;
        text-decoration: underline;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
    
    .navbar, footer, .breadcrumb, .skip-to-content {
        display: none !important;
    }
    
    .page-break {
        page-break-after: always;
    }
    
    main {
        max-width: 100%;
    }
}

/* ============================================
   Force Override for Hero Section
   ============================================ */
h1.display-4 {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

p.lead {
    /* color: rgba(255, 255, 255, 0.95) !important; */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

section.bg-gradient-primary h1 {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

section.bg-gradient-primary p,
section.bg-gradient-primary .lead {
    /* color: rgba(255, 255, 255, 0.95) !important; */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}
