/**
 * Cart Sidebar Styles
 * Peckerwoods Limited - Matched to site design
 */

/* ===== OVERLAY ===== */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    -webkit-backdrop-filter: blur(0px);
    backdrop-filter: blur(0px);
    z-index: 9999;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.cart-overlay.open {
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

/* ===== SIDEBAR CONTAINER ===== */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100%;
    height: 100vh;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    z-index: 10000;
    box-shadow: -8px 0 30px rgba(96, 61, 32, 0.25);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.cart-sidebar.open {
    transform: translateX(0);
}

/* ===== SIDEBAR HEADER ===== */
.sidebar-header {
    padding: 20px 24px;
    border-bottom: 3px solid var(--primary-color, #603D20);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: #ffffff;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--primary-color, #603D20);
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h2::before {
    content: '\f07a';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--primary-color, #603D20);
}

.sidebar-close {
    background: var(--primary-color, #603D20);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: white;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sidebar-close:hover {
    background: var(--secondary-color, #f9d71c);
    color: var(--primary-color, #603D20);
    transform: scale(1.1);
}

/* ===== SIDEBAR CONTENT (SCROLLABLE) ===== */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: #fafafa;
}

/* Custom scrollbar */
.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--primary-color, #603D20);
    border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color, #f9d71c);
}

/* ===== EMPTY CART MESSAGE ===== */
.empty-cart-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    text-align: center;
    padding: 40px 20px;
}

.empty-cart-message i {
    font-size: 4rem;
    color: var(--primary-color, #603D20);
    opacity: 0.3;
    margin-bottom: 20px;
}

.empty-cart-message p {
    margin: 12px 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color, #603D20);
}

.empty-cart-message small {
    font-size: 0.95rem;
    color: #888;
}

/* ===== CART ITEMS ===== */
.cart-item {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 2px solid #eee;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cart-item:hover {
    border-color: var(--primary-color, #603D20);
    box-shadow: 0 4px 15px rgba(96, 61, 32, 0.15);
    transform: translateY(-2px);
}

.item-info {
    margin-bottom: 14px;
}

.item-info h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color, #603D20);
    line-height: 1.4;
}

.item-price {
    margin: 0;
    color: #666;
    font-weight: 500;
    font-size: 0.9rem;
}

/* ===== QUANTITY CONTROLS ===== */
.item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: 2px solid var(--primary-color, #603D20);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    color: var(--primary-color, #603D20);
    font-size: 1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.qty-btn:hover {
    background: var(--primary-color, #603D20);
    color: white;
    transform: scale(1.1);
}

.qty-input {
    width: 50px;
    text-align: center;
    padding: 8px 4px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-weight: 700;
    color: var(--primary-color, #603D20);
    background: white;
    font-size: 0.95rem;
    cursor: default;
}

.qty-input:focus {
    border-color: var(--primary-color, #603D20);
    outline: none;
}

/* ===== ITEM SUBTOTAL AND REMOVE ===== */
.item-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px dashed #ddd;
}

.item-subtotal p {
    margin: 0;
    font-weight: 800;
    color: var(--primary-color, #603D20);
    font-size: 1.1rem;
}

.item-remove {
    background: none;
    border: 2px solid #ddd;
    color: #999;
    cursor: pointer;
    padding: 6px 12px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.item-remove:hover {
    background: #ff4444;
    color: white;
    border-color: #ff4444;
}

/* ===== SIDEBAR FOOTER ===== */
.sidebar-footer {
    padding: 20px 24px;
    border-top: 3px solid var(--primary-color, #603D20);
    background: #ffffff;
    flex-shrink: 0;
}

.sidebar-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--secondary-color, #f9d71c);
}

.sidebar-total span:first-child {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.total-amount {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color, #603D20);
}

/* ===== CHECKOUT BUTTON ===== */
.btn-checkout-sidebar {
    width: 100%;
    padding: 16px 24px;
    background: var(--primary-color, #603D20);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(96, 61, 32, 0.3);
}

.btn-checkout-sidebar:hover {
    background: var(--secondary-color, #f9d71c);
    color: var(--primary-color, #603D20);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(96, 61, 32, 0.4);
}

.btn-checkout-sidebar i {
    font-size: 1.2rem;
}

/* ===== NOTIFICATION ===== */
.cart-notification {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color, #603D20);
    color: white;
    padding: 16px 28px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    z-index: 20000;
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    font-size: 1rem;
    max-width: 90%;
    border-left: 4px solid var(--secondary-color, #f9d71c);
}

.cart-notification.show {
    bottom: 30px;
}

/* ===== FLOATING CART BUTTON ===== */
.cart-float {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: var(--primary-color, #603D20);
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 6px 20px rgba(96, 61, 32, 0.4);
    z-index: 9998;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    border: 3px solid white;
    visibility: visible !important;
    opacity: 1 !important;
}

.cart-float:hover {
    transform: translateY(-4px) scale(1.08);
    box-shadow: 0 12px 30px rgba(96, 61, 32, 0.5);
    background: var(--secondary-color, #f9d71c);
    color: var(--primary-color, #603D20);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #25D366;
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Ensure floating button is always visible on mobile */
@media (max-width: 768px) {
    .cart-float {
        z-index: 99999 !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        bottom: 100px;
    }
}

/* ===== RESPONSIVE: TABLET ===== */
@media (max-width: 768px) {
    .cart-sidebar {
        width: 100%;
        max-width: 100%;
    }
    
    .sidebar-header {
        padding: 16px 20px;
    }
    
    .sidebar-header h2 {
        font-size: 1.25rem;
    }
    
    .sidebar-content {
        padding: 16px;
    }
    
    .cart-item {
        padding: 14px;
    }
    
    .btn-checkout-sidebar {
        padding: 14px 18px;
        font-size: 1rem;
    }
    
    .cart-float {
        bottom: 100px;
        right: 24px;
        width: 60px;
        height: 60px;
    }
}

/* ===== RESPONSIVE: MOBILE ===== */
@media (max-width: 480px) {
    .cart-sidebar {
        width: 100%;
    }

    .sidebar-header {
        padding: 14px 16px;
    }

    .sidebar-header h2 {
        font-size: 1.1rem;
    }
    
    .sidebar-header h2::before {
        font-size: 1rem;
    }

    .sidebar-close {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .sidebar-content {
        padding: 12px;
    }

    .cart-item {
        padding: 12px;
        margin-bottom: 10px;
        border-radius: 10px;
    }

    .item-info {
        margin-bottom: 10px;
    }

    .item-info h4 {
        font-size: 0.9rem;
    }
    
    .item-price {
        font-size: 0.85rem;
    }

    .item-controls {
        gap: 6px;
        margin-bottom: 10px;
    }

    .qty-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .qty-input {
        width: 40px;
        height: 32px;
        padding: 4px 2px;
        font-size: 0.85rem;
    }
    
    .item-subtotal {
        padding-top: 10px;
    }
    
    .item-subtotal p {
        font-size: 1rem;
    }
    
    .item-remove {
        padding: 4px 10px;
        font-size: 0.8rem;
    }

    .sidebar-total {
        margin-bottom: 12px;
        padding-bottom: 10px;
    }
    
    .sidebar-total span:first-child {
        font-size: 0.9rem;
    }

    .total-amount {
        font-size: 1.2rem;
    }

    .btn-checkout-sidebar {
        padding: 14px 16px;
        font-size: 0.9rem;
        gap: 8px;
    }
    
    .btn-checkout-sidebar i {
        font-size: 1rem;
    }

    .cart-notification {
        bottom: -80px;
        font-size: 0.85rem;
        padding: 12px 16px;
        border-radius: 8px;
        max-width: 90%;
        left: 5%;
        transform: none;
    }

    .cart-notification.show {
        bottom: 16px;
        left: 5%;
        transform: none;
    }
    
    /* Floating button */
    .cart-float {
        bottom: 100px;
        right: 20px;
        width: 56px;
        height: 56px;
        font-size: 1.2rem;
    }
    
    .cart-count {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
        top: -6px;
        right: -6px;
    }
}

/* ===== SMALL MOBILE ===== */
@media (max-width: 360px) {
    .sidebar-header {
        padding: 12px 14px;
    }
    
    .sidebar-header h2 {
        font-size: 1rem;
    }
    
    .sidebar-content {
        padding: 10px;
    }
    
    .cart-item {
        padding: 10px;
    }
    
    .qty-btn {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    .qty-input {
        width: 36px;
    }
    
    .btn-checkout-sidebar {
        padding: 12px 14px;
        font-size: 0.85rem;
        flex-direction: column;
        gap: 4px;
    }
    
    .cart-float {
        bottom: 100px;
        right: 16px;
        width: 52px;
        height: 52px;
    }
}

/* ===== Ensure proper touch targets ===== */
@media (hover: none) and (pointer: coarse) {
    /* Better touch targets for mobile */
    .qty-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    .item-remove {
        min-height: 44px;
        min-width: 44px;
        padding: 8px 12px;
    }
    
    .sidebar-close {
        min-width: 44px;
        min-height: 44px;
    }
    
    .btn-checkout-sidebar {
        min-height: 52px;
    }
    
    .cart-float {
        min-width: 60px;
        min-height: 60px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.cart-item.removing {
    animation: slideOutRight 0.3s ease forwards;
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .cart-sidebar,
    .cart-overlay,
    .qty-btn,
    .sidebar-close,
    .cart-notification,
    .cart-float {
        transition: none;
    }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .cart-sidebar {
        background: #1e1e1e;
    }

    .sidebar-header {
        background: #252525;
        border-bottom-color: #333;
    }

    .sidebar-header h2 {
        color: #fff;
    }

    .sidebar-content {
        background: #1e1e1e;
    }

    .cart-item {
        background: #2a2a2a;
        border-color: #333;
    }

    .item-info h4 {
        color: #fff;
    }

    .item-price {
        color: #aaa;
    }

    .sidebar-footer {
        background: #252525;
        border-top-color: #333;
    }

    .sidebar-total {
        border-bottom-color: #444;
    }

    .sidebar-total span:first-child {
        color: #aaa;
    }

    .total-amount {
        color: var(--secondary-color, #f9d71c);
    }

    .qty-input {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }

    .qty-btn {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }

    .qty-btn:hover {
        background: var(--secondary-color, #f9d71c);
        color: #000;
    }

    .item-subtotal {
        border-top-color: #333;
    }

    .item-subtotal p {
        color: var(--secondary-color, #f9d71c);
    }

    .empty-cart-message i {
        color: #555;
    }

    .empty-cart-message p {
        color: #aaa;
    }
}
