/* Global ambient styling */
body {
    background-color: #f6f7fb;
    color: #1f2937;
    font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
    line-height: 1.6;
}

h1, h2, h3, h4, h5 {
    color: #111827;
    font-weight: 600;
}

.card {
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 32px rgba(15, 23, 42, 0.09);
}

.filter-card .card-header {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-bottom: none;
    color: #fff;
    border-top-left-radius: 0.9rem;
    border-top-right-radius: 0.9rem;
}

.filter-card .card-body {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0))
        center/cover no-repeat;
}

.table thead th {
    background-color: #f8fafc;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.table tbody td {
    vertical-align: middle;
    font-size: 1rem;
}

.score-table col.col-index {
    width: 60px;
}

.score-table col.col-student {
    min-width: 200px;
}

.score-table col.col-exam {
    min-width: 160px;
}

.score-table col.col-score {
    width: 88px;
}

.score-table col.col-total {
    width: 110px;
}

.score-table col.col-rank {
    width: 96px;
}

.score-table col.col-actions {
    min-width: 220px;
}

.score-table thead th {
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    font-size: 1rem;
    padding-top: 0.75rem;
    padding-bottom: 0.6rem;
    text-align: center;
}

.score-table thead th a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    white-space: normal;
    text-align: center;
}

.score-table tbody td {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    text-align: center;
}

.score-table tbody td:nth-child(2),
.score-table tbody td:nth-child(3) {
    text-align: left;
}

.score-table tbody td .table-meta {
    margin-top: 0.3rem;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(248, 250, 252, 0.65);
}

.table-hover tbody tr:hover {
    background-color: rgba(191, 219, 254, 0.35);
}

.table-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.4rem;
}

.badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-grade {
    background-color: rgba(59, 130, 246, 0.18);
    color: #1d4ed8;
}

.badge-classroom {
    background-color: rgba(168, 85, 247, 0.15);
    color: #6d28d9;
}

.badge-subject {
    background-color: rgba(244, 114, 182, 0.18);
    color: #be185d;
}

.badge-count {
    background-color: rgba(16, 185, 129, 0.18);
    color: #047857;
}

.badge-note {
    background-color: rgba(248, 113, 113, 0.18);
    color: #b91c1c;
}

.badge-status-on {
    background-color: rgba(34, 197, 94, 0.2);
    color: #15803d;
}

.badge-status-off {
    background-color: rgba(148, 163, 184, 0.18);
    color: #475569;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-icon .fas,
.btn-icon .far,
.btn-icon .fal,
.btn-icon .fa,
.btn-icon .bi {
    font-size: 0.85rem;
}

.action-button-group,
.table .action-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}

.action-button-group .btn {
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
    border: 1px solid transparent;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.action-button-group .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

.btn-soft-primary {
    background-color: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.btn-soft-primary:hover {
    background-color: rgba(59, 130, 246, 0.22);
    color: #1e40af;
}

.btn-soft-success {
    background-color: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.btn-soft-success:hover {
    background-color: rgba(16, 185, 129, 0.22);
    color: #03543f;
}

.btn-soft-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.btn-soft-warning:hover {
    background-color: rgba(245, 158, 11, 0.25);
    color: #92400e;
}

.btn-soft-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

.btn-soft-danger:hover {
    background-color: rgba(239, 68, 68, 0.25);
    color: #991b1b;
}

.btn-soft-secondary {
    background-color: rgba(100, 116, 139, 0.16);
    color: #334155;
}

.btn-soft-secondary:hover {
    background-color: rgba(100, 116, 139, 0.25);
    color: #1e293b;
}

.prediction-panel {
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.02));
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.prediction-panel .prediction-rank {
    font-size: 2.6rem;
    line-height: 1.1;
}

.prediction-panel ul li {
    margin-bottom: 0.4rem;
}

.prediction-panel .prediction-features div {
    margin-bottom: 0.25rem;
}

.table-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-title .title-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.table-title .title-meta .badge-tag {
    font-size: 0.75rem;
}

.chip-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.main-toolbar {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(99, 102, 241, 0.14));
    border-radius: 0.9rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.main-toolbar h2 {
    margin-bottom: 0.25rem;
}

.main-toolbar p {
    margin-bottom: 0;
    color: #475569;
}

.table thead th a {
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
}

.table thead th a:hover {
    color: #1d4ed8;
    text-decoration: none;
}

@media (max-width: 991.98px) {
    .action-button-group {
        gap: 0.35rem;
    }

    .prediction-panel {
        padding: 1rem;
    }

    .action-button-group .btn {
        width: 100%;
        justify-content: center;
    }

    .table-meta {
        gap: 0.25rem;
    }
}

.nav-elevated {
    background: linear-gradient(135deg, #0d6efd 0%, #2563eb 55%, #1d4ed8 100%);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.2);
}

.navbar-logo {
    height: 36px;
    width: 36px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 4px;
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.18);
    object-fit: contain;
}

.navbar-brand-text {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.navbar-dark .navbar-nav .nav-link {
    position: relative;
    padding: 0.6rem 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.navbar-dark .navbar-nav .nav-link::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 8px;
    height: 3px;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.65);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus {
    color: #fdfdfd;
}

.navbar-dark .navbar-nav .nav-link:hover::after,
.navbar-dark .navbar-nav .nav-link:focus::after,
.navbar-dark .navbar-nav .nav-link.active::after {
    transform: scaleX(1);
}

.navbar-dark .navbar-nav .dropdown-menu {
    border-radius: 0.75rem;
    border: none;
    box-shadow: 0 18px 28px rgba(15, 23, 42, 0.18);
    padding: 0.6rem;
}

.navbar-dark .dropdown-item {
    border-radius: 0.6rem;
    padding: 0.45rem 0.75rem;
    font-weight: 500;
}

.navbar-dark .dropdown-item:hover,
.navbar-dark .dropdown-item:focus {
    background-color: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}
