/**
 * OrenCart - Cart & Modal Styles
 * Sticky preview bar, cart review modal, upsell popup, notifications
 */

/* ===== STICKY PREVIEW BAR ===== */
.orencart-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 9999;
    padding: 15px 20px;
    border-top: 3px solid #ee4d2d;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.orencart-sticky-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.orencart-sticky-items {
    flex: 1;
    font-size: 14px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-cart-msg {
    color: #999;
    font-style: italic;
}

.cart-items-preview {
    font-weight: 500;
}

.orencart-check-cart-btn {
    background: #ee4d2d;
    color: #ffffff;
    border: none;
    padding: 12px 30px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.orencart-check-cart-btn:hover {
    background: #d73211;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(238,77,45,0.3);
}

/* ===== MODAL SYSTEM ===== */
.orencart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
}

.orencart-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    animation: fadeIn 0.3s ease-out;
}

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

.orencart-modal-content {
    position: relative;
    background: #ffffff;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    margin: 50px auto;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s ease-out;
    overflow: hidden;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.orencart-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.orencart-modal-header h2 {
    margin: 0;
    font-size: 22px;
    color: #333;
}

.orencart-close-review,
.orencart-close-upsell,
.exit-popup-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.orencart-close-review:hover,
.orencart-close-upsell:hover,
.exit-popup-close:hover {
    color: #ee4d2d;
}

.orencart-modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.orencart-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

/* ===== CART STATUS MESSAGES ===== */
.cart-status {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.cart-status-upsell {
    background: #fff7e6;
    border-left: 4px solid #fa8c16;
}

.cart-status-error {
    background: #fff2f0;
    border-left: 4px solid #ff4d4f;
}

.cart-status-ready {
    background: #f6ffed;
    border-left: 4px solid #52c41a;
}

.upsell-message,
.error-message,
.ready-message {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
}

.error-message {
    color: #cf1322;
    font-weight: 500;
}

.ready-message {
    color: #389e0d;
    font-weight: 500;
}

/* ===== CART REVIEW ITEMS ===== */
.cart-review-items {
    margin: 20px 0;
}

.cart-review-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    margin-bottom: 15px;
    align-items: center;
    background: #fafafa;
}

.item-details {
    flex: 1;
    display: flex;
    gap: 15px;
    align-items: center;
}

.item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.item-info h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #333;
}

.item-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.item-price {
    text-align: right;
    min-width: 100px;
}

.unit-price {
    color: #999;
    font-size: 13px;
    margin: 0 0 5px 0;
}

.total-price {
    color: #ee4d2d;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.orencart-remove-item {
    background: #ff4d4f;
    color: #ffffff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
}

.orencart-remove-item:hover {
    background: #cf1322;
    transform: scale(1.1);
}

/* ===== CART TOTAL ===== */
.cart-review-total {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 15px;
}

.total-price-row {
    font-size: 18px;
    font-weight: 600;
    color: #ee4d2d;
    border-top: 1px solid #f0f0f0;
    margin-top: 10px;
    padding-top: 15px;
}

/* ===== BUTTONS ===== */
.orencart-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.orencart-btn-primary {
    background: #ee4d2d;
    color: #ffffff;
}

.orencart-btn-primary:hover {
    background: #d73211;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(238,77,45,0.3);
}

.orencart-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.orencart-btn-secondary {
    background: #ffffff;
    color: #666;
    border: 1px solid #ddd;
}

.orencart-btn-secondary:hover {
    border-color: #ee4d2d;
    color: #ee4d2d;
}

/* ===== UPSELL POPUP ===== */
.upsell-message {
    background: #e6f7ff;
    border-left: 4px solid #1890ff;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 25px;
}

.upsell-message p {
    margin: 0;
    font-size: 16px;
    color: #0050b3;
}

.upsell-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.upsell-product-card {
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    padding: 15px;
    background: #fafafa;
    transition: all 0.3s;
}

.upsell-product-card:hover {
    border-color: #ee4d2d;
    box-shadow: 0 2px 8px rgba(238,77,45,0.2);
}

.upsell-product-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.upsell-product-info h4 {
    font-size: 15px;
    margin: 0 0 8px 0;
    color: #333;
}

.upsell-product-price {
    color: #ee4d2d;
    font-size: 18px;
    font-weight: 600;
    margin: 8px 0;
}

.upsell-stock-warning {
    display: block;
    font-size: 12px;
    color: #fa8c16;
    margin-top: 5px;
}

.upsell-product-actions {
    margin-top: 12px;
}

.upsell-qty-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.upsell-qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s;
}

.upsell-qty-btn:hover {
    border-color: #ee4d2d;
    color: #ee4d2d;
}

.upsell-qty-input {
    flex: 1;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px;
    font-size: 14px;
}

.upsell-add-btn {
    width: 100%;
    padding: 10px;
    background: #ee4d2d;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.upsell-add-btn:hover {
    background: #d73211;
}

.upsell-add-btn.added {
    background: #52c41a;
}

/* ===== EXIT INTENT POPUP ===== */
.orencart-exit-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.orencart-exit-popup.show {
    opacity: 1;
}

.exit-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
}

.exit-popup-content {
    position: relative;
    background: #ffffff;
    max-width: 500px;
    width: 90%;
    margin: 100px auto;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.exit-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
}

.exit-popup-content h2 {
    font-size: 28px;
    margin: 0 0 15px 0;
    color: #333;
}

.exit-popup-content p {
    font-size: 16px;
    color: #666;
    margin: 0 0 25px 0;
}

.exit-popup-code {
    background: #fff7e6;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}

.exit-popup-code strong {
    font-size: 24px;
    color: #ee4d2d;
}

.exit-popup-btn {
    background: #ee4d2d;
    color: #ffffff;
    border: none;
    padding: 15px 40px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.exit-popup-btn:hover {
    background: #d73211;
    transform: scale(1.05);
}

/* ===== NOTIFICATIONS ===== */
.orencart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 999999;
    animation: slideInRight 0.3s ease-out;
    max-width: 350px;
    display: none;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.orencart-notification-success {
    background: #f6ffed;
    border-left: 4px solid #52c41a;
    color: #389e0d;
}

.orencart-notification-error {
    background: #fff2f0;
    border-left: 4px solid #ff4d4f;
    color: #cf1322;
}

.orencart-notification-info {
    background: #e6f7ff;
    border-left: 4px solid #1890ff;
    color: #0050b3;
}

/* ===== LOADING OVERLAY ===== */
.orencart-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 99998;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #ee4d2d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.orencart-loading-overlay p {
    color: #ffffff;
    margin-top: 20px;
    font-size: 16px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .orencart-sticky-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .orencart-sticky-items {
        text-align: center;
    }
    
    .orencart-check-cart-btn {
        width: 100%;
    }
    
    .orencart-modal-content {
        width: 95%;
        margin: 20px auto;
        max-height: 95vh;
    }
    
    .orencart-modal-header h2 {
        font-size: 18px;
    }
    
    .cart-review-item {
        flex-wrap: wrap;
    }
    
    .item-image {
        width: 60px;
        height: 60px;
    }
    
    .item-price {
        width: 100%;
        text-align: left;
        margin-top: 10px;
    }
    
    .upsell-products-grid {
        grid-template-columns: 1fr;
    }
    
    .orencart-modal-footer {
        flex-direction: column;
    }
    
    .orencart-btn {
        width: 100%;
    }
    
    .exit-popup-content {
        padding: 30px 20px;
    }
    
    .exit-popup-content h2 {
        font-size: 22px;
    }
    
    .orencart-notification {
        left: 10px;
        right: 10px;
        top: 10px;
    }
}

/* ===== SHARE MENU POPUP ===== */
.orencart-share-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 150px;
    margin-top: 5px;
    animation: fadeInDown 0.2s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.orencart-share-menu button {
    display: block;
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.orencart-share-menu button:hover {
    background: #f5f5f5;
}

.orencart-share-menu button:first-child {
    border-radius: 6px 6px 0 0;
}

.orencart-share-menu button:last-child {
    border-radius: 0 0 6px 6px;
}

.product-actions {
    position: relative;
}
