/**
 * TP WooCommerce PopUp Deals - Frontend Styles
 */

/* Overlay */
#tp-wpd-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999998;
}

/* Popup Box */
#tp-wpd-popup-box {
    position: fixed;
    background: #fff;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    direction: rtl;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

/* Center popup */
#tp-wpd-popup-box.tp-wpd-type-popup {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 16px;
    overflow-y: auto;
}

/* Slide from right */
#tp-wpd-popup-box.tp-wpd-type-slide-right {
    top: 0;
    right: 0;
    height: 100%;
    width: 400px;
    max-width: 90vw;
    border-radius: 16px 0 0 16px;
    overflow-y: auto;
}

/* Slide from left */
#tp-wpd-popup-box.tp-wpd-type-slide-left {
    top: 0;
    left: 0;
    height: 100%;
    width: 400px;
    max-width: 90vw;
    border-radius: 0 16px 16px 0;
    overflow-y: auto;
}

/* Slide from bottom */
#tp-wpd-popup-box.tp-wpd-type-slide-bottom {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 80vh;
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
}

/* Close Button */
.tp-wpd-close-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s;
    z-index: 10;
}

.tp-wpd-close-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Header */
.tp-wpd-header {
    padding: 28px 24px 20px;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

.tp-wpd-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px 0;
}

.tp-wpd-header p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

/* Products Grid */
.tp-wpd-products-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

/* Product Card */
.tp-wpd-product-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    position: relative;
    transition: all 0.2s;
    border: 2px solid transparent;
    max-width: 220px;
    margin: 0 auto;
}

.tp-wpd-product-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
}

/* Badge */
.tp-wpd-discount-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 20px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

/* Product Image */
.tp-wpd-product-img {
    width: 90px;
    height: 90px;
    margin: 0 auto 12px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

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

/* Product Name */
.tp-wpd-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 8px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
}

/* Prices */
.tp-wpd-prices {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.tp-wpd-price-old {
    font-size: 13px;
    color: #94a3b8;
    text-decoration: line-through;
}

.tp-wpd-price-new {
    font-size: 17px;
    font-weight: 700;
    color: #22c55e;
}

/* Add Button */
.tp-wpd-add-btn {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #3b82f6;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tp-wpd-add-btn:hover {
    background: #2563eb;
}

.tp-wpd-add-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tp-wpd-add-btn.loading {
    pointer-events: none;
}

.tp-wpd-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tp-wpd-spin 0.8s linear infinite;
}

@keyframes tp-wpd-spin {
    to { transform: rotate(360deg); }
}

/* Footer */
.tp-wpd-footer {
    padding: 16px 20px 20px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

.tp-wpd-dismiss-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 16px;
    transition: all 0.2s;
}

.tp-wpd-dismiss-btn:hover {
    color: #1e293b;
}

/* Success Overlay */
.tp-wpd-success {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999999;
}

.tp-wpd-success-inner {
    text-align: center;
}

.tp-wpd-success svg {
    margin-bottom: 16px;
}

.tp-wpd-success p {
    font-size: 18px;
    font-weight: 600;
    color: #22c55e;
    margin: 0;
}

/* Responsive */
@media (max-width: 600px) {
    #tp-wpd-popup-box.tp-wpd-type-popup {
        width: 95%;
    }

    .tp-wpd-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 16px;
    }

    .tp-wpd-product-card {
        padding: 12px;
    }

    .tp-wpd-product-img {
        width: 70px;
        height: 70px;
    }

    .tp-wpd-product-name {
        font-size: 12px;
        min-height: 32px;
    }

    #tp-wpd-popup-box.tp-wpd-type-slide-right,
    #tp-wpd-popup-box.tp-wpd-type-slide-left {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }
}
