/* 3D Product Gallery - Frontend Styles */

.tpg-gallery-container {
    display: grid;
    grid-template-columns: 130px 1fr;
    max-width: 500px;
    height: auto;
    background: #fff;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.tpg-thumbnails {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px 10px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    overflow-y: hidden;
    overflow-x: hidden;
    max-height: 500px;
}

.tpg-thumbnails::-webkit-scrollbar {
    display: none;
}

.tpg-thumbnail {
    width: 100px;
    height: 100px;
    border-radius: 0;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: #acdbe7; /* Thumbnail arka plan rengi */
}

.tpg-thumbnail:hover {
    border-color: #ddd;
    transform: scale(1.05);
}

.tpg-thumbnail.tpg-active {
    border-color: #333;
}

.tpg-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: auto;
}

.tpg-main-display {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; 
}

.tpg-main-image-container {
    width: 100%;
    max-width: 700px;
    height: 500px;
    border-radius: 0;
    overflow: hidden; 
    position: relative;
    background: #acdbe7; /* 3D viewer arka plan rengi */
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpg-main-image-container img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain; 
    transition: opacity 0.3s ease;
}

/* Loading Overlay */
.tpg-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10;
    animation: tpgFadeIn 0.2s ease;
}
.tpg-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(0, 0, 0, 0.08);
    border-top-color: #1d1d1f;
    border-radius: 50%;
    animation: tpgSpin 0.9s linear infinite;
}
.tpg-loading-text {
    font-size: 13px;
    font-weight: 500;
    color: #1d1d1f;
    letter-spacing: -0.01em;
}
.tpg-loading-progress {
    width: 180px;
    height: 4px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 2px;
    overflow: hidden;
}
.tpg-loading-progress-bar {
    height: 100%;
    width: 0%;
    background: #1d1d1f;
    border-radius: 2px;
    transition: width 0.2s ease;
}
@keyframes tpgSpin {
    to { transform: rotate(360deg); }
}
@keyframes tpgFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#tpg-viewer-3d {
    width: 100%;
    height: 100%;
    display: none;
}

#tpg-viewer-3d.tpg-active {
    display: block;
}

#tpg-main-image.tpg-active {
    display: block;
}

#tpg-main-image.tpg-hidden {
    display: none;
}

/* 3D Kontrol Butonları */
.tpg-control-btn {
    position: absolute !important;
    top: 0 !important;
    width: 40px !important;
    height: 40px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
}

.tpg-control-btn:hover {
    background: #fff !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
}

.tpg-control-btn.tpg-active {
    display: flex !important;
}

#tpg-reset-btn {
    left: 0 !important;
}

#tpg-play-pause-btn {
    right: 0 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tpg-gallery-container {
        display: flex;
        flex-direction: column-reverse; /* Thumbnail'lar SONRA gelecek */
        max-width: 100%;
    }

    .tpg-thumbnails {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 15px;
        border-right: none;
        border-top: 1px solid #e0e0e0;
        max-height: none;
        gap: 10px;
    }

    .tpg-thumbnail {
        min-width: 90px;
        width: 90px;
        height: 90px;
        flex-shrink: 0;
        margin: 0;
    }

    .tpg-main-display {
        padding: 0;
    }

    .tpg-main-image-container {
        width: 100vw;
        height: 100vw; /* Kare yapıyoruz */
        max-width: 100vw;
        max-height: 100vw;
        border-radius: 0;
    }
    
    .tpg-main-image-container img {
        padding: 0 20px; /* ✅ Sağ sol padding */
        box-sizing: border-box;
    }
}

/* Loading Animation */
.tpg-loading {
    opacity: 0.5;
}

@keyframes tpgFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.tpg-fade-in {
    animation: tpgFadeIn 0.3s ease;
}
