/* Product Quick View Popup - Updated to match example */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.popup-overlay p {
    margin-top: 0;
    margin-bottom: 0;
}

/* Popup Overlay */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.popup-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Popup Content */
.popup-content {
    position: relative;
    width: 95vw;
    max-width: 672px;
    max-height: 95vh;
    background: white;
    border-radius: 24px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Close Button */
.close-button {
    position: absolute;
    right: 12px;
    top: 12px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-button:hover {
    background: white;
    transform: scale(1.1);
}

/* Product Image */
.product-image {
    position: relative;
    height: 45vh;
    min-height: 300px;
    max-height: 400px;
    width: 100%;
    overflow: hidden;
    background: #e5e7eb;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-gradient {
    position: absolute;
    inset: 0;
}

/* Product Details */
.product-details {
    padding: 3px 12px 12px 12px;
    max-height: calc(95vh - 45vh);
    overflow-y: auto;
    scrollbar-width: none;
}

.product-details::-webkit-scrollbar {
    display: none;
}

/* Title Section */
.title-section {
    margin-bottom: 0;
}

.title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.product-title {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.3;
    min-height: 0;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.product-price {
    font-size: 20px;
    font-weight: 700;
    color: hsl(162, 82%, 35%);
    margin-top: 0;
    margin-bottom: 8px;
}

/* Typing Cursor Animation */
.cursor {
    animation: blink 1s infinite;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    background: rgba(229, 231, 235, 0.3);
    border-radius: 12px;
    padding: 8px;
    margin-top: 0;
    margin-bottom: 8px;
    align-items: start;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0; /* Allow flex items to shrink below their content size */
}

.detail-full {
    grid-column: span 2;
}

.detail-label {
    font-size: 12px;
    font-weight: 700;
    color: hsl(162, 82%, 35%);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-value {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    overflow: hidden;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    line-height: 1.2;
    min-height: 1rem;
    max-height: 2.4rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Responsive font size for long text */
.detail-value.long-text {
    font-size: 12px;
    line-height: 1.1;
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 0;
    margin-bottom: 8px;
}

.action-btn {
    height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

.action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.call-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.whatsapp-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.location-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Similar Products */
.similar-products {
    margin-top: 0;
    padding-top: 8px;
}

.similar-label {
    font-size: 12px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.similar-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.similar-grid::-webkit-scrollbar {
    display: none;
}

.similar-item {
    flex-shrink: 0;
    width: 96px;
    cursor: pointer;
}

.similar-image {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #e5e7eb;
    margin-bottom: 4px;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.similar-item:hover .similar-image {
    border-color: #667eea;
    transform: scale(1.05);
}

.similar-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.similar-item:hover .similar-image img {
    transform: scale(1.1);
}

.similar-title {
    font-size: 12px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.4em;
    margin-bottom: 4px;
}

.similar-price {
    font-size: 12px;
    font-weight: 700;
    color: hsl(162, 82%, 35%);
    margin-top: 2px;
}

/* Loading Bubble */
.loading-bubble {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: transparent;
    display: none;
    align-items: center;
    justify-content: center;
}

.loading-bubble.show {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

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

/* From Uiverse.io by JkHuger */
@keyframes loader_5191 {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.loader {
    position: relative;
    width: 50px;
    height: 50px;
}

.square {
    background: #667eea;
    width: 10px;
    height: 10px;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -5px;
    margin-left: -5px;
    border-radius: 2px;
}

#sq1 {
    margin-top: -25px;
    margin-left: -25px;
    animation: loader_5191 675ms ease-in-out 0s infinite alternate;
}

#sq2 {
    margin-top: -25px;
    animation: loader_5191 675ms ease-in-out 75ms infinite alternate;
}

#sq3 {
    margin-top: -25px;
    margin-left: 15px;
    animation: loader_5191 675ms ease-in-out 150ms infinite;
}

#sq4 {
    margin-left: -25px;
    animation: loader_5191 675ms ease-in-out 225ms infinite;
}

#sq5 {
    animation: loader_5191 675ms ease-in-out 300ms infinite;
}

#sq6 {
    margin-left: 15px;
    animation: loader_5191 675ms ease-in-out 375ms infinite;
}

#sq7 {
    margin-top: 15px;
    margin-left: -25px;
    animation: loader_5191 675ms ease-in-out 450ms infinite;
}

#sq8 {
    margin-top: 15px;
    animation: loader_5191 675ms ease-in-out 525ms infinite;
}

#sq9 {
    margin-top: 15px;
    margin-left: 15px;
    animation: loader_5191 675ms ease-in-out 600ms infinite;
}

.loading-text {
    display: none;
}

/* ===== RESPONSIVE DESIGN ADJUSTMENTS ===== */

/* Extra Small Mobile Devices (320px - 480px) */
@media (max-width: 480px) {
    .popup-content {
        width: 98vw;
        max-height: 98vh;
        border-radius: 16px;
    }
    
    .product-image {
        height: 32vh;
        min-height: 220px;
        max-height: 280px;
    }
    
    .product-details {
        padding: 8px 10px 10px 10px;
        max-height: calc(98vh - 32vh);
    }
    
    .product-title {
        font-size: 16px;
        margin-top: 1.25rem;
        margin-bottom: 0.75rem;
        line-height: 1.2;
    }

    .product-price {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .details-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 6px;
        margin-bottom: 6px;
    }
    
    .detail-value {
        font-size: 11px;
        line-height: 1.1;
    }
    
    .detail-value.long-text {
        font-size: 10px;
    }

    .action-buttons {
        gap: 6px;
        margin-bottom: 6px;
    }

    .action-btn {
        height: 44px;
        font-size: 11px;
        border-radius: 8px;
    }
    
    .similar-products {
        padding-top: 6px;
    }
    
    .similar-item {
        width: 80px;
    }
    
    .close-button {
        width: 28px;
        height: 28px;
        right: 8px;
        top: 8px;
    }
    
    .loader {
        width: 35px;
        height: 35px;
    }
    
    .square {
        width: 8px;
        height: 8px;
        margin-top: -4px;
        margin-left: -4px;
    }
    
    #sq1 {
        margin-top: -20px;
        margin-left: -20px;
    }
    
    #sq2 {
        margin-top: -20px;
    }
    
    #sq3 {
        margin-top: -20px;
        margin-left: 12px;
    }
    
    #sq4 {
        margin-left: -20px;
    }
    
    #sq6 {
        margin-left: 12px;
    }
    
    #sq7 {
        margin-top: 12px;
        margin-left: -20px;
    }
    
    #sq8 {
        margin-top: 12px;
    }
    
    #sq9 {
        margin-top: 12px;
        margin-left: 12px;
    }
}

/* Mobile Devices (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .popup-content {
        width: 96vw;
        max-height: 96vh;
        border-radius: 20px;
    }
    
    .product-image {
        height: 35vh;
        min-height: 250px;
        max-height: 320px;
    }
    
    .product-details {
        padding: 8px 12px 12px 12px;
        max-height: calc(96vh - 35vh);
    }
    
    .product-title {
        font-size: 18px;
        margin-top: 1.5rem;
        margin-bottom: 1rem;
    }

    .product-price {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .details-grid {
        gap: 8px;
        padding: 8px;
    }
    
    .detail-value {
        font-size: 12px;
    }
    
    .detail-value.long-text {
        font-size: 11px;
    }

    .action-btn {
        height: 48px;
        font-size: 12px;
    }
    
    .loader {
        width: 40px;
        height: 40px;
    }
}

/* Tablet Devices Portrait (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .popup-content {
        width: 90vw;
        max-width: 600px;
        max-height: 95vh;
    }
    
    .product-image {
        height: 40vh;
        min-height: 280px;
        max-height: 360px;
    }
    
    .product-details {
        max-height: calc(95vh - 40vh);
    }
    
    .product-title {
        font-size: 19px;
        margin-top: 1.75rem;
        margin-bottom: 1rem;
    }

    .product-price {
        font-size: 19px;
    }

    .action-btn {
        height: 52px;
    }
    
    .similar-item {
        width: 100px;
    }
}

/* Desktop Devices (1025px and above) */
@media (min-width: 1025px) {
    .popup-content {
        width: 85vw;
        max-width: 672px;
        max-height: 95vh;
    }
    
    .product-image {
        height: 45vh;
        min-height: 300px;
        max-height: 400px;
    }
    
    .product-details {
        padding: 3px 12px 12px 12px;
        max-height: calc(95vh - 45vh);
    }
    
    .product-title {
        font-size: 20px;
        margin-top: 2rem;
        margin-bottom: 1rem;
    }

    .product-price {
        font-size: 20px;
    }

    .action-btn {
        height: 56px;
    }
    
    .similar-item {
        width: 96px;
    }
}

/* Large Desktop Devices (1440px and above) */
@media (min-width: 1440px) {
    .popup-content {
        max-width: 720px;
    }
    
    .product-image {
        height: 42vh;
        min-height: 320px;
        max-height: 420px;
    }
    
    .product-details {
        max-height: calc(95vh - 42vh);
    }
}

/* Landscape Orientation Adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .popup-content {
        max-height: 98vh;
    }
    
    .product-image {
        height: 50vh;
        min-height: 200px;
        max-height: 300px;
    }
    
    .product-details {
        max-height: calc(98vh - 50vh);
        padding: 8px 12px 8px 12px;
    }
    
    .product-title {
        margin-top: 1rem;
        margin-bottom: 0.5rem;
        font-size: 18px;
    }
    
    .details-grid {
        margin-bottom: 6px;
    }
    
    .action-buttons {
        margin-bottom: 6px;
    }
    
    .similar-products {
        padding-top: 6px;
    }
}

/* High DPI / Retina Display Adjustments */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .product-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .similar-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .popup-overlay,
    .popup-content,
    .action-btn,
    .similar-item,
    .close-button {
        animation: none;
        transition: none;
    }
    
    .cursor {
        animation: none;
    }
    
    .loader {
        animation: none;
    }
    
    .square {
        animation: none;
        opacity: 0.7;
    }
}

/* Print Styles */
@media print {
    .popup-overlay {
        position: static;
        background: none;
        backdrop-filter: none;
    }
    
    .popup-content {
        box-shadow: none;
        border: 1px solid #000;
        max-height: none;
        page-break-inside: avoid;
    }
    
    .close-button,
    .action-buttons,
    .similar-products {
        display: none;
    }
    
    .product-details {
        max-height: none;
        overflow: visible;
    }
}