/* Specifications Overlay Container */
.spec-overlay {
    position: absolute;
    z-index: 10;
    padding: 0.75rem;
    /* Background can be set via inline style, default to transparent */
    /* backdrop-filter removed - only apply blur if background is not transparent */
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 280px;
    max-height: 80%;
    overflow-y: auto;
    /* Enhanced fade-in animation on page load */
    animation: fadeInOverlay 0.6s ease-out;
    /* Smooth transitions for all properties */
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease, background-color 0.3s ease;
}

/* Enhanced fade-in animation with slight delay */
@keyframes fadeInOverlay {
    0% {
        opacity: 0;
        transform: translateY(-15px) scale(0.95);
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Hover effects for overlay */
.spec-overlay:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.2);
}

/* Smooth transitions for overlay content */
.spec-overlay-content {
    transition: background-color 0.3s ease, color 0.3s ease, border-radius 0.3s ease, opacity 0.3s ease;
}

/* Position Variants with smooth transitions */
.spec-overlay-left {
    top: 20px;
    left: 20px;
}

.spec-overlay-left:hover {
    transform: translateY(-2px) scale(1.02) translateX(-2px);
}

.spec-overlay-right {
    top: 20px;
    right: 20px;
}

.spec-overlay-right:hover {
    transform: translateY(-2px) scale(1.02) translateX(2px);
}

.spec-overlay-top {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90%;
}

.spec-overlay-top:hover {
    transform: translateX(-50%) translateY(-2px) scale(1.02);
}

.spec-overlay-bottom {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90%;
}

.spec-overlay-bottom:hover {
    transform: translateX(-50%) translateY(2px) scale(1.02);
}

.spec-overlay-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spec-overlay-center:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

/* Custom Positioning Support */
.spec-overlay[style*="left:"][style*="top:"] {
    /* Custom positioning - styles applied inline */
    /* Override preset positioning when custom coordinates are used */
}

/* Ensure custom positioning works with percentage values */
.spec-overlay[style*="left:"]:not(.spec-overlay-left):not(.spec-overlay-right):not(.spec-overlay-top):not(.spec-overlay-bottom):not(.spec-overlay-center) {
    /* Custom positioned overlay - no preset class */
    transform: none !important;
}

/* Overlay Content */
.spec-overlay-content {
    color: #333;
    transition: background-color 0.3s ease, color 0.3s ease, border-radius 0.3s ease, opacity 0.3s ease;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Apply backdrop blur only when background is not transparent */
.spec-overlay-content:not([style*="background: none"]):not([style*="background-color: transparent"]) {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.spec-overlay-title {
    font-weight: 700;
    color: #2c3e50;
    font-size: 1.1rem;
    border-bottom: 2px solid #3498db;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    transition: color 0.3s ease, border-bottom-color 0.3s ease;
}

/* Hover effect on title */
.spec-overlay:hover .spec-overlay-title {
    color: #2980b9;
    border-bottom-color: #2980b9;
}

.spec-overlay-list {
    margin-top: 0.5rem;
}

.spec-overlay-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e0e0e0;
    gap: 0.75rem;
    transition: background-color 0.2s ease, padding 0.2s ease, transform 0.2s ease;
    border-radius: 4px;
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.spec-overlay-item:last-child {
    border-bottom: none;
}

/* Hover effect on items */
.spec-overlay-item:hover {
    background-color: rgba(52, 152, 219, 0.1);
    transform: translateX(4px);
    padding-left: 0.75rem;
}

[dir="rtl"] .spec-overlay-item:hover {
    transform: translateX(-4px);
}

.spec-key {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
    flex: 0 0 auto;
    min-width: 0;
    line-height: 1.3;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    transition: color 0.2s ease, font-size 0.2s ease;
}

.spec-value {
    font-size: 0.8rem;
    color: #2c3e50;
    font-weight: 600;
    text-align: right;
    flex: 1;
    min-width: 0;
    line-height: 1.3;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    transition: color 0.2s ease, font-size 0.2s ease, transform 0.2s ease;
}

/* Hover effects on spec items */
.spec-overlay-item:hover .spec-key {
    color: #3498db;
}

.spec-overlay-item:hover .spec-value {
    color: #2980b9;
    transform: scale(1.05);
}

/* RTL Support */
[dir="rtl"] .spec-overlay-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .spec-value {
    text-align: left;
}

[dir="rtl"] .spec-key {
    text-align: right;
}

[dir="rtl"] .spec-overlay-left {
    left: auto;
    right: 20px;
}

[dir="rtl"] .spec-overlay-right {
    right: auto;
    left: 20px;
}

/* Responsive Design */
@media (max-width: 767px) {
    /* On mobile, move overlay outside image container to appear below */
    .spec-overlay {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 1rem 0 0 0 !important;
        padding: 1rem;
        font-size: 0.9rem;
        max-height: none;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .spec-overlay-left,
    .spec-overlay-right,
    .spec-overlay-top,
    .spec-overlay-bottom,
    .spec-overlay-center {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        margin: 1rem 0 0 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* Allow card to show overlay below on mobile */
    .card.position-relative {
        overflow: visible;
    }
    
    .spec-overlay-title {
        font-size: 1rem;
    }
    
    .spec-key {
        font-size: 0.8rem;
    }
    
    .spec-value {
        font-size: 0.85rem;
    }
}

/* Dark Mode Support (if applicable) */
@media (prefers-color-scheme: dark) {
    .spec-overlay {
        background: rgba(30, 30, 30, 0.95);
        color: #fff;
    }
    
    .spec-overlay-title {
        color: #fff;
        border-bottom-color: #3498db;
    }
    
    .spec-key {
        color: #bbb;
    }
    
    .spec-value {
        color: #fff;
    }
    
    .spec-overlay-item {
        border-bottom-color: #444;
    }
}

/* Scrollbar Styling for Overlay */
.spec-overlay::-webkit-scrollbar {
    width: 6px;
}

.spec-overlay::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.spec-overlay::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.spec-overlay::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    transition: background 0.2s ease;
}

.spec-overlay::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Staggered animation for items (optional enhancement) */
.spec-overlay-item {
    animation: fadeInItem 0.4s ease-out backwards;
}

.spec-overlay-item:nth-child(1) { animation-delay: 0.1s; }
.spec-overlay-item:nth-child(2) { animation-delay: 0.15s; }
.spec-overlay-item:nth-child(3) { animation-delay: 0.2s; }
.spec-overlay-item:nth-child(4) { animation-delay: 0.25s; }
.spec-overlay-item:nth-child(5) { animation-delay: 0.3s; }
.spec-overlay-item:nth-child(n+6) { animation-delay: 0.35s; }

@keyframes fadeInItem {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

[dir="rtl"] .spec-overlay-item {
    animation: fadeInItemRTL 0.4s ease-out backwards;
}

@keyframes fadeInItemRTL {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .spec-overlay,
    .spec-overlay-content,
    .spec-overlay-item,
    .spec-key,
    .spec-value,
    .spec-overlay-title {
        animation: none !important;
        transition: none !important;
    }
    
    .spec-overlay:hover {
        transform: none !important;
    }
    
    .spec-overlay-item:hover {
        transform: none !important;
    }
}


