/* BattScore Custom Styles - Trustworthy & Modern Design */

:root {
    /* Primary palette - trust-inspiring teal/green tones */
    --bs-primary: #0d9488;
    --bs-primary-dark: #0f766e;
    --bs-primary-light: #5eead4;
    --bs-primary-subtle: #ccfbf1;
    
    /* Neutral palette */
    --bs-body-bg: #f8fafc;
    --bs-card-bg: #ffffff;
    --bs-border-color: #e2e8f0;
    
    /* Text colors */
    --bs-body-color: #334155;
    --bs-heading-color: #1e293b;
    --bs-muted: #64748b;
    
    /* Accent colors */
    --bs-success: #22c55e;
    --bs-warning: #f59e0b;
    --bs-danger: #ef4444;
    --bs-info: #3b82f6;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Base styles */
html, body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

/* Monospace utility — for data values, measurements, technical readouts */
.font-mono {
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
}

/* Apply monospace to data-heavy table columns:
   col 5 = Tested Capacity, col 6 = Test Current, col 7 = Price,
   col 8 = mAh/€, col 9 = Test Date */
#data-table .table tbody td:nth-child(n+5):nth-child(-n+9) {
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.8125rem;
    letter-spacing: -0.01em;
}

/* Prevent horizontal overflow without clipping vertical scroll */
.main-layout {
    overflow-x: clip;
}

/* Header styling */
header.site-header {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%) !important;
    box-shadow: var(--shadow-sm);
    border-bottom: none;
}

header.site-header .navbar-brand .h4 {
    color: white;
    font-weight: 700;
    letter-spacing: -0.025em;
}

header.site-header small {
    color: rgba(255, 255, 255, 0.7);
}

header.site-header .brand-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

header.site-header .nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

header.site-header .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Mobile nav styling */
@media (max-width: 767.98px) {
    .site-header .navbar-collapse {
        background: rgba(0, 0, 0, 0.1);
        border-radius: 0.5rem;
        padding: 0.5rem;
        margin-top: 0.5rem;
    }
    .site-header .nav-link {
        padding: 0.75rem 1rem;
    }
}

/* Layout */
.main-layout {
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .main-layout {
        height: 100vh;
    }
}

/* Footer */
.site-footer {
    border-top: 1px solid #e2e8f0;
    padding: 1.25rem 0;
    font-size: 0.85rem;
    color: #64748b;
    background: #ffffff;
    margin-top: auto;
}

.site-footer a:hover {
    color: #0d9488;
}

/* Custom badge color for price age indicators */
.bg-orange {
    background-color: #fd7e14 !important;
    color: white;
}

/* Card styling */
.card {
    background: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}

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

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--bs-border-color);
    padding: 1rem 1.25rem;
    border-left: 3px solid #0d9488;
}

.card-header h5 {
    color: #0f766e;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.card-body {
    padding: 1.25rem;
}

/* Filter panel styling */
.filter-panel .card {
    border-radius: 12px;
}

.filter-panel .form-label {
    color: var(--bs-heading-color);
    font-size: 0.85rem;
    font-weight: 600;
}

.filter-panel .filter-checkbox-list {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color) !important;
    border-radius: 8px !important;
}

.filter-panel .form-check-label {
    font-size: 0.875rem;
    color: var(--bs-body-color);
}

.filter-panel .form-check-input:checked {
    background-color: #0d9488;
    border-color: #0d9488;
}

.filter-panel .btn-secondary {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
    border: none;
    color: white;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.filter-panel .btn-secondary:hover {
    background: linear-gradient(135deg, #115e59 0%, #0f766e 100%);
    color: white;
}

/* Table styling */
.table {
    margin-bottom: 0;
}

#data-table .table thead,
.table thead {
    background: #f1f5f9 !important;
    border-bottom: 2px solid #cbd5e1;
}

#data-table .table thead tr,
.table thead tr {
    background: transparent !important;
}

#data-table .table thead th,
.table thead th {
    color: #0f766e !important;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.875rem 1rem;
    border: none;
    white-space: nowrap;
    background: transparent !important;
}

.table thead th.sortable:hover {
    background: #e2e8f0 !important;
    cursor: pointer;
}

.table tbody tr {
    transition: background-color 0.15s ease;
    background: var(--bs-card-bg);
    cursor: pointer;
}

.table tbody tr:nth-of-type(even) {
    background: #f0fdfa;
}

.table tbody tr:hover {
    background-color: #ccfbf1 !important;
}

.table tbody tr.table-active {
    background-color: #99f6e4 !important;
    box-shadow: inset 3px 0 0 #0d9488;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    font-size: 0.875rem;
    border-color: var(--bs-border-color);
    border-bottom: 1px solid #e2e8f0;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg-type: transparent;
}

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

.badge.bg-primary {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%) !important;
}

.badge.bg-danger {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%) !important;
}

.badge.bg-outline-secondary {
    background: transparent !important;
    color: #64748b;
    border: 1px solid #94a3b8;
}

/* Pricing button in table */
.pricing-button {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.2;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.pricing-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pricing-button:active {
    transform: translateY(0);
}

.pricing-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.25);
}

/* Prevent text selection when clicking rows */
.battery-row {
    user-select: none;
}

.battery-row td {
    user-select: text;
}

/* List group styling */
.list-group-item {
    border-color: var(--bs-border-color);
    padding: 1rem;
    transition: background-color 0.15s ease;
}

.list-group-item:hover {
    background-color: var(--bs-body-bg);
}

.list-group-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.list-group-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Chart panel */
#chart-panel .card {
    background: linear-gradient(180deg, var(--bs-card-bg) 0%, #f8fafc 100%);
}

#chart-placeholder {
    color: var(--bs-muted);
}

#chart-placeholder p {
    font-size: 0.95rem;
}

/* Pricing panel */
#pricing-panel .card-header h5 {
    color: #0f766e;
}

/* Monospace for pricing values */
#pricing-panel .badge.bg-primary,
#pricing-panel .fw-bold,
#battery-detail-panel .fw-bold,
#battery-detail-panel .badge.bg-info {
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.8125rem;
}

/* Monospace for weight stats values */
.weight-scale-container ~ .d-flex .fw-semibold,
.weight-label-min,
.weight-label-max {
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
}

/* Monospace for test capacity values in detail panel */
#battery-detail-panel .list-group-item strong {
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
}

/* Monospace for GTIN barcodes */
#battery-detail-panel small.text-muted:has(+ small),
#pricing-panel .package-group h6 span {
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
}

#pricing-panel h6 {
    color: var(--bs-heading-color);
    font-weight: 600;
}

/* Form controls */
.form-check-input {
    border-radius: 4px;
    border: 2px solid #94a3b8;
    width: 1.1em;
    height: 1.1em;
}

.form-check-input:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.25);
}

.form-check-input:checked {
    background-color: #0d9488;
    border-color: #0d9488;
}

/* Chart selection checkboxes in table */
.chart-select-checkbox {
    border: 2px solid #64748b;
    width: 1.2em;
    height: 1.2em;
}

.chart-select-checkbox:checked {
    background-color: #0d9488;
    border-color: #0d9488;
}

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

::-webkit-scrollbar-track {
    background: var(--bs-body-bg);
    border-radius: 4px;
}

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

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

/* Collapse toggle button */
.btn-link {
    color: #0d9488;
    text-decoration: none;
}

.btn-link:hover {
    color: #0f766e;
}

.collapse-icon {
    font-weight: bold;
    font-size: 1.1rem;
}

/* Links */
a {
    color: var(--bs-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--bs-primary-dark);
    text-decoration: underline;
}

/* Trust indicators section (optional future use) */
.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bs-primary-subtle);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--bs-primary-dark);
    font-weight: 500;
}

.trust-badge svg {
    width: 16px;
    height: 16px;
}

/* Shared page content scroll wrapper */
.main-content {
    flex: 1;
    overflow: auto;
}

/* ============================================
   Shared Page Hero Section
   ============================================ */
.page-hero {
    background: #ffffff;
    color: var(--bs-body-color);
    padding: 3.5rem 0 3rem;
    text-align: center;
    border-bottom: 1px solid var(--bs-border-color);
}
.page-hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--bs-heading-color);
    letter-spacing: -0.025em;
}
.page-hero-subtitle {
    font-size: 1.1rem;
    color: var(--bs-muted);
    max-width: 620px;
    margin: 0 auto 1.5rem;
    line-height: 1.7;
}
.hero-tagline {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #0d9488;
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    padding: 0.375rem 1rem;
    border-radius: 20px;
}
@media (max-width: 767.98px) {
    .page-hero { padding: 2rem 0 1.5rem; }
    .page-hero-title { font-size: 1.75rem; }
    .page-hero-subtitle { font-size: 1rem; margin-bottom: 1.25rem; }
}

/* ============================================
   Shared Section Headings
   ============================================ */
.section-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--bs-heading-color);
    letter-spacing: -0.025em;
}
.section-subtitle {
    text-align: center;
    color: var(--bs-muted);
    margin-bottom: 2.5rem;
    font-size: 0.95rem;
}
@media (max-width: 767.98px) {
    .section-subtitle { margin-bottom: 1.5rem; }
}

/* ============================================
   Feature / CTA Cards (home, about pages)
   ============================================ */
.feature-card {
    background: var(--bs-body-bg);
    border-radius: 12px;
    padding: 1.75rem;
    height: 100%;
    border: 1px solid var(--bs-border-color);
    transition: all 0.2s ease;
}
.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #99f6e4;
}
.feature-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: white;
}
.feature-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bs-heading-color);
    margin-bottom: 0.375rem;
}
.feature-description {
    color: var(--bs-muted);
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 0;
}
@media (max-width: 767.98px) {
    .feature-card { padding: 1.25rem; }
    .feature-icon { width: 40px; height: 40px; margin-bottom: 0.75rem; }
}

/* ============================================
   Teal CTA Buttons (standalone, non-Bootstrap)
   ============================================ */
.btn-teal {
    display: inline-block;
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
    color: white;
    padding: 0.75rem 1.75rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
    border: none;
    cursor: pointer;
}
.btn-teal:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.35);
    color: white;
}
.btn-teal-outline {
    display: inline-block;
    background: transparent;
    color: #0d9488;
    padding: 0.75rem 1.75rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid #0d9488;
    transition: all 0.2s ease;
}
.btn-teal-outline:hover {
    background: #0d9488;
    color: white;
}

/* Bootstrap .btn-primary teal override (removes default Bootstrap blue) */
.btn-primary {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
    border-color: #0d9488;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle {
    background: linear-gradient(135deg, #115e59 0%, #0f766e 100%);
    border-color: #0f766e;
}
.btn-primary:focus,
.btn-primary:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.25);
}

/* ============================================
   Workflow Steps (about and reference pages)
   ============================================ */
.workflow-section {
    padding: 3.5rem 0;
    background: var(--bs-body-bg);
}
.workflow-track {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
}
.workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    position: relative;
    padding: 0 0.75rem;
    animation: fadeIn 0.4s ease-out both;
}
.workflow-step:nth-child(1) { animation-delay: 0.05s; }
.workflow-step:nth-child(2) { animation-delay: 0.15s; }
.workflow-step:nth-child(3) { animation-delay: 0.25s; }
.workflow-step:nth-child(4) { animation-delay: 0.35s; }
.workflow-step:nth-child(5) { animation-delay: 0.45s; }
.workflow-step-number {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
    flex-shrink: 0;
}
.workflow-step-number svg { width: 22px; height: 22px; }
.workflow-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 26px;
    left: calc(50% + 26px);
    width: calc(100% - 52px);
    height: 2px;
    background: linear-gradient(90deg, #0d9488, #99f6e4);
    z-index: 1;
}
.workflow-step-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bs-heading-color);
    margin-bottom: 0.375rem;
    line-height: 1.3;
}
.workflow-step-description {
    color: var(--bs-muted);
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0;
    max-width: 180px;
}
@media (max-width: 767.98px) {
    .workflow-section { padding: 2rem 0 1.5rem; }
    .workflow-track {
        flex-direction: column;
        align-items: flex-start;
        max-width: 400px;
        padding-left: 1rem;
    }
    .workflow-step {
        flex-direction: row;
        text-align: left;
        align-items: flex-start;
        padding: 0 0 1.75rem 0;
    }
    .workflow-step:last-child { padding-bottom: 0; }
    .workflow-step:not(:last-child)::after {
        top: 44px;
        left: 21px;
        width: 2px;
        height: calc(100% - 44px);
        background: linear-gradient(180deg, #0d9488, #99f6e4);
    }
    .workflow-step-number {
        width: 44px;
        height: 44px;
        margin-bottom: 0;
        margin-right: 1rem;
    }
    .workflow-step-number svg { width: 18px; height: 18px; }
    .workflow-step-content { padding-top: 0.25rem; }
    .workflow-step-description { max-width: 280px; }
}

/* ============================================
   Test Current Badge Chip Family
   ============================================ */
.badge-current-tested {
    font-size: 0.7rem;
    padding: 0.3em 0.7em;
    border-radius: 20px;
    background: #ccfbf1;
    color: #0f766e;
    border: 1px solid #5eead4;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
    display: inline-block;
}
a.badge-current-tested:hover {
    background: #99f6e4;
    border-color: #2dd4bf;
    color: #0f766e;
    transform: translateY(-1px);
}
.badge-current-pending {
    font-size: 0.7rem;
    padding: 0.3em 0.7em;
    border-radius: 20px;
    background: #f0fdfa;
    color: #5eaaa2;
    border: 1px solid #ccfbf1;
    font-weight: 500;
    display: inline-block;
}
.badge-current-outline {
    font-size: 0.7rem;
    padding: 0.3em 0.7em;
    border-radius: 20px;
    border: 1px solid #5eead4;
    color: #0f766e;
    background: #f0fdfa;
    font-weight: 500;
    display: inline-block;
}

/* Empty state styling */
.text-muted {
    color: var(--bs-muted) !important;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .sidebar-column {
        max-height: 300px;
    }
    
    .card-header h5 {
        font-size: 0.9rem;
    }
}

/* Animation for interactive elements */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.3s ease-out;
}

/* Focus states for accessibility */
:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* ============================================
   Battery Catalog Page Styles
   ============================================ */

/* Manufacturer group styling */
.manufacturer-group {
    border-bottom: 1px solid var(--bs-border-color);
}

.manufacturer-group:last-child {
    border-bottom: none;
}

.manufacturer-header {
    font-size: 0.95rem;
    transition: background-color 0.15s ease;
}

.manufacturer-header:hover {
    background-color: #e2e8f0 !important;
}

/* Brand group styling */
.brand-group {
    border-left: 2px solid #e2e8f0;
}

.brand-header {
    font-size: 0.9rem;
    transition: background-color 0.15s ease;
}

.brand-header:hover {
    background-color: #f1f5f9 !important;
}

/* Battery card styling */
.battery-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    transition: all 0.15s ease;
}

.battery-card:hover {
    border-color: var(--bs-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.battery-card.selected {
    border-color: var(--bs-primary);
    background-color: var(--bs-primary-subtle);
    box-shadow: inset 3px 0 0 var(--bs-primary), var(--shadow-md);
}

/* Catalog search and sort controls */
#catalog-controls .form-control:focus,
#catalog-controls .form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.25);
}

#catalog-controls .input-group-text {
    border-color: var(--bs-border-color);
}

#catalog-controls .form-control {
    border-color: var(--bs-border-color);
}

#catalog-controls .form-select {
    border-color: var(--bs-border-color);
}

/* Battery thumbnail styling */
.battery-thumb img {
    border: 1px solid var(--bs-border-color);
}

.battery-thumb-placeholder {
    border: 1px dashed var(--bs-border-color);
}

/* Carousel styling for battery detail panel */
#battery-images-carousel .carousel-control-prev,
#battery-images-carousel .carousel-control-next {
    width: 10%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    margin: 0.5rem;
    height: auto;
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
}

#battery-images-carousel .carousel-indicators {
    bottom: 0.5rem;
}

#battery-images-carousel .carousel-indicators button {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 0 4px;
}

/* Package group styling */
.package-group .list-group-item {
    background-color: var(--bs-body-bg);
    border-radius: 6px;
    margin-bottom: 0.25rem;
}

.package-group .list-group-item:last-child {
    margin-bottom: 0;
}

/* Detail panel close button */
#battery-detail-panel .btn-close {
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

#battery-detail-panel .btn-close:hover {
    opacity: 1;
}

/* ============================================
   Mobile Touch Target Improvements
   ============================================ */

@media (max-width: 767.98px) {
    /* Larger checkboxes for touch */
    .form-check-input,
    .chart-select-checkbox {
        min-width: 24px;
        min-height: 24px;
        width: 24px;
        height: 24px;
    }

    /* 44px minimum touch area for checkbox rows */
    .form-check {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 0.375rem 0;
    }

    .form-check-label {
        padding-left: 0.5rem;
        line-height: 1.4;
        flex: 1;
    }

    /* Hamburger toggle - 44px minimum touch target */
    .site-header .navbar-toggler {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Filter collapse toggle buttons - 44px minimum */
    .filter-panel .btn-link[data-bs-toggle="collapse"],
    .filter-panel .collapse-toggle {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Clear Filters button - 44px minimum height */
    .filter-panel .btn-outline-secondary {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Announcement banner compact on mobile */
    .announcement-banner {
        font-size: 0.8rem;
        padding: 0.375rem 0.75rem !important;
    }

    .announcement-email-link {
        display: inline-block;
        padding: 0.5rem 0;
        min-height: 44px;
        line-height: 1.4;
    }

    /* Footer email link touch target */
    .footer-email-link {
        display: inline-block;
        padding: 0.75rem 0;
    }

    /* Larger pricing buttons */
    .pricing-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    /* Improve table row touch targets */
    .table tbody td {
        padding: 0.875rem 0.75rem;
    }

    /* Larger collapse toggle buttons */
    .btn-link.collapse-toggle {
        padding: 0.5rem;
    }

    /* Carousel controls larger for touch */
    #battery-images-carousel .carousel-control-prev,
    #battery-images-carousel .carousel-control-next {
        width: 15%;
    }

    #battery-images-carousel .carousel-indicators button {
        width: 12px;
        height: 12px;
    }
}

/* Tests page: hide less-important table columns on mobile */
@media (max-width: 767.98px) {
    /* Hide Chemistry (col 4), mAh/€ (col 8), Test Date (col 9) */
    #data-table .table th:nth-child(4),
    #data-table .table td:nth-child(4),
    #data-table .table th:nth-child(8),
    #data-table .table td:nth-child(8),
    #data-table .table th:nth-child(9),
    #data-table .table td:nth-child(9) {
        display: none;
    }

    /* Compact table cells */
    #data-table .table thead th {
        padding: 0.5rem 0.375rem;
        font-size: 0.625rem;
    }

    #data-table .table tbody td {
        padding: 0.625rem 0.375rem;
        font-size: 0.8rem;
    }

    /* Truncate brand name */
    #data-table .table td:nth-child(2) {
        max-width: 120px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Compact pricing button on mobile */
    #data-table .pricing-button {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Tests page: filter checkboxes in offcanvas — prevent clipping */
@media (max-width: 991.98px) {
    #filterOffcanvas .filter-checkbox-list {
        padding-left: 0.75rem;
    }

    #filterOffcanvas .form-check {
        padding-left: 2rem;
    }

    #filterOffcanvas .form-check .form-check-input {
        margin-left: -1.75rem;
    }
}

/* Catalog page: filter checkboxes in offcanvas — prevent clipping */
@media (max-width: 991.98px) {
    #catalogFilterOffcanvas .filter-checkbox-list {
        padding-left: 0.75rem;
    }

    #catalogFilterOffcanvas .form-check {
        padding-left: 2rem;
    }

    #catalogFilterOffcanvas .form-check .form-check-input {
        margin-left: -1.75rem;
    }
}

/* Tests page: chart header stacked on mobile */
@media (max-width: 991.98px) {
    #chart-panel .card-header {
        flex-wrap: wrap;
    }

    #chart-panel .card-header h5 {
        width: 100%;
        margin-bottom: 0.25rem;
    }

    /* Prevent form-switch toggle from being clipped at card edge */
    #chart-panel .card-header .form-switch {
        padding-left: 2.5em;
    }
}

/* Compare page: curated comparison cards */
.curated-comparison-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    border-color: var(--bs-primary) !important;
}

/* Compare page: resizable chart */
.compare-chart-body {
    height: 340px;
    min-height: 200px;
    max-height: 800px;
}

.chart-resize-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 16px;
    cursor: ns-resize;
    border-top: 1px solid var(--bs-border-color);
    border-radius: 0 0 12px 12px;
    transition: background-color 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.chart-resize-handle:hover,
.chart-resize-handle.active {
    background-color: var(--bs-body-bg);
}

.chart-resize-handle-bar {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background-color: #cbd5e1;
    transition: background-color 0.15s ease, width 0.15s ease;
}

.chart-resize-handle:hover .chart-resize-handle-bar,
.chart-resize-handle.active .chart-resize-handle-bar {
    background-color: var(--bs-primary);
    width: 56px;
}

/* Full-width variant spanning both compare charts */
.chart-resize-handle--full {
    border-radius: 0;
    border-top: none;
    border-bottom: 1px solid var(--bs-border-color);
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 991.98px) {
    .recent-tests-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}


/* =========================================================
   Global Search Bar
   ========================================================= */

.global-search-wrapper {
    position: relative;
    min-width: 240px;
    max-width: 320px;
    flex-shrink: 1;
}

.global-search-input-group {
    position: relative;
}

.global-search-input {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: #fff;
    font-size: 0.85rem;
    padding: 0.375rem 2rem 0.375rem 0.875rem;
    transition: background 0.2s ease, border-color 0.2s ease;
    width: 100%;
}

.global-search-input::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

.global-search-input:focus {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--bs-primary-light);
    box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.35);
    color: var(--bs-body-color);
    outline: none;
}

.global-search-input:focus::placeholder {
    color: var(--bs-muted);
}

.global-search-icon {
    position: absolute;
    right: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.7);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.global-search-input:focus ~ .global-search-icon {
    color: var(--bs-muted);
}

.global-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 360px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 1050;
}

.global-search-dropdown:empty {
    display: none;
}

.global-search-dropdown-mobile {
    position: static;
    min-width: 0;
    width: 100%;
    margin-top: 4px;
}

.global-search-results-list {
    padding: 0.25rem 0;
}

.global-search-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    color: var(--bs-body-color);
    transition: background 0.15s ease;
    cursor: pointer;
}

.global-search-result:hover {
    background: var(--bs-primary-subtle);
    color: var(--bs-body-color);
}

.global-search-result-thumb {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

.global-search-result-thumb img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.global-search-result-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
}

.global-search-result-body {
    flex: 1;
    min-width: 0;
}

.global-search-result-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--bs-heading-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.global-search-result-detail {
    font-size: 0.75rem;
    color: var(--bs-muted);
    margin-top: 1px;
}

.global-search-no-results {
    padding: 0.875rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--bs-muted);
}

/* Mobile search inside collapsed nav */
@media (max-width: 767.98px) {
    .global-search-wrapper.d-md-none {
        max-width: 100%;
        min-width: 0;
    }

    .global-search-input {
        background: rgba(255, 255, 255, 0.15);
        color: #fff;
    }

    .global-search-input:focus {
        background: rgba(255, 255, 255, 0.95);
        color: var(--bs-body-color);
    }
}


/* Spec comparison ranking highlights — needs .table prefix to beat Bootstrap's (0,1,1) table reset */
.table .spec-best  { background-color: #f0fdf4; color: #16a34a; }
.table .spec-worse { background-color: #fef2f2; color: #dc2626; }
