/* Extracted from diagrams.html */

/* Main container */
        .main-container {
            max-width: 1600px;
            margin: 0 auto;
            padding: 5rem 2rem 2rem;
        }

        /* Search bar */
        .search-section {
            display: flex; gap: 1rem; margin-bottom: 2rem;
            flex-wrap: wrap; align-items: center;
        }

        .search-input {
            flex: 1; min-width: 250px;
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 0.75rem 1rem 0.75rem 2.5rem;
            color: var(--text-primary);
            font-size: 0.95rem;
            outline: none;
            transition: border-color 0.2s;
        }

        .search-input:focus { border-color: var(--accent); }

        .search-wrapper {
            position: relative; flex: 1; min-width: 250px;
        }

        .search-wrapper i {
            position: absolute; left: 0.85rem; top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
        }

        .filter-select {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 0.75rem 1rem;
            color: var(--text-primary);
            font-size: 0.9rem;
            outline: none;
            min-width: 160px;
        }

        .filter-select option { background: var(--bg-card); }

        .type-filters {
            display: flex; gap: 0.5rem;
        }

        .type-btn {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 0.5rem 1rem;
            color: var(--text-secondary);
            font-size: 0.85rem;
            cursor: pointer;
            transition: all 0.2s;
        }

        .type-btn:hover { border-color: var(--accent); color: var(--text-primary); }
        .type-btn.active {
            background: var(--accent);
            border-color: var(--accent);
            color: white;
        }

        /* Stats bar */
        .stats-bar {
            display: flex; gap: 2rem; margin-bottom: 1.5rem;
            padding: 0.75rem 1rem;
            background: var(--bg-secondary);
            border-radius: 8px;
            border: 1px solid var(--border);
            font-size: 0.85rem;
            color: var(--text-secondary);
        }

        .stats-bar span { color: var(--accent); font-weight: 600; }

        /* Diagram grid */
        .diagram-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 1.25rem;
        }

        .diagram-card {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 10px;
            overflow: hidden;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .diagram-card:hover {
            border-color: var(--accent);
            transform: translateY(-2px);
            box-shadow: 0 8px 30px rgba(0,0,0,0.4);
        }

        .diagram-card-img {
            width: 100%;
            aspect-ratio: 16/10;
            object-fit: contain;
            background: #f0f0f0;
            display: block;
        }

        .diagram-card-body {
            padding: 0.85rem 1rem;
        }

        .diagram-card-title {
            font-family: 'Orbitron', monospace;
            font-size: 1rem;
            font-weight: 600;
            color: var(--accent);
            margin-bottom: 0.25rem;
        }

        .diagram-card-sub {
            font-size: 0.8rem;
            color: var(--text-secondary);
        }

        .diagram-card-badge {
            display: inline-block;
            font-size: 0.7rem;
            padding: 0.15rem 0.5rem;
            border-radius: 4px;
            margin-top: 0.4rem;
            font-weight: 600;
        }

        .badge-front { background: rgba(59,130,246,0.2); color: #60a5fa; }
        .badge-steering { background: rgba(245,158,11,0.2); color: #fbbf24; }
        .badge-rear { background: rgba(34,197,94,0.2); color: #4ade80; }

        /* Viewer overlay */
        .viewer-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.85);
            z-index: 2000;
            display: none;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .viewer-overlay.active {
            display: flex;
            opacity: 1;
        }

        .viewer-layout {
            display: flex;
            width: 100%; height: 100%;
        }

        /* Diagram panel (left) */
        .viewer-diagram {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: var(--bg-primary);
        }

        .viewer-toolbar {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 0.75rem 1.25rem;
            background: var(--bg-secondary);
            border-bottom: 1px solid var(--border);
        }

        .viewer-toolbar .title {
            font-family: 'Orbitron', monospace;
            font-size: 1.1rem;
            font-weight: 600;
            color: var(--accent);
            flex: 1;
        }

        .viewer-toolbar .subtitle {
            font-size: 0.8rem;
            color: var(--text-secondary);
        }

        .toolbar-btn {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 0.5rem 0.75rem;
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.2s;
            font-size: 0.9rem;
        }

        .toolbar-btn:hover {
            border-color: var(--accent);
            color: var(--text-primary);
        }

        .viewer-img-container {
            flex: 1;
            overflow: auto;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1rem;
            background: #e8e8e8;
        }

        .viewer-img-container img {
            max-width: 100%;
            max-height: 100%;
            transition: transform 0.3s ease;
            cursor: grab;
        }

        .viewer-img-container img.zoomed {
            max-width: none;
            max-height: none;
            cursor: move;
        }

        /* Parts panel (right) */
        .viewer-parts {
            width: 420px;
            background: var(--bg-secondary);
            border-left: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .parts-header {
            padding: 0.85rem 1.25rem;
            background: var(--bg-card);
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .parts-header h3 {
            font-size: 0.95rem;
            font-weight: 600;
            flex: 1;
        }

        .parts-header .count {
            font-size: 0.8rem;
            color: var(--text-secondary);
            background: var(--bg-hover);
            padding: 0.2rem 0.6rem;
            border-radius: 10px;
        }

        .parts-search {
            padding: 0.65rem 1rem;
            border-bottom: 1px solid var(--border);
        }

        .parts-search input {
            width: 100%;
            background: var(--bg-primary);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 0.5rem 0.75rem;
            color: var(--text-primary);
            font-size: 0.85rem;
            outline: none;
        }

        .parts-search input:focus { border-color: var(--accent); }

        .parts-list {
            flex: 1;
            overflow-y: auto;
            padding: 0.5rem;
        }

        .part-item {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 0.75rem;
            margin-bottom: 0.5rem;
            cursor: pointer;
            transition: all 0.2s;
        }

        .part-item:hover, .part-item.highlighted {
            border-color: var(--accent);
            background: var(--bg-hover);
        }

        .part-item .part-number {
            font-family: 'Orbitron', monospace;
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--accent);
        }

        .part-item .part-name {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin: 0.2rem 0;
        }

        .part-item .part-group {
            font-size: 0.7rem;
            color: var(--text-secondary);
            opacity: 0.7;
        }

        .xref-list {
            margin-top: 0.4rem;
            padding-top: 0.4rem;
            border-top: 1px solid var(--border);
        }

        .xref-item {
            display: inline-block;
            font-size: 0.7rem;
            padding: 0.1rem 0.4rem;
            background: rgba(59,130,246,0.15);
            color: #60a5fa;
            border-radius: 3px;
            margin: 0.1rem;
        }

        .xref-label {
            font-size: 0.65rem;
            color: var(--text-secondary);
            margin-bottom: 0.2rem;
        }

        /* Loading / Empty states */
        .loading-state, .empty-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 3rem;
            color: var(--text-secondary);
            text-align: center;
        }

        .loading-state i, .empty-state i {
            font-size: 2.5rem;
            margin-bottom: 1rem;
            opacity: 0.5;
        }

        .spinner {
            animation: spin 1s linear infinite;
        }

        /* Pagination */
        .pagination {
            display: flex;
            justify-content: center;
            gap: 0.5rem;
            margin-top: 2rem;
            padding-bottom: 2rem;
        }

        .page-btn {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 0.5rem 1rem;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 0.85rem;
            transition: all 0.2s;
        }

        .page-btn:hover { border-color: var(--accent); color: var(--text-primary); }
        .page-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
        .page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

        /* Responsive */
        @media (max-width: 768px) {
            .viewer-layout { flex-direction: column; }
            .viewer-parts { width: 100%; height: 50%; }
            .diagram-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
            .search-section { flex-direction: column; }
        }

        /* Close button */
        .close-btn {
            position: absolute;
            top: 0.75rem; right: 0.75rem;
            background: rgba(0,0,0,0.6);
            border: none;
            color: white;
            width: 36px; height: 36px;
            border-radius: 50%;
            font-size: 1.1rem;
            cursor: pointer;
            z-index: 10;
            transition: background 0.2s;
        }

        .close-btn:hover { background: var(--accent); }

        /* Zoom controls */
        .zoom-controls {
            position: absolute;
            bottom: 1rem; left: 50%;
            transform: translateX(-50%);
            display: flex; gap: 0.5rem;
            background: rgba(0,0,0,0.6);
            padding: 0.4rem;
            border-radius: 8px;
        }

        .zoom-btn {
            background: var(--bg-card);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 0.4rem 0.75rem;
            color: var(--text-primary);
            cursor: pointer;
            font-size: 0.85rem;
            transition: all 0.2s;
        }

        .zoom-btn:hover { background: var(--accent); }

        .zoom-level {
            display: flex;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.8rem;
            padding: 0 0.5rem;
        }

        /* Nav buttons in viewer */
        .viewer-nav-btn {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            background: rgba(0,0,0,0.5);
            border: none;
            color: white;
            width: 44px; height: 44px;
            border-radius: 50%;
            font-size: 1.2rem;
            cursor: pointer;
            transition: background 0.2s;
            z-index: 5;
        }

        .viewer-nav-btn:hover { background: var(--accent); }
        .viewer-nav-btn.prev { left: 0.75rem; }
        .viewer-nav-btn.next { right: 430px; }

        @media (max-width: 768px) {
            .viewer-nav-btn.next { right: 0.75rem; }
        }
