@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-color: #2563EB;
    --primary-hover: #1D4ED8;
    --secondary-color: #3B82F6;
    --cta-color: #F97316;
    --cta-hover: #EA580C;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --info-color: #06B6D4;
    --background-color: #F8FAFC;
    --surface-color: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --sidebar-bg: #0F172A;
    --header-bg: rgba(255, 255, 255, 0.8);
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

button, .btn {
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast) !important;
}

.btn:active {
    transform: scale(0.98);
}

/* 顶部导航栏样式 - Glassmorphism */
.navbar {
    background-color: var(--header-bg) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1030;
    padding: 0.75rem 1.5rem;
    height: 70px;
    left: var(--sidebar-width);
    transition: all var(--transition-normal);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary) !important;
    display: flex;
    align-items: center;
    letter-spacing: -0.025em;
}

.navbar-brand i {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.sidebar-header {
    flex-shrink: 0;
}

/* 用户信息区域 */
#current-username {
    color: var(--text-primary) !important;
    font-weight: 700;
    font-size: 0.9rem;
}

#current-role {
    color: var(--text-secondary) !important;
    font-size: 0.75rem;
    font-weight: 500;
}

/* 侧边栏样式 - Modern Dark */
.sidebar {
    background-color: var(--sidebar-bg);
    color: white;
    height: 100vh;
    position: fixed;
    z-index: 1040;
    width: var(--sidebar-width);
    padding: 1.5rem 0;
    top: 0;
    left: 0;
    overflow-y: auto;
    transition: all var(--transition-normal);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}

.sidebar-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.sidebar-nav {
    flex: 1;
}

.sidebar .nav-link {
    color: #94A3B8;
    padding: 0.875rem 1.25rem;
    margin: 0.25rem 1rem;
    border-radius: 12px;
    transition: all var(--transition-fast);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar .nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar .nav-link.active {
    color: white;
    background-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.sidebar .nav-link i {
    font-size: 1.25rem;
    transition: transform var(--transition-fast);
}

.sidebar .nav-link:hover i {
    transform: translateX(2px);
}

.sidebar-footer {
    padding-top: 1rem;
    margin-top: auto;
}

.sidebar-user-trigger {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: white;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    transition: all var(--transition-fast);
    text-align: left;
}

.sidebar-user-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(96, 165, 250, 0.35);
}

.sidebar-user-trigger:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.sidebar-user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.16);
    color: #93C5FD;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.sidebar-user-text {
    flex: 1;
    min-width: 0;
}

.sidebar-user-text #current-username {
    color: #F8FAFC !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-text #current-role {
    color: #94A3B8 !important;
    display: block;
    margin-top: 0.15rem;
}

.sidebar-user-arrow {
    color: #94A3B8;
    flex-shrink: 0;
}

/* 主内容区 */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    background-color: var(--background-color);
    min-height: 100vh;
    transition: all var(--transition-normal);
}

.header {
    background-color: var(--surface-color);
    padding: 1.25rem 1.5rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header h1 {
    font-weight: 800;
    margin: 0;
    font-size: 1.75rem;
    letter-spacing: -0.04em;
    color: var(--text-primary);
}

/* 卡片样式 - Bento Style */
.card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-normal);
    overflow: hidden;
    height: 100%;
}

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

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 1.25rem;
}

.table-container {
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.table thead th {
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1.25rem;
}

.table tbody td {
    padding: 1rem 1.25rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9375rem;
}

.table tbody tr {
    transition: all var(--transition-fast);
}

.table-hover tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.02) !important;
}

.text-slate-800 {
    color: #1e293b !important;
}

.text-slate-600 {
    color: #475569 !important;
}

.text-slate-500 {
    color: #64748b !important;
}

/* 按钮样式优化 */
.btn {
    border-radius: 10px;
    padding: 0.625rem 1.25rem;
    font-weight: 700;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border: none;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3);
}

/* Badge Styles */
.badge {
    padding: 0.4em 0.8em;
    font-weight: 600;
    border-radius: 6px;
}

.badge-soft-primary {
    background-color: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.badge-soft-success {
    background-color: rgba(16, 185, 129, 0.12);
    color: #065f46;
}

.badge-soft-warning {
    background-color: rgba(245, 158, 11, 0.12);
    color: #92400e;
}

.badge-soft-danger {
    background-color: rgba(239, 68, 68, 0.12);
    color: #991b1b;
}

.badge-soft-info {
    background-color: rgba(6, 182, 212, 0.12);
    color: #155e75;
}

.badge-soft-secondary {
    background-color: rgba(100, 116, 139, 0.12);
    color: #334155;
}

/* Light Action Buttons */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: none;
}

.btn-light-primary {
    background-color: rgba(37, 99, 235, 0.08);
    color: #2563eb;
}

.btn-light-primary:hover {
    background-color: #2563eb;
    color: white;
}

.btn-light-info {
    background-color: rgba(6, 182, 212, 0.08);
    color: #0891b2;
}

.btn-light-info:hover {
    background-color: #0891b2;
    color: white;
}

.btn-light-danger {
    background-color: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}

.btn-light-danger:hover {
    background-color: #dc2626;
    color: white;
}

.btn-light-success {
    background-color: rgba(16, 185, 129, 0.08);
    color: #059669;
}

.btn-light-success:hover {
    background-color: #059669;
    color: white;
}

/* Pagination */
.pagination {
    margin-bottom: 0;
    gap: 0.25rem;
}

.page-link {
    border-radius: 8px !important;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    font-weight: 600;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.page-link:hover {
    background-color: #f1f5f9;
    color: var(--primary-color);
}

/* 响应式调整 */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.2);
    }
    .navbar {
        left: 0;
    }
    .main-content {
        margin-left: 0;
        padding: 90px 1rem 1.5rem 1rem;
    }
}

/* Form Elements */
.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-control, .form-select {
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    background-color: var(--surface-color);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
    background-color: white;
}

.form-check-input {
    border-radius: 4px;
    border: 1.5px solid var(--border-color);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.input-group {
    border-radius: 12px;
    transition: box-shadow var(--transition-fast);
}

.input-group:focus-within {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-group:focus-within .input-group-text,
.input-group:focus-within .form-control,
.input-group:focus-within .form-select {
    border-color: var(--primary-color);
}

.input-group .form-control:focus,
.input-group .form-select:focus {
    box-shadow: none;
}

.input-group-text {
    background-color: #f8fafc;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
}

.stats-detail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.25rem;
    flex-wrap: wrap;
}

.stats-detail-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex: 1 1 620px;
    flex-wrap: wrap;
}

.stats-detail-search {
    flex: 1 1 420px;
    min-width: 320px;
}

.stats-detail-search .form-control {
    min-width: 0;
}

.stats-detail-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.stats-detail-per-page {
    width: 120px !important;
}

.stats-detail-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.stats-detail-pagination {
    margin-left: auto;
}

/* Modal Styling */
.modal-content {
    border-radius: 24px;
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.25rem 2rem;
}

/* Soft Backgrounds & Icons */
.bg-soft-primary { background-color: rgba(37, 99, 235, 0.1) !important; }
.bg-soft-success { background-color: rgba(16, 185, 129, 0.1) !important; }
.bg-soft-warning { background-color: rgba(245, 158, 11, 0.1) !important; }
.bg-soft-danger { background-color: rgba(239, 68, 68, 0.1) !important; }

.stats-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.rounded-xl { border-radius: 16px; }
.rounded-2xl { border-radius: 20px; }

.z-1 { z-index: 1; }

.bg-primary-soft { background-color: rgba(37, 99, 235, 0.1); }
.bg-success-soft { background-color: rgba(16, 185, 129, 0.1); }
.bg-warning-soft { background-color: rgba(245, 158, 11, 0.1); }
.bg-info-soft { background-color: rgba(6, 182, 212, 0.1); }
.bg-danger-soft { background-color: rgba(239, 68, 68, 0.1); }

@media (max-width: 1400px) {
    .display-6 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .display-6 {
        font-size: 1.75rem;
    }

    .stats-detail-controls {
        width: 100%;
        justify-content: stretch;
    }

    .stats-detail-search {
        min-width: 0;
        flex-basis: 100%;
    }

    .stats-detail-actions {
        width: 100%;
        justify-content: space-between;
    }

    .stats-detail-per-page {
        flex: 1 1 140px;
        width: auto !important;
    }

    .stats-detail-pagination {
        margin-left: 0;
        width: 100%;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
