/* Scientific Gallery Enhanced Styles */

.scientific-gallery {
    padding: 60px 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.gallery-header {
    text-align: center;
    margin-bottom: 60px;
    padding: 0 20px;
}

.gallery-header h1 {
    color: #2c3e50;
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    font-weight: 300;
}

.gallery-header p {
    font-size: 1.3em;
    color: #5a6c7d;
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Search and Filter Section */
.search-filter-section {
    background: rgba(255,255,255,0.9);
    padding: 40px 0;
    margin-bottom: 50px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.search-box {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    padding: 0 20px;
}

.search-box input {
    width: 100%;
    padding: 18px 60px 18px 25px;
    border: 3px solid #e8ecef;
    border-radius: 50px;
    font-size: 16px;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.search-box input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 4px 25px rgba(52, 152, 219, 0.2);
}

.search-box button {
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: none;
    color: white;
    padding: 12px 18px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.search-box button:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

/* Category Filters */
.category-filters {
    text-align: center;
    margin-bottom: 50px;
    padding: 0 20px;
}

.category-filters ul {
    list-style: none;
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0;
    padding: 0;
    gap: 15px;
}

.category-filters li {
    margin: 0;
}

.category-filters a {
    display: block;
    padding: 12px 24px;
    background: rgba(255,255,255,0.9);
    color: #2c3e50;
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 2px solid transparent;
}

.category-filters a:hover,
.category-filters a.active {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    border-color: #2980b9;
}

/* Specimens Grid */
.specimens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 35px;
    margin-bottom: 60px;
    padding: 0 20px;
}

.specimen-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    overflow: hidden;
    transition: all 0.4s ease;
    position: relative;
}

.specimen-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3498db, #e74c3c, #27ae60, #f39c12);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.specimen-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
}

.specimen-card:hover::before {
    opacity: 1;
}

/* Specimen Images */
.specimen-images {
    position: relative;
    height: 280px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.specimen-images img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.4s ease;
}

.specimen-card:hover .specimen-images img {
    transform: scale(1.08);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.9), rgba(155, 89, 182, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.4s ease;
}

.specimen-card:hover .image-overlay {
    opacity: 1;
}

.overlay-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.overlay-btn {
    padding: 12px 18px;
    background: rgba(255,255,255,0.95);
    color: #2c3e50;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border: 2px solid transparent;
}

.overlay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.overlay-btn.optical {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.overlay-btn.ct-scan {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.overlay-btn.model-3d {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
}

/* Specimen Info */
.specimen-info {
    padding: 30px;
}

.specimen-info h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.5em;
    font-weight: 600;
    line-height: 1.3;
}

.specimen-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #3498db;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #5a6c7d;
}

.meta-item strong {
    color: #2c3e50;
    font-weight: 600;
    min-width: 45px;
}

.specimen-description {
    line-height: 1.7;
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.05em;
}

.specimen-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: linear-gradient(135deg, #e8ecef, #d5dbdb);
    color: #2c3e50;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.tag:hover {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    transform: scale(1.05);
}

/* 3D Model Viewer Modal */
.model-viewer-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    backdrop-filter: blur(5px);
}

.model-viewer-content {
    position: relative;
    margin: 3% auto;
    width: 95%;
    height: 90%;
    max-width: 1400px;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.model-viewer-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.model-viewer-header h3 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 300;
}

.close-model-viewer {
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-model-viewer:hover {
    background: rgba(255,255,255,0.2);
    transform: rotate(90deg);
}

.model-viewer-container {
    background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
    height: calc(100% - 90px);
    position: relative;
    overflow: hidden;
}

#three-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.model-controls {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    padding: 20px;
    border-radius: 15px;
    display: flex;
    gap: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.model-controls button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.model-controls button:hover {
    background: linear-gradient(135deg, #2980b9, #1f4e79);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

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

/* Loading Animation */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .specimens-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .gallery-header h1 {
        font-size: 2.2em;
    }

    .gallery-header p {
        font-size: 1.1em;
    }

    .specimens-grid {
        grid-template-columns: 1fr;
        gap: 25px;
        padding: 0 15px;
    }

    .specimen-meta {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .category-filters ul {
        flex-direction: column;
        align-items: center;
    }

    .overlay-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .overlay-btn {
        padding: 10px 15px;
        font-size: 13px;
    }

    .model-viewer-content {
        margin: 1% auto;
        width: 98%;
        height: 95%;
    }

    .model-controls {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }

    .model-controls button {
        padding: 10px 15px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .scientific-gallery {
        padding: 40px 0;
    }

    .gallery-header {
        margin-bottom: 40px;
    }

    .search-filter-section {
        padding: 30px 0;
    }

    .search-box {
        padding: 0 15px;
    }

    .search-box input {
        padding: 15px 50px 15px 20px;
        font-size: 15px;
    }

    .category-filters {
        padding: 0 15px;
    }

    .specimen-info {
        padding: 25px 20px;
    }

    .specimen-images {
        height: 240px;
    }
}

/* Print Styles */
@media print {
    .model-viewer-modal,
    .overlay-buttons,
    .model-controls {
        display: none !important;
    }

    .scientific-gallery {
        background: white;
    }

    .specimen-card {
        break-inside: avoid;
        margin-bottom: 20px;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .specimen-card {
        border: 2px solid #000;
    }

    .overlay-btn {
        border: 2px solid #000;
    }

    .tag {
        border: 1px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
