/* Brake Cables - Mobile-First Responsive Styles */

/* Base styles for all brake cable pages */
.brake-cables-container {
    min-height: 100vh;
}

/* Hero sections */
.brake-hero {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.brake-hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(13, 110, 253, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

/* Search and finder forms */
.dimension-search-form {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 2rem;
}

.search-input-group {
    position: relative;
    margin-bottom: 1rem;
}

.search-input-group input {
    padding-right: 3rem;
}

.search-input-group .input-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.tolerance-slider {
    width: 100%;
    margin: 0.5rem 0;
}

.tolerance-display {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Results and catalog grids */
.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.part-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.part-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: inherit;
}

.part-card-header {
    background: #f8f9fa;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid #dee2e6;
}

.part-card-body {
    padding: 1.25rem;
}

.part-number-badge {
    background: #0d6efd;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.market-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
}

.market-badge.automotive {
    background: #cff4fc;
    color: #055160;
}

.market-badge.trailer {
    background: #fff3cd;
    color: #664d03;
}

/* Specifications display */
.spec-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.spec-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.spec-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0d6efd;
    margin-bottom: 0.25rem;
}

.spec-label {
    font-size: 0.75rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Terminal visualization */
.terminal-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

.terminal-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #495057;
}

.terminal-connector {
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, #dee2e6 0%, #495057 50%, #dee2e6 100%);
    position: relative;
}

.terminal-connector::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: #495057;
    border-radius: 50%;
}

/* Spring indicator */
.spring-indicator {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.spring-indicator.green { background-color: #28a745; }
.spring-indicator.purple { background-color: #6f42c1; }
.spring-indicator.blue { background-color: #007bff; }
.spring-indicator.none { 
    background: repeating-linear-gradient(45deg, #f8f9fa 0px, #f8f9fa 3px, #dee2e6 3px, #dee2e6 6px);
}

/* Cross-reference badges */
.cross-ref-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.cross-ref-badge {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.cross-ref-badge:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.cross-ref-brand {
    font-weight: 600;
    color: #495057;
}

.cross-ref-part {
    color: #6c757d;
    margin-left: 0.25rem;
}

/* Loading and error states */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6c757d;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 3D Viewer enhancements */
#terminal-viewer {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    position: relative;
}

.viewer-container {
    transition: all 0.3s ease;
}

.viewer-container:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.viewer-controls {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    z-index: 10;
}

.viewer-control-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.viewer-control-btn:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Terminal Thumbnails */
.terminal-thumbnails {
    background: rgba(248, 249, 250, 0.5);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(222, 226, 230, 0.5);
}

.terminal-thumbnail {
    aspect-ratio: 1 / 1;
    background: white;
    border-radius: 12px;
    border: 2px solid #dee2e6;
    padding: 0.75rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.terminal-thumbnail:hover {
    border-color: #0d6efd;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.15);
}

.terminal-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.terminal-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.terminal-thumb-container small {
    color: #495057;
    font-size: 0.8rem;
    line-height: 1.2;
}

/* Part Number Display */
.part-number-display {
    text-align: right;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(222, 226, 230, 0.5);
}

.badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Responsive breakpoints */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .dimension-search-form {
        padding: 2.5rem;
    }
    
    .parts-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 2rem;
    }
    
    .badge-group {
        justify-content: flex-start;
    }
    
    .part-number-display {
        text-align: right;
    }
}

/* Extra small devices (mobile) */
@media (max-width: 575.98px) {
    .part-number-display {
        text-align: left;
        margin-top: 1rem;
        width: 100%;
    }
    
    .badge-group {
        margin-top: 0.5rem;
    }
    
    #terminal-viewer {
        min-height: 200px;
    }
    
    .terminal-thumbnails {
        margin-top: 2rem;
        padding: 1rem;
    }
    
    .viewer-container {
        padding: 1rem;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .spec-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .search-row {
        display: flex;
        gap: 1rem;
        align-items: end;
    }
    
    .search-row .search-input-group {
        flex: 1;
        margin-bottom: 0;
    }
    
    .terminal-display {
        gap: 2rem;
    }
    
    .terminal-icon {
        width: 50px;
        height: 50px;
    }
    
    #terminal-viewer {
        min-height: 280px;
    }
    
    .terminal-thumbnails {
        margin-top: 0;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .parts-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 2.5rem;
    }
    
    .brake-hero {
        padding: 3rem;
    }
    
    .dimension-search-form {
        padding: 3rem;
    }
    
    #terminal-viewer {
        min-height: 320px;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .parts-grid {
        grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    }
}

/* Print styles */
@media print {
    .brake-hero::before,
    .viewer-controls,
    #terminal-viewer {
        display: none !important;
    }
    
    .part-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .cross-ref-badge {
        border: 1px solid #000;
    }
}

/* PWA and mobile app enhancements */
@media (display-mode: standalone) {
    .brake-cables-container {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    .brake-hero {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        color: white;
    }
    
    /* Ensure text is readable in dark mode - target specific hero content areas */
    .brake-hero .hero-content .text-body-emphasis,
    .brake-hero .hero-content h1,
    .brake-hero .hero-content h2,
    .brake-hero .hero-content h3,
    .brake-hero .hero-content .display-4 {
        color: white !important;
    }
    
    .brake-hero .hero-content .text-body-secondary,
    .brake-hero .hero-content .lead,
    .brake-hero .hero-content p {
        color: #e2e8f0 !important;
    }
    
    /* Ensure hero info card maintains proper contrast in dark mode */
    .brake-hero .hero-info-card {
        background: white !important;
        color: #212529 !important;
    }
    
    /* Override any dark mode effects on card content */
    .brake-hero .hero-info-card,
    .brake-hero .hero-info-card * {
        color: #212529 !important;
    }
    
    /* Restore Bootstrap color utilities within the card */
    .brake-hero .hero-info-card .text-primary {
        color: #0d6efd !important;
    }
    
    .brake-hero .hero-info-card .text-success {
        color: #198754 !important;
    }
    
    .brake-hero .hero-info-card .text-warning {
        color: #ffc107 !important;
    }
    
    .brake-hero .hero-info-card .text-info {
        color: #0dcaf0 !important;
    }
    
    .brake-hero .hero-info-card .text-muted {
        color: #6c757d !important;
    }
    
    .brake-hero .hero-info-card .fw-semibold,
    .brake-hero .hero-info-card .fw-bold {
        color: #212529 !important;
    }
    
    /* Ensure actions & resources section maintains proper contrast in dark mode */
    .brake-hero .actions-resources-hub {
        background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%) !important;
        color: #212529 !important;
    }
    
    .brake-hero .actions-resources-hub,
    .brake-hero .actions-resources-hub * {
        color: #212529 !important;
    }
    
    .brake-hero .actions-resources-hub .text-muted {
        color: #6c757d !important;
    }
    
    .dimension-search-form {
        background: #2d3748;
        color: white;
    }
    
    .part-card {
        background: #2d3748;
        color: white;
        border: 1px solid #4a5568;
    }
    
    .part-card-header {
        background: #4a5568;
        border-bottom-color: #718096;
    }
    
    .spec-item {
        background: #4a5568;
    }
    
    #terminal-viewer {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        border-color: #718096;
    }
}

/* Accessibility enhancements */
@media (prefers-reduced-motion: reduce) {
    .part-card,
    .cross-ref-badge,
    .viewer-control-btn {
        transition: none;
    }
    
    .part-card:hover {
        transform: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .part-card {
        border: 2px solid #000;
    }
    
    .market-badge.automotive {
        background: #000;
        color: #fff;
    }
    
    .market-badge.trailer {
        background: #000;
        color: #fff;
    }
    
    .spec-value {
        color: #000;
    }
}