/**
 * NFC Product Card Styles
 * Mobile-first responsive design with RTL support
 */

/* Reset and base styles */
.nfc-product-card,
[class*="nfc-pc-"] {
    display: block;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 0;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: visible;
}

.nfc-product-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Image styles */
.nfc-product-card .nfc-product-card-image,
[class*="nfc-pc-"] .nfc-product-card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    margin-bottom: var(--nfc-image-gap, 0px) !important;
}

/* Image overhang styles */
.nfc-product-card[style*="--nfc-image-overhang: 1"] .nfc-product-card-image,
[class*="nfc-pc-"][style*="--nfc-image-overhang: 1"] .nfc-product-card-image {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.nfc-product-card[style*="--nfc-image-overhang: 1"] .nfc-product-card-content,
[class*="nfc-pc-"][style*="--nfc-image-overhang: 1"] .nfc-product-card-content {
    position: relative;
    z-index: 2;
    margin-top: var(--nfc-image-height, 200px);
}

.nfc-product-card .nfc-product-card-image img,
[class*="nfc-pc-"] .nfc-product-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
    transition: transform 0.3s ease;
}

/* Image fit states */
.nfc-product-card[data-nfc-image-fit="contain"] .nfc-product-card-image img,
[class*="nfc-pc-"][data-nfc-image-fit="contain"] .nfc-product-card-image img {
    object-fit: contain;
}

.nfc-product-card[data-nfc-image-fit="cover"] .nfc-product-card-image img,
[class*="nfc-pc-"][data-nfc-image-fit="cover"] .nfc-product-card-image img {
    object-fit: cover;
}

.nfc-product-card:hover .nfc-product-card-image img {
    transform: scale(1.05);
}

/* Content styles */
.nfc-product-card .nfc-product-card-content,
[class*="nfc-pc-"] .nfc-product-card-content {
    background: #ffffff;
    padding: 16px;
    padding-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nfc-product-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
}

.nfc-product-card .nfc-product-card-title,
[class*="nfc-pc-"] .nfc-product-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    margin: 0;
    padding: 0;
    line-height: 1.2;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nfc-product-card-price {
    font-size: 16px;
    font-weight: 700;
    color: #2c5aa0;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.nfc-product-card-description {
    display: none; /* Hide description on card - only show in popup */
}

/* Popup styles */
.nfc-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.nfc-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.nfc-popup-content {
    background: #ffffff;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.nfc-popup-overlay.active .nfc-popup-content {
    transform: scale(1);
}

/* Back button */
.nfc-popup-back {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
    transition: all 0.2s ease;
}

.nfc-popup-back:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateX(-2px);
}

.nfc-popup-back-icon {
    font-size: 16px;
    line-height: 1;
}

.nfc-popup-back-text {
    font-size: 14px;
}

/* Popup content */
.nfc-popup-image {
    width: 100%;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

.nfc-popup-image img {
    width: 100%;
    height: auto;
    display: block;
}

.nfc-popup-content-inner {
    padding: 24px;
}

.nfc-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.nfc-popup-title {
    font-size: 24px;
    font-weight: 700;
    color: #333333;
    margin: 0;
    flex: 1;
    line-height: 1.2;
}

.nfc-popup-price {
    font-size: 24px;
    font-weight: 700;
    color: #2c5aa0;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.nfc-popup-description {
    font-size: 16px;
    color: #666666;
    line-height: 1.6;
    margin: 0;
}

/* RTL Support */
[dir="rtl"] .nfc-product-card-image {
    /* RTL support maintained for image positioning */
}

[dir="rtl"] .nfc-product-card-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .nfc-popup-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .nfc-popup-back {
    left: auto;
    right: 16px;
}

[dir="rtl"] .nfc-popup-back:hover {
    transform: translateX(2px);
}

[dir="rtl"] .nfc-popup-back-icon {
    transform: scaleX(-1);
}

/* Tablet styles */
@media (min-width: 768px) {
    .nfc-product-card .nfc-product-card-content,
    [class*="nfc-pc-"] .nfc-product-card-content {
        padding: 20px;
        padding-top: 6px;
    }
    
    .nfc-product-card-title {
        font-size: 18px;
    }
    
    .nfc-product-card-price {
        font-size: 18px;
    }
    
    .nfc-popup-content {
        max-width: 600px;
    }
    
    .nfc-popup-content-inner {
        padding: 32px;
    }
    
    .nfc-popup-title {
        font-size: 28px;
    }
    
    .nfc-popup-price {
        font-size: 28px;
    }
    
    .nfc-popup-description {
        font-size: 18px;
    }
}

/* Desktop styles */
@media (min-width: 1024px) {
    .nfc-product-card .nfc-product-card-content,
    [class*="nfc-pc-"] .nfc-product-card-content {
        padding: 24px;
        padding-top: 6px;
    }
    
    .nfc-popup-content {
        max-width: 700px;
    }
    
    .nfc-popup-content-inner {
        padding: 40px;
    }
}

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

/* Print styles */
@media print {
    .nfc-popup-overlay {
        display: none !important;
    }
    
    .nfc-product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000000;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .nfc-product-card,
    .nfc-product-card-image img,
    .nfc-popup-overlay,
    .nfc-popup-content,
    .nfc-popup-back {
        transition: none;
    }
}

/* Focus styles for keyboard navigation */
.nfc-product-card:focus {
    outline: 2px solid #2c5aa0;
    outline-offset: 2px;
}

.nfc-popup-back:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .nfc-product-card {
        border: 2px solid #000000;
    }
    
    .nfc-product-card-title,
    .nfc-popup-title {
        color: #000000;
    }
    
    .nfc-product-card-price,
    .nfc-popup-price {
        color: #0000ff;
    }
}
