/* Product Detail Modal Styles */

/* Modal Overlay */
.product-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    overflow-y: auto;
    backdrop-filter: blur(4px);
}

.product-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modal Content */
.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Header */
.modal-header {
    position: sticky;
    top: 0;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    border-radius: 12px 12px 0 0;
}

.modal-title {
    color: #2c5aa0;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #2c5aa0;
    transform: rotate(90deg);
}

/* Modal Body */
.modal-body {
    padding: 2rem;
}

/* Product Header */
.product-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.product-header h2 {
    color: #2c5aa0;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.product-header p {
    color: #666;
    font-size: 1rem;
    margin: 0;
}

/* Image Gallery */
.image-gallery {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.main-image {
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

/* .main-image img:hover {
    transform: scale(1.05);
} */

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.thumbnail {
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1;
    background: #f8f9fa;
}

.thumbnail:hover {
    border-color: #2c5aa0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.15);
}

.thumbnail.active {
    border-color: #2c5aa0;
    box-shadow: 0 0 0 2px rgba(44, 90, 160, 0.2);
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Quick Links */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    font-weight: 500;
}

.quick-link:hover {
    background: #2c5aa0;
    color: white;
    border-color: #2c5aa0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.2);
}

.quick-link i {
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

/* Sub Navigation */
.sub-nav {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.sub-nav-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    color: #666;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    flex: 1;
    text-align: center;
    background: transparent;
}

.sub-nav-item:hover {
    color: #2c5aa0;
    background: rgba(44, 90, 160, 0.05);
}

.sub-nav-item.active {
    color: #2c5aa0;
    border-bottom-color: #2c5aa0;
    background: white;
    font-weight: 600;
}

/* Spec Section */
.spec-section {
    margin-bottom: 3rem;
    scroll-margin-top: 2rem;
}

.spec-section h4 {
    color: #2c5aa0;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #2c5aa0;
    font-weight: 600;
}

/* Spec Table */
.spec-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.spec-table th,
.spec-table td {
    padding: 1rem;
    text-align: left;
    border: 1px solid #e0e0e0;
}

.spec-table thead th {
    background: #2c5aa0;
    color: white;
    font-weight: 600;
    text-align: center;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spec-table tbody th {
    background: #f8f9fa;
    font-weight: 500;
    width: 40%;
    color: #333;
}

.spec-table tbody td {
    text-align: center;
    font-weight: 500;
    color: #555;
}

.spec-table tbody tr:hover {
    background: #f8f9fa;
}

.spec-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.spec-table tbody tr:nth-child(even):hover {
    background: #f0f0f0;
}

/* Comparison Table (for multiple models) */
.spec-table.comparison thead th:not(:first-child):not(:nth-child(2)) {
    background: #1e3a5f;
    font-style: italic;
}

/* Notes */
.notes {
    background: #fff9e6;
    border-left: 4px solid #ffc107;
    padding: 1.5rem;
    margin-top: 2rem;
    border-radius: 0 8px 8px 0;
}

.notes h5 {
    color: #f57c00;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.note-item {
    margin-bottom: 0.75rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.note-item:last-child {
    margin-bottom: 0;
}

.note-marker {
    color: #f57c00;
    font-weight: bold;
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.note-text {
    line-height: 1.5;
}

/* Loading State */
.modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #666;
}

.modal-loading i {
    font-size: 2rem;
    margin-right: 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error State */
.modal-error {
    text-align: center;
    padding: 3rem;
    color: #dc3545;
}

.modal-error i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #dc3545;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-modal.active {
        padding: 1rem;
    }
    
    .modal-content {
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .image-gallery {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .thumbnail-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .sub-nav {
        flex-direction: column;
        gap: 0;
    }
    
    .sub-nav-item {
        text-align: left;
        border-bottom: 1px solid #e0e0e0;
        border-radius: 0;
    }
    
    .sub-nav-item:last-child {
        border-bottom: none;
    }
    
    .spec-table {
        font-size: 0.9rem;
    }
    
    .spec-table th,
    .spec-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .quick-links {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .product-modal.active {
        padding: 0.5rem;
    }
    
    .modal-content {
        border-radius: 6px;
    }
    
    .spec-table {
        font-size: 0.8rem;
    }
    
    .spec-table th,
    .spec-table td {
        padding: 0.5rem 0.25rem;
    }
    
    .product-header h2 {
        font-size: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .product-modal {
        display: block !important;
        position: static;
        background: white;
    }
    
    .modal-content {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .modal-header {
        position: static;
    }
    
    .modal-close {
        display: none;
    }
    
    .thumbnail-grid {
        display: none;
    }
}

/* Encoder Diagram */
.encoder-diagram {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Gearhead Diagram */
.gearhead-diagram {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Gearhead Tables */
.gearhead-model-section {
    margin-bottom: 2rem;
}

.gearhead-model-section h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    border-left: 4px solid var(--accent);
}

.gearhead-table {
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.gearhead-table th {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
    text-align: center;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.gearhead-table td {
    padding: 0.75rem 0.5rem;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.gearhead-table th:first-child,
.gearhead-table td:first-child {
    text-align: left;
    font-weight: 600;
    background: #f8f9fa;
}

/* Responsive adjustments for gearhead tables */
@media (max-width: 768px) {
    .gearhead-table {
        font-size: 0.75rem;
    }
    
    .gearhead-table th,
    .gearhead-table td {
        padding: 0.5rem 0.25rem;
    }
}
