/* 3D Gallery Grid */
.gallery-grid-3d {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Individual 3D Card */
.gallery-card-3d {
    background: #ffffff;
    border: 6px solid #1a1a1a;
    border-radius: 0;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow:
        6px 6px 0 rgba(0, 0, 0, 0.1),
        0 4px 20px rgba(0, 0, 0, 0.1);
}

.gallery-card-3d:hover {
    transform: translateY(-8px) translateX(-4px);
    box-shadow:
        10px 10px 0 rgba(0, 0, 0, 0.1),
        0 12px 40px rgba(0, 0, 0, 0.2);
}

/* Card Media Container */
.card-media {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 aspect ratio */
    background: #f0f0f0;
    overflow: hidden;
}

.card-thumbnail,
.card-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.card-video {
    opacity: 0;
    pointer-events: none;
}

.gallery-card-3d:hover .card-video {
    opacity: 1;
}

.gallery-card-3d:hover .card-thumbnail {
    opacity: 0;
}

/* View in 3D Badge */
.view-3d-badge {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid white;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.gallery-card-3d:hover .view-3d-badge {
    opacity: 1;
    transform: translateY(0);
}

/* Card Info */
.card-info {
    padding: 1.5rem;
    background: white;
}

.card-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
    font-weight: 600;
}

.card-info p {
    font-size: 1rem;
    color: #666;
    line-height: 1.5;
}

/* 3D Viewer Modal */
.viewer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.viewer-modal.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.viewer-container {
    width: 90vw;
    height: 90vh;
    max-width: 1400px;
    background: #1a1a1a;
    border: 6px solid #f4e8d0;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.viewer-close {
    position: absolute;
    top: -3px; /* Moved up to -3px from -2px */
    right: 1rem;
    background: #ff6b35;
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    font-size: 2rem;
    font-weight: 700;
    cursor: pointer;
    z-index: 1001;
    box-shadow: none;
    transition: background 0.2s ease;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-close:hover {
    background: #ffffff;
}

/* Tab Navigation */
.viewer-tabs {
    display: flex;
    gap: 0;
    background: #2a2a2a;
    border-bottom: 3px solid #f4e8d0;
    position: relative;
    height: 60px;
    border-top: none; /* Remove duplicate border */
}

.viewer-tab {
    flex: 1;
    padding: 0 1rem;
    background: #2a2a2a;
    color: #cccccc;
    border: none;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
    border-right: 2px solid #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-tab:last-child {
    border-right: none;
}

.viewer-tab:hover {
    background: #3a3a3a;
    color: #ffffff;
}

.viewer-tab.active {
    background: #f4e8d0;
    color: #1a1a1a;
}

/* Disabled Tab Styles */
.viewer-tab.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: line-through;
}

.viewer-tab.disabled:hover {
    background: #2a2a2a;
    color: #cccccc;
}

/* Tab Content */
.viewer-tab-content {
    display: none;
    flex: 1;
    overflow: auto;
}

.viewer-tab-content.active {
    display: flex;
    flex-direction: column;
}

#tab-explore {
    /* Same as before - canvas viewer */
}

#tab-about {
    padding: 2rem;
    background: #1a1a1a;
    color: #f4e8d0;
    overflow-y: auto;
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-content h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #f4e8d0;
    border-bottom: 3px solid #f4e8d0;
    padding-bottom: 0.5rem;
}

.about-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1rem;
    color: #cccccc;
}

.about-content strong {
    color: #f4e8d0;
    font-weight: 700;
}

/* Dark Mode Styles */
body.dark-mode .gallery-card-3d {
    background: #2a2a2a;
    border-color: #f4e8d0;
}

body.dark-mode .card-info {
    background: #2a2a2a;
}

body.dark-mode .card-info h3 {
    color: #ffffff;
}

body.dark-mode .card-info p {
    color: #cccccc;
}

/* Viewer Canvas Wrapper */
.viewer-canvas-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a; /* Dark background for canvas area */
}

#viewer-canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Message for when 3D model is not available */
.viewer-canvas-wrapper::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #f4e8d0;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

/* Show message when canvas is hidden */
.viewer-canvas-wrapper.no-model::after {
    content: '3D model not available for this design.\ASee the "About" tab for details.';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #f4e8d0;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    white-space: pre-wrap;
    max-width: 80%;
    line-height: 1.6;
}

.viewer-canvas-wrapper.no-model #viewer-canvas {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .gallery-grid-3d {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem;
    }

    .viewer-container {
        width: 95vw;
        height: 85vh;
    }

    .viewer-close {
        top: -3px; /* Same adjustment for mobile */
        right: 0.5rem;
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        border: none;
    }

    .viewer-tabs {
        height: 50px;
    }

    .viewer-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}
