/* ============================================
   KREA CYBERGCODE - Cart Sidebar Premium
   ============================================ */

/* ---- CART FLOATING BUTTON ---- */
.cart-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
    color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 26px;
    box-shadow: 0 8px 30px rgba(147, 51, 234, 0.4);
    z-index: 1050;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
}
.cart-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(147, 51, 234, 0.55);
}
.cart-float-btn .cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: cartBadgePop 0.3s ease;
}
@keyframes cartBadgePop {
    0% { transform: scale(0); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ---- OVERLAY ---- */
.cart-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ---- SIDEBAR ---- */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -460px;
    width: 440px;
    max-width: 95vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 2001;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 60px rgba(0, 0, 0, 0.15);
    transition: right 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.cart-sidebar.active {
    right: 0;
}

/* ---- SIDEBAR HEADER ---- */
.cart-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.cart-sidebar-header h2 {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.cart-sidebar-header .cart-item-count {
    background: linear-gradient(135deg, #9333ea 0%, #d946ef 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}
.cart-sidebar-close {
    background: #f8fafc;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #64748b;
}
.cart-sidebar-close:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* ---- SIDEBAR BODY ---- */
.cart-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
}
.cart-sidebar-body::-webkit-scrollbar { width: 5px; }
.cart-sidebar-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }

/* ---- EMPTY STATE ---- */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94a3b8;
    text-align: center;
    gap: 15px;
}
.cart-empty svg { opacity: 0.4; }
.cart-empty p { font-size: 15px; font-weight: 500; }

/* ---- CART ITEM ---- */
.cart-item {
    display: flex;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
    animation: cartItemSlide 0.3s ease;
}
@keyframes cartItemSlide {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}
.cart-item-img {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    background: #f8fafc;
    flex-shrink: 0;
}
.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}
.cart-item-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    line-height: 1.3;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-custom {
    font-size: 11px;
    color: #9333ea;
    font-weight: 500;
    font-style: italic;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-price {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}
.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}
.cart-qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #475569;
    font-weight: 700;
}
.cart-qty-btn:hover {
    background: #f1f5f9;
    border-color: #9333ea;
    color: #9333ea;
}
.cart-qty-val {
    font-size: 14px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
    color: #0f172a;
}
.cart-item-remove {
    position: absolute;
    top: 18px;
    right: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #cbd5e1;
    transition: color 0.2s;
    padding: 4px;
}
.cart-item-remove:hover {
    color: #ef4444;
}

/* ---- SIDEBAR FOOTER ---- */
.cart-sidebar-footer {
    padding: 20px 28px 28px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
    background: #fff;
}
.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.cart-total-label {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.cart-total-value {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
}
.cart-checkout-btn {
    width: 100%;
    padding: 16px;
    background: #25D366;
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s;
    font-family: inherit;
}
.cart-checkout-btn:hover {
    background: #1eb954;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.35);
}
.cart-checkout-btn:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.cart-clear-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: #94a3b8;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    margin-top: 10px;
    font-family: inherit;
}
.cart-clear-btn:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* ---- NAME MODAL (for checkout) ---- */
.cart-name-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
}
.cart-name-modal.active {
    display: flex;
}
.cart-name-modal-content {
    background: #fff;
    border-radius: 20px;
    padding: 36px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    animation: cartModalIn 0.3s ease;
}
@keyframes cartModalIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.cart-name-modal-content h3 {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px 0;
}
.cart-name-modal-content p {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 20px 0;
}
.cart-name-modal-content input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
    margin-bottom: 20px;
}
.cart-name-modal-content input:focus {
    border-color: #9333ea;
}
.cart-name-modal-actions {
    display: flex;
    gap: 10px;
}
.cart-name-modal-actions button {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.cart-name-modal-actions .btn-cancel {
    background: #f1f5f9;
    color: #64748b;
}
.cart-name-modal-actions .btn-cancel:hover {
    background: #e2e8f0;
}
.cart-name-modal-actions .btn-send {
    background: #25D366;
    color: #fff;
}
.cart-name-modal-actions .btn-send:hover {
    background: #1eb954;
}

/* ---- PERSONALIZATION MODAL ---- */
.cart-custom-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
}
.cart-custom-modal.active {
    display: flex;
}
.cart-custom-modal-content {
    background: #fff;
    border-radius: 20px;
    padding: 36px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
    animation: cartModalIn 0.3s ease;
}
.cart-custom-modal-content h3 {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px 0;
}
.cart-custom-modal-content .custom-prod-name {
    font-size: 13px;
    color: #9333ea;
    font-weight: 600;
    margin: 0 0 20px 0;
}
.cart-custom-modal-content label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.cart-custom-modal-content textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
    resize: vertical;
    min-height: 80px;
    margin-bottom: 16px;
}
.cart-custom-modal-content textarea:focus {
    border-color: #9333ea;
}
.cart-custom-modal-actions {
    display: flex;
    gap: 10px;
}
.cart-custom-modal-actions button {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.cart-custom-modal-actions .btn-cancel {
    background: #f1f5f9;
    color: #64748b;
}
.cart-custom-modal-actions .btn-cancel:hover {
    background: #e2e8f0;
}
.cart-custom-modal-actions .btn-add {
    background: linear-gradient(135deg, #9333ea 0%, #d946ef 100%);
    color: #fff;
}
.cart-custom-modal-actions .btn-add:hover {
    opacity: 0.9;
}

/* ---- Toast notification for cart ---- */
.cart-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #0f172a;
    color: #fff;
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    z-index: 4000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}
.cart-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
    .cart-sidebar {
        width: 100vw;
        right: -100vw;
    }
    .cart-float-btn {
        bottom: 20px;
        right: 20px;
        width: 52px;
        height: 52px;
        font-size: 22px;
    }
}
