/* ========================================
   CART DRAWER - Accessible Shopping Cart
   ======================================== */

/* Cart Toggle Button */
.cart-toggle-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.cart-toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.cart-toggle-btn:focus {
    outline: 2px solid var(--color-primary, #007bff);
    outline-offset: 2px;
}

/* Cart Count Badge */
.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--color-primary, #007bff);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    min-width: 20px;
}

.cart-count:empty {
    display: none;
}

/* Cart Drawer Container */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-drawer.cart-drawer--open {
    pointer-events: auto;
    opacity: 1;
}

/* Cart Drawer Overlay */
.cart-drawer__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

/* Cart Drawer Content */
.cart-drawer__content {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 480px;
    height: 100%;
    background-color: #ffffff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

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

/* Cart Header */
.cart-drawer__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e1e1e1;
    flex-shrink: 0;
}

.cart-drawer__title {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-text-primary, #333);
}

.cart-drawer__close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    color: var(--color-text-secondary, #666);
    transition: all 0.2s ease;
}

.cart-drawer__close:hover {
    background-color: #f5f5f5;
    color: var(--color-text-primary, #333);
}

.cart-drawer__close:focus {
    outline: 2px solid var(--color-primary, #007bff);
    outline-offset: 2px;
}

/* Cart Body */
.cart-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

/* Cart Items List */
.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Individual Cart Item */
.cart-item {
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.cart-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Main Product Item */
.cart-item--main {
    border-left: 4px solid var(--color-primary, #007bff);
}

/* Cart Item Header */
.cart-item__header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background-color: #ffffff;
}

.cart-item__image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    background-color: #f5f5f5;
}

.cart-item__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item__details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;

}

.cart-item__title {
    margin: 0 0 0.5rem 0;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--color-text-primary, #333);
    line-height: 1.3;
}

.cart-item__variant {
    margin: 0 0 0.5rem 0;
    font-size: 1.4rem;
    color: var(--color-text-secondary, #666);
}

.cart-item__price {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--color-primary, #007bff);
}

.cart-item__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.cart-item__remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    color: var(--color-danger, #dc3545);
    transition: all 0.2s ease;
}

.cart-item__remove:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

.cart-item__remove:focus {
    outline: 2px solid var(--color-danger, #dc3545);
    outline-offset: 2px;
}

/* Accordion Toggle for Properties */
.cart-item__toggle {
    background: none;
    border: 1px solid #e1e1e1;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: 1.2rem;
    color: var(--color-text-secondary, #666);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    width: fit-content;
    margin-top: 0.25rem;
    align-self: end;
}

.cart-item__toggle:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

.cart-item__toggle svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

.cart-item__toggle--expanded svg {
    transform: rotate(180deg);
}

/* Properties Panel */
.cart-item__properties {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: #f8f9fa;
}

.cart-item__properties--expanded {
    max-height: 200px;
}

.cart-item__properties-content {
    padding: 0.75rem;
    border-top: 1px solid #e1e1e1;
}

.cart-item__property {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid #e9ecef;
}

.cart-item__property:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.cart-item__property-label {
    font-weight: 500;
    color: var(--color-text-primary, #333);
    margin-right: 1rem;
    font-size: 1.2rem;
    min-width: 80px;
    flex-shrink: 0;
}

.cart-item__property-value {
    color: var(--color-text-secondary, #666);
    text-align: right;
    word-break: break-word;
    font-size: 1.2rem;
}

/* Addons Container */
.cart-item__addons {
    border-top: 1px solid #e1e1e1;
    background-color: #f8f9fa;
}

.cart-addon {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e1e1e1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.cart-addon:last-child {
    border-bottom: none;
}

.cart-addon__details {
    flex: 1;
}

.cart-addon__title {
    margin: 0 0 0.25rem 0;
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--color-text-primary, #333);
}

.cart-addon__option {
    margin: 0;
    font-size: 1.28rem;
    color: var(--color-text-secondary, #666);
}

.cart-addon__price {
    font-size: 1.44rem;
    font-weight: 600;
    color: var(--color-success, #28a745);
}

/* Empty State */
.cart-empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.cart-empty-state__icon {
    margin-bottom: 1rem;
    color: var(--color-text-secondary, #666);
}

.cart-empty-state__title {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-primary, #333);
}

.cart-empty-state__text {
    margin: 0;
    color: var(--color-text-secondary, #666);
}

/* Cart Footer */
.cart-drawer__footer {
    border-top: 1px solid #e1e1e1;
    padding: 1.5rem;
    background-color: #ffffff;
    flex-shrink: 0;
}

.cart-subtotal {
    margin-bottom: 1.5rem;
}

.cart-subtotal__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.cart-subtotal__label {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--color-text-primary, #333);
}

.cart-subtotal__amount {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-primary, #007bff);
}

.cart-subtotal__note {
    font-size: 1.4rem;
    color: var(--color-text-secondary, #666);
    display: none;
}

/* Cart Actions */
.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cart-btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1.6rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
}

.cart-btn:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--color-primary, #007bff);
}

.cart-btn--primary {
    background-color: var(--color-primary, #007bff);
    color: white;
}

.cart-btn--primary:hover {
    background-color: var(--color-primary-dark, #0056b3);
}

.cart-btn--secondary {
    background-color: transparent;
    color: var(--color-primary, #007bff);
    border: 1px solid var(--color-primary, #007bff);
}

.cart-btn--secondary:hover {
    background-color: var(--color-primary, #007bff);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cart-drawer__content {
        width: 100%;
        max-width: none;
    }

    .cart-item__header {
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .cart-item__image {
        width: 60px;
        height: 60px;
    }

    .cart-item__title {
        font-size: 0.9rem;
    }

    .cart-drawer__footer {
        padding: 1rem;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .cart-drawer__content {
        border: 2px solid #000;
    }

    .cart-item {
        border-width: 2px;
    }

    .cart-item__toggle,
    .cart-btn--secondary {
        border-width: 2px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .cart-drawer,
    .cart-drawer__content,
    .cart-item__properties,
    .cart-item__toggle svg {
        transition: none;
    }
}

/* Focus Visible Support */
.cart-toggle-btn:focus-visible,
.cart-drawer__close:focus-visible,
.cart-item__remove:focus-visible,
.cart-item__toggle:focus-visible,
.cart-btn:focus-visible {
    outline: 2px solid var(--color-primary, #007bff);
    outline-offset: 2px;
}