/**
 * Popup Cart Side Panel Styles for OpenCart 4.x
 * Modern side cart with smooth animations
 */

/* Side Panel Container */
.popup-cart-side-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.popup-cart-side-panel.popup-cart-open {
    pointer-events: all;
}

/* Overlay Background */
.popup-cart-overlay-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    z-index: 1;
}

.popup-cart-open .popup-cart-overlay-bg {
    background: rgba(0, 0, 0, 0.6);
}

/* Center Modal */
.popup-cart-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    border-radius: 12px;
    border-top: 4px solid #E8B44D;
    opacity: 0;
}

.popup-cart-open .popup-cart-panel {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Header */
.popup-cart-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #3D5A8C 0%, #4A6BA0 100%);
    color: #fff;
    border-radius: 12px 12px 0 0;
}

.popup-cart-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.popup-cart-count {
    font-size: 14px;
    opacity: 0.9;
}

.popup-cart-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 18px;
}

.popup-cart-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Body */
.popup-cart-panel-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    position: relative;
}

/* Loading */
.popup-cart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
}

.popup-cart-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    color: #667eea;
}

/* Empty Cart */
.popup-cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.popup-cart-empty i {
    color: #dee2e6;
    margin-bottom: 20px;
}

.popup-cart-empty p {
    font-size: 16px;
    margin: 0;
}

/* Products */
.popup-cart-products {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.popup-cart-product {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.popup-cart-product:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.popup-cart-product-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
}

.popup-cart-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.popup-cart-product-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.popup-cart-product-name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    padding-right: 80px;
}

.popup-cart-product-name a {
    color: #212529;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.popup-cart-product-name a:hover {
    color: #E8B44D;
}

.popup-cart-product-options {
    font-size: 12px;
    color: #6c757d;
}

.popup-cart-product-price {
    font-size: 16px;
    font-weight: 600;
    color: #2C4A7C;
}

.popup-cart-product-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

/* Quantity Controls */
.popup-cart-quantity {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #fff;
    border-radius: 6px;
    padding: 4px;
    border: 1px solid #dee2e6;
}

.popup-cart-qty-minus,
.popup-cart-qty-plus {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 12px;
}

.popup-cart-qty-minus:hover,
.popup-cart-qty-plus:hover {
    background: #f8f9fa;
    color: #E8B44D;
}

.popup-cart-qty-input {
    width: 40px;
    border: none;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    background: transparent;
    -moz-appearance: textfield;
}

.popup-cart-qty-input::-webkit-outer-spin-button,
.popup-cart-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.popup-cart-qty-input:focus {
    outline: none;
}

/* Remove Button */
.popup-cart-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: #dc3545;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: auto;
}

.popup-cart-remove:hover {
    background: #c82333;
    transform: scale(1.1);
}

.popup-cart-product-total {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 14px;
    font-weight: 700;
    color: #2C4A7C;
    background: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Footer */
.popup-cart-panel-footer {
    border-top: 1px solid #e9ecef;
    padding: 20px 25px;
    background: #fff;
    border-radius: 0 0 12px 12px;
}

/* Totals */
.popup-cart-totals-table {
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.popup-cart-total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.popup-cart-total-row:not(:last-child) {
    border-bottom: 1px solid #f1f3f5;
}

.popup-cart-total-row:last-child {
    font-weight: 700;
    font-size: 18px;
    color: #2C4A7C;
    margin-top: 5px;
    padding-top: 15px;
    border-top: 2px solid #e9ecef;
}

.popup-cart-total-title {
    color: #495057;
}

.popup-cart-total-value {
    font-weight: 600;
    color: #212529;
}

/* Action Buttons */
.popup-cart-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.popup-cart-continue {
    padding: 12px 20px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s;
    border: 2px solid #e9ecef;
    background: #fff;
    color: #6c757d;
    cursor: pointer;
    grid-column: 1 / 2;
}

.popup-cart-continue:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #495057;
}

.popup-cart-view-cart {
    padding: 12px 20px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s;
    border: 2px solid #2C4A7C;
    background: #fff;
    color: #2C4A7C;
    grid-column: 2 / 3;
}

.popup-cart-view-cart:hover {
    background: #2C4A7C;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 74, 124, 0.3);
}

.popup-cart-checkout {
    padding: 12px 20px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s;
    background: #E8B44D;
    color: #2C4A7C;
    border: none;
    grid-column: 1 / 3;
}

.popup-cart-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(232, 180, 77, 0.4);
    background: #d9a43d;
    color: #2C4A7C;
}

/* Alert Messages */
.popup-cart-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    min-width: 300px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.popup-cart-alert.show {
    opacity: 1;
    transform: translateX(0);
}

/* Scrollbar */
.popup-cart-panel-body::-webkit-scrollbar {
    width: 6px;
}

.popup-cart-panel-body::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.popup-cart-panel-body::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 3px;
}

.popup-cart-panel-body::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* Responsive */
@media (max-width: 768px) {
    .popup-cart-panel {
        width: 100% !important;
        max-width: 100% !important;
    }

    .popup-cart-panel-header {
        padding: 15px 20px;
    }

    .popup-cart-title {
        font-size: 18px;
    }

    .popup-cart-panel-body {
        padding: 15px;
    }

    .popup-cart-product {
        padding: 12px;
    }

    .popup-cart-product-image {
        width: 60px;
        height: 60px;
    }

    .popup-cart-product-name {
        font-size: 13px;
    }

    .popup-cart-panel-footer {
        padding: 15px 20px;
    }

    .popup-cart-alert {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .popup-cart-panel {
        width: 95%;
        max-height: 90vh;
    }

    .popup-cart-product-controls {
        flex-wrap: wrap;
    }

    .popup-cart-remove {
        margin-left: 0;
    }

    .popup-cart-product-total {
        position: static;
        margin-top: 10px;
    }

    .popup-cart-actions {
        grid-template-columns: 1fr;
    }

    .popup-cart-continue,
    .popup-cart-view-cart,
    .popup-cart-checkout {
        grid-column: 1 / 2;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}
