/**
 * Popup Cart Pro - Frontend Styles
 * سازگار با ووکامرس و قالب Revo 4.1.1
 * 
 * @package PopupCartPro
 * @version 2.0.0
 */

:root {
    --pcp-primary: #0ea5e9;
    --pcp-secondary: #8b5cf6;
    --pcp-bg: #ffffff;
    --pcp-text: #1f2937;
    --pcp-radius: 16px;
    --pcp-width: 400px;
}

/* ===== Overlay ===== */
.pcp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.pcp-overlay.pcp-active {
    opacity: 1;
    visibility: visible;
}

/* ===== Popup Container ===== */
.pcp-popup {
    position: fixed;
    top: 0;
    bottom: 0;
    width: var(--pcp-width);
    max-width: 100%;
    background: var(--pcp-bg);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
    overflow: hidden;
}

/* Position: Right */
.pcp-popup.pcp-position-right {
    right: 0;
    transform: translateX(100%);
}

.pcp-popup.pcp-position-right.pcp-active {
    transform: translateX(0);
}

/* Position: Left */
.pcp-popup.pcp-position-left {
    left: 0;
    transform: translateX(-100%);
}

.pcp-popup.pcp-position-left.pcp-active {
    transform: translateX(0);
}

/* Position: Center */
.pcp-popup.pcp-position-center {
    top: 50%;
    left: 50%;
    bottom: auto;
    max-height: 90vh;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    border-radius: var(--pcp-radius);
}

.pcp-popup.pcp-position-center.pcp-active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Shadow */
.pcp-popup.pcp-has-shadow {
    box-shadow: -10px 0 50px rgba(0, 0, 0, 0.15);
}

.pcp-popup.pcp-position-left.pcp-has-shadow {
    box-shadow: 10px 0 50px rgba(0, 0, 0, 0.15);
}

.pcp-popup.pcp-position-center.pcp-has-shadow {
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.2);
}

/* Glass Effect */
.pcp-popup.pcp-glass-effect {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* ===== Header ===== */
.pcp-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--pcp-primary), var(--pcp-secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.pcp-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pcp-header-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pcp-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.pcp-header p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.8;
}

.pcp-close-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.pcp-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ===== Free Shipping Bar ===== */
.pcp-shipping-bar {
    padding: 12px 20px;
    background: linear-gradient(to right, #f0fdf4, #ecfdf5);
    border-bottom: 1px solid #dcfce7;
}

.pcp-shipping-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #166534;
    margin-bottom: 8px;
}

.pcp-shipping-progress {
    height: 6px;
    background: #bbf7d0;
    border-radius: 3px;
    overflow: hidden;
}

.pcp-shipping-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #10b981);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ===== Cart Items ===== */
.pcp-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.pcp-items::-webkit-scrollbar {
    width: 6px;
}

.pcp-items::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.pcp-items::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
}

.pcp-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: white;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.pcp-item:hover {
    border-color: var(--pcp-primary);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.pcp-item-image {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.pcp-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pcp-item-details {
    flex: 1;
    min-width: 0;
}

.pcp-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--pcp-text);
    margin: 0 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pcp-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.pcp-item-sku {
    font-size: 11px;
    color: #9ca3af;
}

.pcp-item-category {
    font-size: 11px;
    padding: 2px 8px;
    background: #f0f9ff;
    color: var(--pcp-primary);
    border-radius: 20px;
}

.pcp-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pcp-item-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--pcp-primary);
}

.pcp-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pcp-qty-btn {
    width: 28px;
    height: 28px;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s ease;
}

.pcp-qty-btn:hover {
    background: #e2e8f0;
    color: var(--pcp-primary);
}

.pcp-qty-value {
    width: 32px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

.pcp-remove-btn {
    width: 28px;
    height: 28px;
    background: #fef2f2;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
    transition: all 0.2s ease;
    margin-right: 8px;
}

.pcp-remove-btn:hover {
    background: #fee2e2;
    transform: scale(1.1);
}

/* ===== Coupon Section ===== */
.pcp-coupon {
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
}

.pcp-coupon-form {
    display: flex;
    gap: 8px;
}

.pcp-coupon-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    transition: border-color 0.2s ease;
}

.pcp-coupon-input:focus {
    border-color: var(--pcp-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.pcp-coupon-btn {
    padding: 10px 16px;
    background: #f1f5f9;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pcp-coupon-btn:hover {
    background: #e2e8f0;
}

.pcp-coupon-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Summary ===== */
.pcp-summary {
    padding: 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.pcp-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.pcp-summary-row .pcp-label {
    color: #6b7280;
}

.pcp-summary-row .pcp-value {
    color: var(--pcp-text);
    font-weight: 600;
}

.pcp-summary-row.pcp-discount .pcp-value {
    color: #16a34a;
}

.pcp-summary-total {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    margin-top: 12px;
    font-size: 16px;
    font-weight: 700;
}

.pcp-summary-total .pcp-value {
    color: var(--pcp-primary);
}

/* ===== Buttons ===== */
.pcp-checkout-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--pcp-primary), var(--pcp-secondary));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
}

.pcp-checkout-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.pcp-continue-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: #6b7280;
    border: none;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.pcp-continue-btn:hover {
    color: var(--pcp-text);
}

/* ===== Empty State ===== */
.pcp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.pcp-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.pcp-empty h4 {
    margin: 0 0 8px;
    font-size: 18px;
    color: var(--pcp-text);
}

.pcp-empty p {
    margin: 0;
    font-size: 14px;
    color: #9ca3af;
}

.pcp-empty-link {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--pcp-primary), var(--pcp-secondary));
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pcp-empty-link:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    color: white;
}

/* ===== Loading State ===== */
.pcp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.pcp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--pcp-primary);
    border-radius: 50%;
    animation: pcp-spin 0.8s linear infinite;
}

@keyframes pcp-spin {
    to { transform: rotate(360deg); }
}

/* ===== Success Toast ===== */
.pcp-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    background: #10b981;
    color: white;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999999;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pcp-toast.pcp-toast-active {
    transform: translateX(0);
}

.pcp-toast.pcp-toast-error {
    background: #ef4444;
    box-shadow: 0 10px 40px rgba(239, 68, 68, 0.3);
}

/* ===== Suggested Products ===== */
.pcp-suggestions {
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
}

.pcp-suggestions-title {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.pcp-suggestions-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.pcp-suggestion-item {
    flex-shrink: 0;
    width: 80px;
    text-align: center;
}

.pcp-suggestion-image {
    width: 60px;
    height: 60px;
    margin: 0 auto 4px;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
}

.pcp-suggestion-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pcp-suggestion-name {
    font-size: 10px;
    color: #4b5563;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pcp-suggestion-add {
    font-size: 10px;
    color: var(--pcp-primary);
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 0;
}

.pcp-suggestion-add:hover {
    text-decoration: underline;
}

/* ===== Mobile Drag Handle ===== */
.pcp-drag-handle {
    display: none;
    justify-content: center;
    padding: 8px 0 0;
}

.pcp-drag-handle-bar {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
}

/* ===== Mobile Styles ===== */
@media (max-width: 768px) {
    .pcp-popup {
        width: 100%;
        max-width: 100%;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }
    
    .pcp-popup.pcp-active {
        transform: translateY(0);
    }
    
    .pcp-popup.pcp-position-right,
    .pcp-popup.pcp-position-left {
        transform: translateY(100%);
    }
    
    .pcp-popup.pcp-position-right.pcp-active,
    .pcp-popup.pcp-position-left.pcp-active {
        transform: translateY(0);
    }
    
    .pcp-popup.pcp-position-center {
        transform: translateY(100%) translateX(-50%) scale(1);
        left: 50%;
    }
    
    .pcp-popup.pcp-position-center.pcp-active {
        transform: translateY(0) translateX(-50%) scale(1);
    }
    
    .pcp-popup.pcp-fullscreen-mobile {
        max-height: 100vh;
        border-radius: 0;
    }
    
    /* Mobile Drag Handle */
    .pcp-drag-handle {
        display: flex;
    }
    
    .pcp-header {
        padding: 16px;
        padding-top: 24px;
    }
    
    .pcp-item {
        padding: 10px;
    }
    
    .pcp-item-image {
        width: 60px;
        height: 60px;
    }
    
    .pcp-summary {
        padding: 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
    
    .pcp-toast {
        left: 16px;
        right: 16px;
        top: auto;
        bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    }
    
    /* Mobile image sizes */
    .pcp-popup[data-mobile-image="small"] .pcp-item-image {
        width: 48px;
        height: 48px;
    }
    
    .pcp-popup[data-mobile-image="large"] .pcp-item-image {
        width: 80px;
        height: 80px;
    }
}

/* ===== Revo Theme Compatibility ===== */
.theme-revo .pcp-popup,
.theme-revo .pcp-overlay,
[class*="revo"] .pcp-popup,
[class*="revo"] .pcp-overlay {
    z-index: 999999 !important;
}

.theme-revo .header-cart .cart-contents,
[class*="revo"] .header-cart .cart-contents {
    cursor: pointer;
}

/* ===== WooCommerce Compatibility ===== */
.woocommerce .pcp-popup {
    font-family: inherit;
}

.woocommerce-js .pcp-popup .quantity {
    display: none;
}

/* ===== Animation Variations ===== */
.pcp-animation-fade .pcp-popup {
    transform: none;
    opacity: 0;
}

.pcp-animation-fade .pcp-popup.pcp-active {
    opacity: 1;
}

.pcp-animation-fade .pcp-popup.pcp-position-right,
.pcp-animation-fade .pcp-popup.pcp-position-left {
    transform: none;
}

.pcp-animation-bounce .pcp-popup.pcp-position-right {
    transform: translateX(100%);
}

.pcp-animation-bounce .pcp-popup.pcp-position-right.pcp-active {
    animation: pcp-bounce-in-right 0.5s ease forwards;
}

.pcp-animation-bounce .pcp-popup.pcp-position-left {
    transform: translateX(-100%);
}

.pcp-animation-bounce .pcp-popup.pcp-position-left.pcp-active {
    animation: pcp-bounce-in-left 0.5s ease forwards;
}

.pcp-animation-bounce .pcp-popup.pcp-position-center {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
}

.pcp-animation-bounce .pcp-popup.pcp-position-center.pcp-active {
    animation: pcp-bounce-in-center 0.5s ease forwards;
}

.pcp-animation-scale .pcp-popup.pcp-position-right,
.pcp-animation-scale .pcp-popup.pcp-position-left {
    transform: scale(0.8);
    opacity: 0;
}

.pcp-animation-scale .pcp-popup.pcp-position-right.pcp-active,
.pcp-animation-scale .pcp-popup.pcp-position-left.pcp-active {
    transform: scale(1);
    opacity: 1;
}

@keyframes pcp-bounce-in-right {
    0% { transform: translateX(100%); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

@keyframes pcp-bounce-in-left {
    0% { transform: translateX(-100%); }
    60% { transform: translateX(10px); }
    80% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

@keyframes pcp-bounce-in-center {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.05); }
    70% { transform: translate(-50%, -50%) scale(0.95); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ===== Swipe Delete Animation ===== */
.pcp-item.pcp-swiping {
    transition: transform 0.1s ease;
}

.pcp-item.pcp-deleting {
    transform: translateX(-100%);
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    border: none;
    transition: all 0.3s ease;
}

/* ===== Cart Badge Animation ===== */
.pcp-cart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--pcp-primary);
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.pcp-cart-badge.pcp-badge-animate {
    animation: pcp-badge-pop 0.3s ease;
}

@keyframes pcp-badge-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ===== Suggested Products Add Animation ===== */
.pcp-suggestion-add.pcp-adding {
    color: #10b981;
    pointer-events: none;
}

.pcp-suggestion-add.pcp-adding::after {
    content: ' ✓';
}
