/* Tests list + package detail — clean medical catalog UI */

.page-tests,
.page-test-detail {
    --tp-primary: #3b82f6;
    --tp-primary-soft: #eff6ff;
    --tp-teal: #0f766e;
    --tp-heading: #1e293b;
    --tp-muted: #64748b;
    --tp-border: #e5e7eb;
    --tp-card-bg: #ffffff;
    --tp-surface-muted: #f8fafc;
    --tp-page-bg: #f8fafc;
}

[data-theme='dark'] .page-tests,
[data-theme='dark'] .page-test-detail {
    --tp-primary: #60a5fa;
    --tp-primary-soft: rgba(59, 130, 246, 0.18);
    --tp-teal: #5eead4;
    --tp-heading: #f1f5f9;
    --tp-muted: #94a3b8;
    --tp-border: rgba(148, 163, 184, 0.28);
    --tp-card-bg: #111a2e;
    --tp-surface-muted: #0f1729;
    --tp-page-bg: #0b1220;
}

@keyframes testsFadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes testsSlideIn {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes testsCardShine {
    0% {
        background-position: -120% 0;
    }
    100% {
        background-position: 220% 0;
    }
}

/* ========== Tests list ========== */
.page-tests .page-header--tests-hero {
    padding: 2rem 0 1.75rem;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, var(--tp-surface-muted) 0%, var(--tp-card-bg) 55%, rgba(15, 118, 110, 0.06) 100%);
    border-bottom: 1px solid var(--tp-border);
    position: relative;
    overflow: hidden;
}

.page-tests .page-header--tests-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--tp-teal), var(--tp-primary));
}

.page-tests .page-header__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: var(--tp-teal);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}

.page-tests .page-header--tests-hero h1 {
    color: var(--tp-heading);
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    margin-bottom: 0.5rem;
}

.page-tests .page-header--tests-hero p {
    color: var(--tp-muted);
    max-width: 36rem;
    margin-bottom: 1rem;
    line-height: 1.55;
}

.page-tests .page-header__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-tests .page-header--tests {
    padding: 1.5rem 0 1.1rem;
    margin-bottom: 1rem;
    background: var(--tp-card-bg);
    border-bottom: 1px solid var(--tp-border);
}

.page-tests .page-header--tests h1 {
    color: var(--tp-heading);
}

.page-tests .tests-page-content {
    padding-top: 1.5rem;
    padding-bottom: 2.5rem;
}

.page-tests .search-box .form-input {
    border-radius: 10px;
    border: 1px solid var(--tp-border);
    padding-left: 2.75rem;
    background: var(--tp-card-bg);
    color: var(--tp-heading);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.page-tests .search-box .form-input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.page-tests .category-scroll {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.5rem;
    padding-bottom: 0.35rem;
    margin-bottom: 1.25rem !important;
    scrollbar-width: thin;
}

.page-tests .category-scroll .category-card {
    flex: 0 0 auto;
    min-width: auto;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-align: left;
    white-space: nowrap;
}

.page-tests .category-scroll .category-icon {
    font-size: 0.85rem;
    margin: 0;
    color: #64748b;
}

.page-tests .category-scroll .category-name {
    font-size: 0.8rem;
    font-weight: 600;
}

.page-tests .category-scroll .category-card {
    background: var(--tp-card-bg);
    color: var(--tp-heading);
    border: 1px solid var(--tp-border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.page-tests .category-scroll .category-card.active {
    background: #1e293b;
    border-color: #1e293b;
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}

.page-tests .category-scroll .category-card.active .category-icon,
.page-tests .category-scroll .category-card.active .category-name {
    color: #fff;
}

.page-tests .tests-toolbar {
    background: var(--tp-surface-muted);
    border: 1px solid var(--tp-border);
    border-radius: 12px;
    padding: 0.65rem 1rem;
    margin-bottom: 1rem;
}

.page-tests .tests-toolbar strong {
    color: var(--tp-heading);
    font-size: 1.05rem;
}

.page-tests #bookSelectedBtn {
    background: #1e293b !important;
    border: none !important;
    box-shadow: none !important;
}

.page-tests .page-header--tests h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.page-tests .page-header--tests p {
    font-size: 0.8125rem;
    margin: 0;
    line-height: 1.45;
}

.page-tests .tests-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.page-tests .category-grid {
    gap: 0.65rem;
}

.page-tests .category-card {
    padding: 0.65rem 0.85rem;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.page-tests .category-card:hover {
    transform: translateY(-2px);
}

.page-tests .category-name {
    font-size: 0.75rem;
}

.page-tests .test-grid {
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    align-items: stretch;
}

.page-tests .test-card {
    animation: testsFadeUp 0.45s ease both;
    transition:
        transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.28s ease,
        border-color 0.28s ease;
    will-change: transform;
}

.page-tests .test-card:nth-child(1) { animation-delay: 0.02s; }
.page-tests .test-card:nth-child(2) { animation-delay: 0.06s; }
.page-tests .test-card:nth-child(3) { animation-delay: 0.1s; }
.page-tests .test-card:nth-child(4) { animation-delay: 0.14s; }
.page-tests .test-card:nth-child(n+5) { animation-delay: 0.18s; }

.page-tests .test-card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--primary) 55%, var(--border-color));
    box-shadow:
        0 12px 28px rgba(15, 23, 42, 0.12),
        0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent);
}

.page-tests .test-card:has(.select-test:checked) {
    border-color: var(--primary);
    box-shadow:
        0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent),
        0 10px 24px rgba(79, 70, 229, 0.18);
}

.page-tests .test-card:has(.select-test:checked) .test-card-footer,
.page-tests .test-card--selected .test-card-footer {
    background: color-mix(in srgb, var(--primary) 8%, var(--surface-soft-bg));
}

.page-tests .test-card--catalog {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--tp-border);
    background: var(--tp-card-bg);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.page-tests .test-card--catalog:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.07);
}

.page-tests .test-card-header {
    position: relative;
    padding: 0.65rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: auto;
    background: var(--tp-surface-muted);
    border-bottom: 1px solid var(--tp-border);
}

.page-tests .test-card-icon {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
    background: var(--tp-primary-soft);
    color: var(--tp-primary);
    border-radius: 8px;
}

.page-tests .test-card-code {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--tp-muted);
    background: var(--tp-card-bg);
    border: 1px solid var(--tp-border);
    padding: 0.15rem 0.4rem;
    border-radius: 5px;
}

.page-tests .test-card-body {
    padding: 0.75rem 0.85rem 0.65rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.page-tests .test-card-title {
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    line-height: 1.35;
    color: var(--tp-heading);
    min-height: 2.65em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    hyphens: auto;
}

.page-tests h3.test-card-title {
    font-size: 0.78rem;
}

.page-tests .test-card-description {
    font-size: 0.72rem;
    line-height: 1.4;
    margin-bottom: 0.35rem;
    color: var(--tp-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.page-tests .test-card-hint {
    font-size: 0.6875rem;
    margin-bottom: 0.5rem;
    opacity: 0.85;
}

.page-tests .test-card-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--tp-teal);
    margin-top: auto;
    padding-top: 0.35rem;
}

.page-tests .test-card-price small {
    color: var(--tp-muted);
    font-weight: 400;
}

.page-tests .test-card-price small {
    font-size: 0.6875rem;
}

.page-tests .test-meta--inline {
    font-size: 0.6875rem;
    gap: 0.5rem 0.75rem;
    margin-top: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px dashed color-mix(in srgb, var(--border-color) 80%, transparent);
}

.page-tests .test-card-footer {
    padding: 0.65rem 0.85rem;
    min-height: 2.75rem;
    align-items: center;
}

.page-tests .test-card-select {
    font-size: 0.75rem;
}

.page-tests .test-card-select:hover .test-card-select-box {
    border-color: var(--primary-light);
    transform: scale(1.05);
}

.page-tests .test-card-view-btn {
    font-size: 0.75rem !important;
    font-weight: 600;
    background: #3b82f6 !important;
    color: #fff !important;
    border: 1px solid #2563eb !important;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.28) !important;
    transition: background 0.2s, box-shadow 0.2s !important;
}

.page-tests .test-card-view-btn:hover {
    background: #2563eb !important;
    border-color: #1d4ed8 !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35) !important;
}

.page-tests .test-card-view-btn:active {
    transform: translateY(0) scale(0.98);
}

.page-tests #bookSelectedBtn {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.page-tests #bookSelectedBtn:hover {
    transform: translateY(-2px);
}

.page-tests .tests-toolbar {
    animation: testsFadeUp 0.35s ease both;
}

/* ========== Test detail ========== */
.page-test-detail .section {
    padding: 1.5rem 0 2.5rem;
}

.page-test-detail .breadcrumb {
    font-size: 0.75rem;
    margin-bottom: 0.65rem;
}

.page-test-detail .test-detail-main.card {
    padding: 1rem 1.1rem 1.15rem;
    animation: testsFadeUp 0.4s ease both;
}

.page-test-detail .detail-header {
    margin-bottom: 0.85rem;
    gap: 0.75rem;
}

.page-test-detail .icon-pill {
    width: 44px;
    height: 44px;
    font-size: 1rem;
    flex-shrink: 0;
}

.page-test-detail .detail-header .badge {
    font-size: 0.6875rem;
    padding: 0.2rem 0.5rem;
    margin-bottom: 0.25rem;
}

.page-test-detail .test-detail-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    letter-spacing: -0.02em;
}

.page-test-detail h1.test-detail-title {
    font-size: 1.05rem;
}

.page-test-detail .detail-section {
    padding-top: 0.85rem;
    margin-top: 0.85rem;
}

.page-test-detail .test-detail-heading {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.55rem;
    color: var(--text-primary);
}

.page-test-detail h3.test-detail-heading {
    font-size: 0.8125rem;
}

.page-test-detail .test-package-description {
    font-size: 0.8125rem;
    line-height: 1.5;
}

.page-test-detail .test-package-description .test-desc-lead {
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.55rem;
}

.page-test-detail .test-package-description .test-desc-section-title {
    font-size: 0.6875rem;
    margin-bottom: 0.4rem;
}

.page-test-detail .test-package-description .test-desc-group {
    font-size: 0.75rem;
    padding: 0.45rem 0.55rem;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    animation: testsSlideIn 0.35s ease both;
}

.page-test-detail .test-package-description .test-desc-group:nth-child(1) { animation-delay: 0.05s; }
.page-test-detail .test-package-description .test-desc-group:nth-child(2) { animation-delay: 0.08s; }
.page-test-detail .test-package-description .test-desc-group:nth-child(3) { animation-delay: 0.11s; }
.page-test-detail .test-package-description .test-desc-group:nth-child(4) { animation-delay: 0.14s; }
.page-test-detail .test-package-description .test-desc-group:nth-child(n+5) { animation-delay: 0.17s; }

.page-test-detail .test-package-description .test-desc-group:hover {
    transform: translateX(3px);
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border-color));
}

.page-test-detail .test-package-description .test-desc-group-title {
    font-size: 0.75rem;
}

.page-test-detail .test-package-description .test-desc-group-body {
    font-size: 0.75rem;
}

.page-test-detail .test-package-description .test-desc-footer {
    font-size: 0.75rem;
    padding: 0.5rem 0.6rem;
}

.page-test-detail .test-prep-text {
    font-size: 0.8125rem;
}

.page-test-detail .stats-grid {
    gap: 0.65rem;
}

.page-test-detail .stat-box {
    padding: 0.65rem 0.5rem;
    font-size: 0.75rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.page-test-detail .stat-box:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border-color));
}

.page-test-detail .stat-box > div:first-of-type {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.page-test-detail .stat-box strong {
    font-size: 0.8125rem;
    font-weight: 600;
}

.page-test-detail .stat-box i {
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.page-test-detail .test-book-card {
    padding: 1rem 1.1rem;
    animation: testsFadeUp 0.45s ease 0.08s both;
}

.page-test-detail .test-book-heading {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.page-test-detail h3.test-book-heading {
    font-size: 0.9rem;
}

.page-test-detail .test-detail-price {
    font-size: 1.2rem;
    margin: 0.35rem 0 0.85rem;
}

.page-test-detail .check-list {
    margin-bottom: 1rem;
}

.page-test-detail .check-list li {
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
}

.page-test-detail .test-book-btn {
    width: 100%;
    font-size: 0.875rem;
    padding: 0.6rem 1rem;
    transition: transform 0.2s ease, box-shadow 0.25s ease;
}

.page-test-detail .test-book-btn:hover {
    transform: translateY(-2px);
}

.page-test-detail .muted-center {
    font-size: 0.6875rem;
    margin-top: 0.75rem;
}

.page-test-detail .related-tests-wrap {
    margin-top: 2rem;
}

.page-test-detail .related-tests-grid {
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.page-test-detail .related-tests-grid .test-card {
    animation: testsFadeUp 0.4s ease both;
}

.page-test-detail .related-tests-grid .test-card:nth-child(1) { animation-delay: 0.04s; }
.page-test-detail .related-tests-grid .test-card:nth-child(2) { animation-delay: 0.08s; }
.page-test-detail .related-tests-grid .test-card:nth-child(3) { animation-delay: 0.12s; }
.page-test-detail .related-tests-grid .test-card:nth-child(4) { animation-delay: 0.16s; }

.page-test-detail .test-card--compact .test-card-header {
    padding: 0.65rem 0.85rem;
}

.page-test-detail .test-card--compact .test-card-icon {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
}

.page-test-detail .test-card--compact .test-card-body {
    padding: 0.7rem 0.85rem 0.6rem;
}

.page-test-detail .test-card--compact .test-card-title {
    font-size: 0.75rem;
}

.page-test-detail h3.test-card--compact .test-card-title,
.page-test-detail .test-card--compact h3.test-card-title {
    font-size: 0.75rem;
}

.page-test-detail .test-card--compact .test-card-description {
    font-size: 0.6875rem;
    -webkit-line-clamp: 2;
    margin-bottom: 0.2rem;
}

.page-test-detail .test-card--compact .test-card-hint {
    font-size: 0.625rem;
    margin-bottom: 0.4rem;
}

.page-test-detail .test-card--compact .test-card-price {
    font-size: 0.9rem;
}

.page-test-detail .test-card--compact .test-card-footer {
    padding: 0.55rem 0.85rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.page-test-detail .test-card--compact .test-meta {
    font-size: 0.625rem;
}

.page-test-detail .test-card--compact .btn-sm {
    font-size: 0.6875rem;
    padding: 0.3rem 0.65rem;
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.2);
}

.page-test-detail .related-tests-heading {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.page-test-detail h2.related-tests-heading {
    font-size: 1rem;
}

@media (prefers-reduced-motion: reduce) {
    .page-tests .test-card,
    .page-test-detail .test-detail-main.card,
    .page-test-detail .test-book-card,
    .page-test-detail .test-desc-group {
        animation: none;
    }

    .page-tests .test-card:hover,
    .page-test-detail .test-desc-group:hover,
    .page-test-detail .stat-box:hover {
        transform: none;
    }
}

@media (max-width: 768px) {
    .page-tests .test-grid {
        grid-template-columns: 1fr;
    }

    .page-test-detail .test-detail-title {
        font-size: 0.95rem;
    }
}

/* ========== Test detail page ========== */
.page-test-detail .test-detail-title,
.page-test-detail .related-tests-heading {
    color: var(--tp-heading);
}

.page-test-detail .test-book-card {
    border: 1px solid var(--tp-border);
    background: var(--tp-card-bg);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.page-test-detail .test-book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #3b82f6;
}

.page-test-detail .test-detail-price {
    color: var(--tp-teal);
    font-weight: 700;
}

.page-test-detail .test-book-btn {
    background: #1e293b !important;
}

.page-test-detail .breadcrumb a {
    color: #3b82f6;
}

.page-tests .test-card:has(.select-test:checked) {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.page-test-detail .test-card--compact .btn-sm {
    background: var(--tp-card-bg) !important;
    border: 1px solid var(--tp-border) !important;
    color: var(--tp-heading) !important;
    box-shadow: none !important;
}

body.page-tests .content-wrap,
body.page-test-detail .content-wrap {
    background: var(--tp-page-bg);
}

[data-theme='dark'] .page-tests .category-scroll .category-icon {
    color: var(--tp-muted);
}

[data-theme='dark'] .page-tests .test-card--catalog:hover {
    border-color: rgba(148, 163, 184, 0.45);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

[data-theme='dark'] .page-test-detail .test-book-card {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}
