/**
 * Judaica AOV Optimizer - Popup Recommendations Styles
 * v1.3.1 - Fixed Desktop: Larger, Centered, More Prominent
 */

/* =====================================================
   POPUP CONTAINER
   ===================================================== */

.jao-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.jao-popup.jao-popup-visible {
    opacity: 1;
    pointer-events: auto;
}

/* Semi-transparent overlay */
.jao-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.jao-popup.jao-popup-visible .jao-popup-overlay {
    opacity: 1;
}

/* Main popup container */
.jao-popup-container {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25), 0 10px 30px rgba(0, 0, 0, 0.15);
    max-width: 520px;
    width: 100%;
    padding: 24px;
    position: relative;
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.jao-popup.jao-popup-visible .jao-popup-container {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* =====================================================
   POPUP HEADER
   ===================================================== */

.jao-popup-close {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.jao-popup-close:hover {
    background: #e0e0e0;
    color: #333;
}

.jao-popup-title {
    margin: 0 0 20px 0;
    padding: 0 50px 16px 0;
    font-size: 20px;
    font-weight: 700;
    color: #333;
    text-align: right;
    border-bottom: 2px solid #f0f0f0;
}

/* =====================================================
   PRODUCTS LIST
   ===================================================== */

.jao-popup-products {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.jao-popup-product {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 14px;
    transition: all 0.3s ease;
}

.jao-popup-product:hover {
    background: #f8f9fa;
    border-color: #4CAF50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.15);
    transform: translateX(-4px);
}

/* Product image */
.jao-popup-product-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    background: #f5f5f5;
    border: 1px solid #eee;
}

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

/* Product info */
.jao-popup-product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.jao-popup-product-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.jao-popup-product-name:hover {
    color: #4CAF50;
}

.jao-popup-product-price {
    font-size: 15px;
    color: #666;
    font-weight: 500;
}

.jao-popup-product-price del {
    color: #999;
    margin-left: 6px;
    font-weight: normal;
}

.jao-popup-product-price ins {
    text-decoration: none;
    font-weight: 700;
    color: #c53030;
}

/* Add button */
.jao-popup-add-btn {
    flex-shrink: 0;
    padding: 12px 24px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 90px;
    text-align: center;
}

.jao-popup-add-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.35);
}

.jao-popup-add-btn:active {
    transform: translateY(0);
}

.jao-popup-add-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.jao-popup-add-btn.jao-added {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
}

/* =====================================================
   MOBILE - BOTTOM SHEET STYLE
   ===================================================== */

@media (max-width: 768px) {
    .jao-popup {
        padding: 0;
        align-items: flex-end;
    }
    
    .jao-popup-container {
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        padding: 20px;
        transform: translateY(100%);
    }
    
    .jao-popup.jao-popup-visible .jao-popup-container {
        transform: translateY(0);
    }
    
    .jao-popup-title {
        font-size: 18px;
        padding-right: 40px;
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .jao-popup-close {
        top: 16px;
        left: 16px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
    
    .jao-popup-products {
        gap: 12px;
    }
    
    .jao-popup-product {
        padding: 12px;
        gap: 12px;
    }
    
    .jao-popup-product-image {
        width: 64px;
        height: 64px;
    }
    
    .jao-popup-product-name {
        font-size: 14px;
    }
    
    .jao-popup-product-price {
        font-size: 14px;
    }
    
    .jao-popup-add-btn {
        padding: 10px 16px;
        font-size: 14px;
        min-width: 70px;
    }
}

/* =====================================================
   DESKTOP: LARGER, CENTERED, PROMINENT
   ===================================================== */

@media (min-width: 769px) {
    .jao-popup {
        align-items: center;
        justify-content: center;
        padding: 40px;
    }
    
    .jao-popup-overlay {
        background: rgba(0, 0, 0, 0.5);
    }
    
    .jao-popup-container {
        max-width: 560px;
        padding: 28px;
        border-radius: 24px;
    }
    
    .jao-popup-title {
        font-size: 22px;
        margin-bottom: 24px;
        padding-bottom: 18px;
    }
    
    .jao-popup-products {
        gap: 16px;
    }
    
    .jao-popup-product {
        padding: 18px;
        gap: 18px;
    }
    
    .jao-popup-product-image {
        width: 90px;
        height: 90px;
        border-radius: 12px;
    }
    
    .jao-popup-product-name {
        font-size: 16px;
    }
    
    .jao-popup-product-price {
        font-size: 16px;
    }
    
    .jao-popup-add-btn {
        padding: 14px 28px;
        font-size: 15px;
        min-width: 100px;
    }
    
    .jao-popup-close {
        width: 40px;
        height: 40px;
        font-size: 24px;
        top: 18px;
        left: 18px;
    }
}

/* =====================================================
   ANIMATION STATES
   ===================================================== */

@keyframes jao-popup-slide-up {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes jao-popup-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

.jao-popup-product-added {
    animation: jao-popup-pulse 0.3s ease;
}

/* =====================================================
   RTL SUPPORT
   ===================================================== */

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

[dir="rtl"] .jao-popup-title {
    text-align: right;
    padding-left: 50px;
    padding-right: 0;
}

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

[dir="rtl"] .jao-popup-product:hover {
    transform: translateX(4px);
}

[dir="rtl"] .jao-popup-product-info {
    text-align: right;
}

[dir="rtl"] .jao-popup-product-price del {
    margin-left: 0;
    margin-right: 6px;
}

@media (min-width: 769px) {
    [dir="rtl"] .jao-popup-close {
        left: 18px;
    }
}

/* =====================================================
   DARK MODE SUPPORT (optional)
   ===================================================== */

@media (prefers-color-scheme: dark) {
    .jao-popup-container.jao-dark-mode {
        background: #1a1a1a;
        color: #fff;
    }
    
    .jao-popup-container.jao-dark-mode .jao-popup-title {
        color: #fff;
        border-bottom-color: #333;
    }
    
    .jao-popup-container.jao-dark-mode .jao-popup-product {
        background: #2a2a2a;
        border-color: #3a3a3a;
    }
    
    .jao-popup-container.jao-dark-mode .jao-popup-product:hover {
        background: #333;
    }
    
    .jao-popup-container.jao-dark-mode .jao-popup-product-name {
        color: #fff;
    }
    
    .jao-popup-container.jao-dark-mode .jao-popup-close {
        background: #333;
        color: #fff;
    }
}
