/* =====================================================
   Success Overlay - Enhanced
   ===================================================== */
.success-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.success-overlay.show { display: flex; }

.success-box {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 44px;
    text-align: center;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    0% { transform: scale(0.6) translateY(30px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.success-icon {
    font-size: 64px;
    animation: successBounce 0.6s ease 0.3s both;
}

@keyframes successBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.success-box h2 { font-size: 22px; font-weight: 800; color: var(--success); margin: 14px 0 8px; }
.success-box p { font-size: 15px; color: var(--text-secondary); line-height: 1.8; }

.order-num {
    display: inline-block;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 700;
    padding: 8px 20px;
    border-radius: 10px;
    margin-top: 14px;
    font-size: 16px;
    direction: ltr;
    letter-spacing: 1px;
}

/* Confetti animation */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1001;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* =====================================================
   Toast Notification - Enhanced
   ===================================================== */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    max-width: calc(100vw - 40px);
    border: 1px solid var(--border);
    z-index: 999;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* =====================================================
   Back to Top Button
   ===================================================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 42px;
    height: 42px;
    background: var(--bg-card);
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    z-index: 90;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s;
    pointer-events: none;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.back-to-top:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
}

/* =====================================================
   Back Navigation Button
   ===================================================== */
.back-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px 0;
}

.back-nav button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    padding: 10px 20px 10px 16px;
    border-radius: 50px;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
}

.back-nav button:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--shadow-md);
}

.back-nav button:active {
    transform: scale(0.97);
}

.back-nav .back-arrow {
    font-size: 18px;
    line-height: 1;
    transition: transform 0.2s;
}

.back-nav button:hover .back-arrow {
    transform: translateX(-3px);
}

/* =====================================================
   Floating Cart Button - Large & Clear
   ===================================================== */
.floating-cart {
    position: fixed;
    bottom: 28px;
    left: 28px;
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 22px;
    padding: 16px 24px;
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    font-weight: 700;
    box-shadow:
        0 8px 32px rgba(184, 147, 111, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    z-index: 95;
    text-decoration: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    animation: cartSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

[data-theme="dark"] .floating-cart {
    background: rgba(212, 173, 136, 0.9);
    color: #1a1510;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(212, 173, 136, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .floating-cart:hover {
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(212, 173, 136, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .floating-cart-badge {
    border-color: var(--bg-primary);
}

/* أيقونة SVG */
.floating-cart-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.floating-cart:hover .floating-cart-icon {
    transform: scale(1.1) rotate(-6deg);
}

/* النص */
.floating-cart-label {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1;
}

/* البادج الأحمر - فوق يمين */
.floating-cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    min-width: 26px;
    height: 26px;
    padding: 0 7px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--bg-primary);
    transition: transform 0.3s ease;
    line-height: 1;
}

.floating-cart-badge.bump {
    animation: countBump 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Hover */
.floating-cart:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow:
        0 14px 40px rgba(184, 147, 111, 0.35),
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    color: #fff;
}

.floating-cart:active {
    transform: translateY(-1px) scale(0.98);
    transition-duration: 0.1s;
}

/* أنيميشن الظهور */
@keyframes cartSlideIn {
    0% { transform: translateY(60px) scale(0.8); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes countBump {
    0% { transform: scale(1); }
    50% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* هز الزر لما يضاف منتج */
.floating-cart.shake {
    animation: cartShake 0.5s ease;
}

@keyframes cartShake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-4px) rotate(-2deg); }
    30% { transform: translateX(3px) rotate(1.5deg); }
    45% { transform: translateX(-2px) rotate(-1deg); }
    60% { transform: translateX(1px); }
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
    .floating-cart {
        bottom: 20px;
        left: 20px;
        padding: 14px 18px;
        border-radius: 18px;
        gap: 10px;
    }
    .floating-cart-icon svg { width: 22px; height: 22px; }
    .floating-cart-label { font-size: 14px; }
    .floating-cart-badge {
        min-width: 24px;
        height: 24px;
        font-size: 11px;
        top: -7px;
        right: -7px;
    }
    .back-to-top { bottom: 20px; right: 20px; }
}
