/* Vue Sidebar Cart Styles */

/* Overlay */
.sidebar-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Sidebar */
.sidebar-cart {
    position: fixed;
    top: 0;
    right: 0;
    width: 450px;
    max-width: 90vw;
    height: 100vh;
    background: white;
    z-index: 999999;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
}

.sidebar-cart.open {
    transform: translateX(0);
}

.sidebar-cart.closing {
    transform: translateX(100%);
}

/* Prevent body scroll when cart is open */
body.sidebar-cart-open {
    overflow: hidden;
}

/* Header */
.sidebar-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid var(--color-border, #e0e0e0);
    background: var(--color-1st, #d5172d);
    color: white;
}

.cart-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.cart-title * {
    color: white !important;
}

.cart-title i {
    font-size: 20px;
}

.cart-count {
    font-size: 14px;
    font-weight: 400;
    opacity: 0.9;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Content */
.sidebar-cart-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

/* Empty State */
.empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
    text-align: center;
    height: 100%;
}

.empty-cart-icon {
    width: 80px;
    height: 80px;
    background: #f5f5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.empty-cart-icon i {
    font-size: 40px;
    color: #ccc;
}

.empty-cart h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
}

.empty-cart p {
    margin: 0 0 25px 0;
    color: #666;
    font-size: 14px;
}

.continue-shopping-btn {
    background: var(--color-1st, #d5172d);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.continue-shopping-btn:hover {
    background: var(--color-1st-darken, #b91423);
}

/* Cart Items */
.cart-items {
    padding: 0;
}

.cart-item {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px 25px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    position: relative;
    align-items: flex-start;
}

.cart-item:hover {
    background: #fafafa;
}

.cart-item.item-slide-in {
    animation: slideInFromRight 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: linear-gradient(90deg, transparent 0%, rgba(213, 23, 45, 0.05) 50%, transparent 100%);
}

.cart-item.item-removing {
    animation: slideOutAndFade 0.4s cubic-bezier(0.4, 0, 0.6, 1) forwards;
    background: linear-gradient(90deg, transparent 0%, rgba(220, 38, 38, 0.1) 50%, transparent 100%);
    border-left: 3px solid #dc2626;
}

@keyframes slideInFromRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    50% {
        transform: translateX(-10px);
        opacity: 0.8;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutAndFade {
    0% {
        transform: translateX(0);
        opacity: 1;
        max-height: 200px;
        padding: 20px 25px;
        margin-bottom: 0;
    }
    70% {
        transform: translateX(100%);
        opacity: 0;
        max-height: 200px;
        padding: 20px 25px;
        margin-bottom: 0;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
        max-height: 0;
        padding: 0 25px;
        margin-bottom: 0;
    }
}

/* Product Image Area */
.item-image-area {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.item-image {
    width: 80px;
    height: 80px;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Product Info */
.item-info {
    flex: 1 1 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0; /* Allows text to wrap properly */
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.item-name {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    color: #333;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.remove-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 2px;
    font-size: 16px;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.remove-btn:hover {
    color: var(--color-1st, #d5172d);
}

/* Attributes */
.item-attributes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.attribute-tag {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    color: #666;
}

.attribute-tag.attribute-texture {
    background: linear-gradient(135deg, #f0f0f0, #e8e8e8);
    border-color: #d0d0d0;
    color: #555;
    font-weight: 600;
}

.attribute-tag.attribute-size {
    background: var(--color-1st, #d5172d);
    color: white;
    border-color: var(--color-1st, #d5172d);
}

/* Color Display (matching configurator design) */
.color-display {
    width: 80px;
    height: 80px;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.color-display:hover {
    transform: scale(1.05);
}

.color-checkmark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-checkmark svg {
    width: 10px;
    height: 10px;
}

.color-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.85);
    padding: 3px 6px;
    text-align: center;
    font-size: 8px;
    border-radius: 0 0 3px 3px;
    line-height: 1.1;
}

.color-palette {
    font-weight: bold;
    margin-bottom: 0;
    color: #333;
    font-size: 7px;
}

.color-name-text {
    color: #555;
    font-size: 7px;
}

/* Price and Quantity */
.item-pricing {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.quantity-controls {
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.qty-btn {
    background: white;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.2s ease;
}

.qty-btn:hover:not(:disabled) {
    background: #f5f5f5;
    color: var(--color-1st, #d5172d);
}

.qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.qty-btn:first-child {
    border-right: 1px solid #e0e0e0;
}

.qty-btn:last-child {
    border-left: 1px solid #e0e0e0;
}

.quantity {
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    min-width: 40px;
    text-align: center;
    background: white;
    color: #333;
}

.item-price {
    text-align: right;
}

.unit-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-1st, #d5172d);
}

.total-price {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

/* Footer */
.sidebar-cart-footer {
    border-top: 1px solid #e0e0e0;
    padding: 25px;
    background: #fafafa;
}

/* Totals */
.cart-totals {
    margin-bottom: 20px;
}

.cart-totals > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.cart-totals > div:last-child {
    margin-bottom: 0;
}

.subtotal-row,
.tax-row {
    color: #666;
}

.discount-row .discount {
    color: #28a745;
    font-weight: 500;
}

.total-row {
    border-top: 1px solid #e0e0e0;
    padding-top: 10px;
    margin-top: 12px;
    font-size: 16px;
    font-weight: 600;
}

.total-amount {
    color: var(--color-1st, #d5172d);
    font-size: 18px;
}

/* Action Buttons */
.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.view-cart-btn,
.checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.view-cart-btn {
    background: white;
    color: var(--color-1st, #d5172d);
    border: 2px solid var(--color-1st, #d5172d);
}

.view-cart-btn:hover {
    background: var(--color-1st, #d5172d);
    color: white;
    text-decoration: none;
}

.checkout-btn {
    background: var(--color-1st, #d5172d);
    color: white;
}

.checkout-btn:hover {
    background: var(--color-1st-darken, #b91423);
    text-decoration: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar-cart {
        width: 100vw;
        max-width: 100vw;
    }
    
    .sidebar-cart-header,
    .sidebar-cart-footer,
    .cart-item {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .item-image {
        width: 70px;
        height: 70px;
    }
    
    .color-display {
        width: 70px;
        height: 70px;
    }
    
    .cart-title {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .sidebar-cart-header,
    .sidebar-cart-footer,
    .cart-item {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .item-image {
        width: 60px;
        height: 60px;
    }
    
    .color-display {
        width: 60px;
        height: 60px;
    }
    
    .item-image-area {
        gap: 8px;
    }
    
    .color-checkmark svg {
        width: 10px;
        height: 10px;
    }
    
    .color-info-overlay {
        font-size: 8px;
        padding: 2px 1px;
    }
    
    .color-palette {
        font-size: 8px;
    }
    
    .color-name-text {
        font-size: 7px;
    }
    
    .item-pricing {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .quantity-controls {
        order: 2;
    }
    
    .item-price {
        order: 1;
        align-self: flex-end;
        text-align: right;
    }
}

/* Loading State */
.cart-item.updating {
    opacity: 0.6;
    pointer-events: none;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-item {
    animation: fadeInUp 0.3s ease-out;
}

/* Scrollbar Styling */
.sidebar-cart-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-cart-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-cart-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar-cart-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Prevent cart icon color change on hover */
.header .header__extra.vue-cart-trigger:hover i,
.header--mobile .header__extra.vue-cart-trigger span i {
    color: inherit !important;
}

/* Checkout button loading state */
.checkout-btn:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

.checkout-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.checkout-loading .spinner {
    width: 18px;
    height: 18px;
    animation: rotate 1s linear infinite;
}

.checkout-loading .spinner .path {
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

