/**
 * Enhanced Product Details Modal Styles
 * Requirements: 3.1, 3.2, 3.4
 */

/* Product Detail Modal Styles */
.product-detail-modal {
    z-index: 10500 !important;
}

.product-detail-modal .modal-dialog {
    max-width: 1200px;
    margin: 1.75rem auto;
    z-index: 10500 !important;
    transform: scale(0.7) translateY(-50px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Modal entrance animation */
.product-detail-modal.show .modal-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Modal exit animation */
.product-detail-modal.fade:not(.show) .modal-dialog {
    transform: scale(0.8) translateY(30px);
    opacity: 0;
    transition: all 0.3s ease-out;
}

.product-detail-modal .modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: modalContentFadeIn 0.5s ease-out 0.2s both;
}

@keyframes modalContentFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-detail-modal .modal-backdrop {
    z-index: 10400 !important;
}

.modal-backdrop.show {
    z-index: 10400 !important;
    animation: backdropFadeIn 0.3s ease-out;
}

@keyframes backdropFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 0.5;
    }
}

.product-detail-modal .modal-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-radius: 0;
    padding: 20px 30px;
    border-bottom: none;
    animation: slideDownFade 0.6s ease-out 0.3s both;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-detail-modal .modal-header .btn-close {
    display: none !important; /* Hide close button */
}

.product-detail-modal .modal-title {
    font-size: 2.25rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    text-align: center;
    padding: 0.5rem 0;
    animation: titleBounce 0.8s ease-out 0.4s both;
}

@keyframes titleBounce {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Product Image Gallery */
.product-image-gallery {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    animation: fadeInLeft 0.6s ease-out 0.5s both;
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.product-main-image {
    border-radius: 12px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    width: 100%;
    height: 450px;
    object-fit: contain !important;
    background: white;
    padding: 15px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    animation: imageZoomIn 0.7s ease-out 0.6s both;
}

@keyframes imageZoomIn {
    from {
        opacity: 0;
        transform: scale(0.8) rotate(-2deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.product-main-image:hover {
    transform: scale(1.05) rotate(1deg);
    box-shadow: 0 16px 40px rgba(40, 167, 69, 0.25);
}

.main-image-container {
    border-radius: 12px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 450px;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Remove placeholder icon */
.main-image-container::before,
.main-image-container::after {
    display: none !important;
    content: none !important;
}

.main-image-container {
    background-image: none !important;
    background-color: white !important;
}

.main-image-container img {
    max-width: 100%;
    max-height: 100%;
    background: transparent !important;
}

/* Remove any placeholder backgrounds */
.product-main-image::before,
.product-main-image::after {
    display: none !important;
    content: none !important;
}

.product-image-gallery::before,
.product-image-gallery::after {
    display: none !important;
    content: none !important;
}

/* Hide any icon placeholders */
.main-image-container i,
.main-image-container .fa,
.main-image-container .fas,
.main-image-container .far,
.main-image-container svg {
    display: none !important;
}

/* Ensure only the img tag is visible */
.main-image-container > *:not(img):not(.image-zoom-hint) {
    display: none !important;
}

.image-zoom-hint {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.main-image-container:hover .image-zoom-hint {
    opacity: 1;
}

.thumbnail-image {
    border-radius: 8px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0.6;
    filter: grayscale(30%);
    cursor: pointer;
}

.thumbnail-image:hover {
    opacity: 0.9;
    transform: scale(1.1) rotate(2deg);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.3);
    filter: grayscale(0%);
}

.thumbnail-image.active {
    opacity: 1;
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
    border: 3px solid #28a745;
    filter: grayscale(0%);
}

/* Product Info Section */
.product-info {
    background: white;
    padding: 30px !important;
    animation: fadeInRight 0.6s ease-out 0.5s both;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.product-title {
    font-size: 2rem;
    line-height: 1.3;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 20px;
}

.product-badges .badge {
    font-size: 0.95rem;
    padding: 10px 16px;
    border-radius: 25px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-right: 8px;
}

/* Tab Styles */
.nav-pills .nav-link {
    border-radius: 30px;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: #6c757d;
    padding: 12px 20px;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.nav-pills .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #28a745, #20c997);
    transform: translateX(-50%);
    transition: width 0.4s ease;
}

.nav-pills .nav-link:hover {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border-color: rgba(40, 167, 69, 0.3);
    transform: translateY(-3px) scale(1.05);
}

.nav-pills .nav-link:hover::after {
    width: 80%;
}

.nav-pills .nav-link.active {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
    border-color: transparent;
    transform: scale(1.08);
}

.nav-pills .nav-link.active::after {
    width: 0;
}

.tab-content {
    min-height: 200px;
}

.tab-pane {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Product Meta Information */
.product-meta {
    border-top: 1px solid #e9ecef;
    padding-top: 15px;
    margin-top: 15px;
}

/* Modal Footer */
.product-detail-modal .modal-footer {
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    border-top: 1px solid #e9ecef;
    padding: 20px 30px;
    animation: slideUpFade 0.6s ease-out 0.7s both;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-detail-modal .modal-footer .btn {
    border-radius: 30px;
    font-weight: 600;
    padding: 12px 24px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.product-detail-modal .modal-footer .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.product-detail-modal .modal-footer .btn:hover::before {
    width: 300px;
    height: 300px;
}

.product-detail-modal .modal-footer .btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.product-detail-modal .modal-footer .btn:active {
    transform: translateY(-1px) scale(1.02);
    transition: all 0.1s ease;
}

.product-detail-modal .modal-footer .btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    animation: buttonPulse 2s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(40, 167, 69, 0.5);
    }
}

.product-detail-modal .modal-footer .btn-success:hover {
    background: linear-gradient(135deg, #218838 0%, #1aa179 100%);
    animation: none;
}

.product-detail-modal .modal-footer .btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    border: none;
    font-weight: 600;
}

.product-detail-modal .modal-footer .btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #545b62 100%);
}

/* Image Zoom Modal Styles */
#imageZoomModal {
    z-index: 10600 !important;
}

#imageZoomModal .modal-content {
    background: rgba(0, 0, 0, 0.95);
    border: none;
}

#imageZoomModal .modal-header {
    background: transparent;
    border: none;
}

#imageZoomModal .modal-backdrop {
    z-index: 10550 !important;
}

.zoom-controls {
    display: flex;
    align-items: center;
}

.zoom-controls .btn {
    border-radius: 20px;
    padding: 5px 10px;
    transition: all 0.3s ease;
}

.zoom-controls .btn:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.zoom-controls .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.zoom-controls #zoomLevel {
    min-width: 50px;
    text-align: center;
    font-weight: 500;
}

.zoomable-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    transition: transform 0.3s ease, opacity 0.3s ease;
    cursor: zoom-in;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.zoomable-image:hover {
    cursor: grab;
}

.zoomable-image:active {
    cursor: grabbing;
}

.zoomable-image.zoomed {
    cursor: grab;
}

.zoomable-image.dragging {
    cursor: grabbing;
}

.image-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    overflow: hidden;
}

.image-navigation .btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.image-navigation .btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Loading Animation */
.product-loading {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.product-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

.product-loading-text {
    margin-top: 20px;
    font-size: 1.1rem;
    color: #6c757d;
    font-weight: 500;
}

/* Smooth fade-in animation for content */
.product-content {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal entrance animation */
.product-detail-modal.show .modal-dialog {
    animation: modalSlideIn 0.4s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-detail-modal .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .product-detail-modal .modal-content {
        border-radius: 15px;
    }
    
    .product-detail-modal .modal-header {
        padding: 15px 20px;
    }
    
    .product-detail-modal .modal-title {
        font-size: 1.75rem;
        padding: 0.5rem 0;
        text-align: center;
        width: 100%;
    }
    
    .product-image-gallery {
        padding: 15px;
    }
    
    .product-main-image {
        height: 300px !important;
        padding: 10px;
    }
    
    .main-image-container {
        min-height: 300px;
    }
    
    .product-info {
        padding: 20px !important;
    }
    
    .product-title {
        font-size: 1.5rem;
    }
    
    .product-badges .badge {
        font-size: 0.85rem;
        padding: 8px 12px;
        margin-bottom: 5px;
    }
    
    .nav-pills .nav-link {
        font-size: 0.9rem;
        padding: 10px 15px;
    }
    
    .modal-footer .btn {
        font-size: 0.95rem;
        padding: 10px 16px;
    }
    
    .zoom-controls {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .image-navigation .btn {
        width: 44px;
        height: 44px;
    }
    
    /* Stack image and info vertically on mobile */
    .product-detail-modal .row.g-0 {
        flex-direction: column;
    }
    
    .product-detail-modal .col-lg-6 {
        width: 100%;
        border: none !important;
    }
}

@media (max-width: 576px) {
    .product-detail-modal .modal-dialog {
        margin: 5px;
        max-width: calc(100% - 10px);
    }
    
    .product-main-image {
        height: 200px !important;
    }
    
    .thumbnail-image {
        height: 50px !important;
    }
    
    .product-title {
        font-size: 1.2rem;
    }
    
    .nav-pills {
        flex-direction: column;
    }
    
    .nav-pills .nav-link {
        text-align: center;
        margin-bottom: 5px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .product-main-image:hover {
        transform: none;
    }
    
    .thumbnail-image:hover {
        transform: none;
    }
    
    .image-zoom-hint {
        opacity: 1;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .product-detail-modal .modal-content {
        border: 2px solid #000;
    }
    
    .nav-pills .nav-link {
        border: 1px solid #000;
    }
    
    .thumbnail-image {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .product-main-image,
    .thumbnail-image,
    .nav-pills .nav-link,
    .zoomable-image,
    .image-navigation .btn {
        transition: none;
    }
    
    .tab-pane {
        animation: none;
    }
    
    @keyframes fadeIn {
        from { opacity: 1; transform: none; }
        to { opacity: 1; transform: none; }
    }
}

/* Enhanced Specifications and Usage Styles */
.specifications-grid .spec-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
    transition: all 0.3s ease;
}

.specifications-grid .spec-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.category-specs {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.category-usage {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.usage-steps .step-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.usage-steps .step-item:hover {
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.1);
    transform: translateY(-2px);
}

.usage-steps .badge {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.general-guidelines ul li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.general-guidelines ul li:last-child {
    border-bottom: none;
}

.expert-consultation .alert {
    border-left: 4px solid #17a2b8;
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
}

/* Tab content animations */
.tab-pane .spec-item,
.tab-pane .step-item {
    animation: slideInUp 0.4s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.tab-pane.show .spec-item,
.tab-pane.show .step-item {
    animation-delay: calc(var(--item-index, 0) * 0.1s);
}

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Print styles */
@media print {
    .product-detail-modal {
        display: none !important;
    }
    
    #imageZoomModal {
        display: none !important;
    }
}