/* =========================================
   MixShop DZ - Shared Styles
   Design tokens, reset, and components used by BOTH index.html and product.html
   (header, top banner, cart sidebar, buttons, toast, footer)
   Page-only styles stay in style.css (index) / product.css (product page).
========================================= */

:root {
    --primary: #4F6EF7; --primary-dark: #3B4FD9; --primary-light: #EEF1FE;
    --white: #FDFCFB; --bg: #F6F5F3; --text: #2A2E3A; --text-light: #6B7280;
    --border: #E5E3DF; --danger: #E24C6B; --danger-dark: #C23A57; --success: #22B07D; --warning: #E8A73B; --warning-alt: #F59E0B;
    --wa-color: #25D366; --fb-color: #1877F2; --tg-color: #29A9EB;
    --radius: 16px; --shadow: 0 4px 15px rgba(0,0,0,0.03); --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --space-xs: 6px; --space-sm: 10px; --space-md: 16px; --space-lg: 24px; --space-xl: 32px;
}

body.dark-mode {
    --white: #1E293B; --bg: #0F172A; --text: #F1F5F9; --text-light: #94A3B8;
    --border: #334155; --primary-light: #1E3A8A; --shadow: 0 4px 15px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.6);
}

/* ==================== RESET ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Cairo', sans-serif; background: var(--bg); color: var(--text); transition: background 0.3s, color 0.3s; line-height: 1.6; animation: page-fade-in 0.4s ease both; }
body.page-leaving { animation: none; opacity: 0; transition: opacity 0.2s ease; }
@keyframes page-fade-in { from { opacity: 0; } to { opacity: 1; } }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
img { max-width: 100%; height: auto; }

a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 20px; }

/* ==================== TOAST NOTIFICATION ==================== */
.toast-msg {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(100px);
    background: #1E293B; color: #F8FAFC; padding: 12px 24px; border-radius: 30px;
    font-weight: 700; z-index: 9999; opacity: 0; transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); display: flex; align-items: center; gap: 10px;
    border: 1px solid rgba(255,255,255,0.08);
}
.toast-msg.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ==================== TOP BANNER (announcement bar) ==================== */
.top-banner {
    background: var(--warning);
    color: #0F172A; display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 11px 44px; font-size: 14px; position: relative; font-weight: 700;
    border-bottom: 1px solid rgba(15,23,42,0.08); min-height: 42px;
    animation: banner-slide-in 0.4s ease both;
}
@keyframes banner-slide-in { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.top-banner-icon { font-size: 13px; opacity: 0.9; flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: rgba(15,23,42,0.1); display: flex; align-items: center; justify-content: center; }
.top-banner-content { text-align: center; letter-spacing: 0.2px; }
.top-banner-close { position: absolute; width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #0F172A; opacity: 0.65; font-size: 13px; transition: 0.2s; }
.top-banner-close:hover { opacity: 1; background: rgba(15, 23, 42, 0.15); transform: scale(1.08); }
html[dir="rtl"] .top-banner-close { left: 10px; }
html[dir="ltr"] .top-banner-close { right: 10px; }

/* ==================== HEADER ==================== */
.header { background: var(--white); padding: 12px 20px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--border); transition: var(--transition); }
.header-left, .header-right { display: flex; gap: 10px; align-items: center; }
.header-right { justify-content: flex-end; }
.logo { display: flex; align-items: center; gap: 8px; cursor: pointer; justify-self: center; grid-column: 2; white-space: nowrap; }
.logo i { color: var(--warning); font-size: 24px; }
.logo h1 { font-size: 24px; color: var(--primary); font-weight: 900; }
.logo span { color: var(--text); font-weight: 900; }

.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); color: var(--text); display: flex; align-items: center; justify-content: center; font-size: 16px; transition: var(--transition); }
@media (hover: hover) and (pointer: fine) {
    .icon-btn:hover { background: var(--primary); color: white; border-color: var(--primary); transform: translateY(-2px); }
}
.cart-btn { position: relative; }
.cart-count { position: absolute; top: -5px; right: -5px; background: var(--danger); color: white; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; display: flex; align-items: center; justify-content: center; font-weight: 800; box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4); }

/* ==================== BUTTONS ==================== */
.btn-primary { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 15px; background: var(--primary); color: white; border-radius: 12px; font-weight: 800; font-size: 16px; transition: var(--transition); margin-bottom: 10px; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3); }
.btn-outline { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 14px; background: transparent; color: var(--text); border: 2px solid var(--border); border-radius: 12px; font-weight: 800; font-size: 15px; transition: var(--transition); margin-bottom: 10px; }
.btn-outline:hover { background: var(--bg); border-color: var(--text-light); }

/* ==================== CART SIDEBAR ==================== */
.cart-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); z-index: 200; display: none; backdrop-filter: blur(4px); }
.cart-overlay.show { display: block; }

.cart-sidebar { position: fixed; top: 0; width: 420px; max-width: 100vw; height: 100vh; background: var(--white); z-index: 201; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
html[dir="rtl"] .cart-sidebar { left: -420px; right: auto; border-right: 1px solid var(--border); }
html[dir="rtl"] .cart-sidebar.show { transform: translateX(420px); }
html[dir="ltr"] .cart-sidebar { right: -420px; left: auto; border-left: 1px solid var(--border); }
html[dir="ltr"] .cart-sidebar.show { transform: translateX(-420px); }

.cart-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid var(--border); }
.cart-header h2 { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.cart-header h2 i { color: var(--primary); }
.cart-header button { background: var(--bg); width: 35px; height: 35px; border-radius: 50%; font-size: 16px; color: var(--text); display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.cart-header button:hover { background: var(--danger); color: white; }
.cart-items { flex: 1; overflow-y: auto; padding: 20px; }
.empty-cart { text-align: center; color: var(--text-light); padding: 50px 20px; font-weight: 700; }
.cart-item { display: flex; gap: 15px; padding: 15px 0; border-bottom: 1px solid var(--border); align-items: center; }
.cart-item img { width: 70px; height: 70px; border-radius: 12px; object-fit: contain; background: var(--bg); padding: 5px; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-info h4 { font-size: 15px; margin-bottom: 5px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.cart-item-info p { font-weight: 900; color: var(--primary); font-size: 16px; margin-bottom: 5px; }
.qty-controls { display: flex; align-items: center; gap: 5px; background: var(--bg); border: 1px solid var(--border); width: max-content; border-radius: 8px; padding: 2px; }
.qty-btn { width: 28px; height: 28px; background: var(--white); color: var(--text); border-radius: 6px; font-weight: bold; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); transition: 0.2s; }
.qty-btn:hover { background: var(--primary); color: white; }
.qty-val { width: 30px; text-align: center; font-weight: 800; font-size: 14px; color: var(--text); }
.cart-item-remove { color: var(--danger); background: var(--bg); width: 35px; height: 35px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: 0.2s; flex-shrink: 0; }
.cart-item-remove:hover { background: var(--danger); color: white; }
.cart-total-box { display: flex; justify-content: space-between; align-items: center; padding: 15px 5px; margin-bottom: 15px; border-top: 2px dashed var(--border); font-size: 18px; font-weight: 800; color: var(--text); }
.cart-total-box .price-amount { color: var(--primary); font-size: 22px; font-weight: 900; }
.cart-footer { padding: 20px; border-top: 1px solid var(--border); background: var(--white); }

/* ==================== FOOTER ==================== */
.footer { background: var(--white); color: var(--text); padding: 50px 20px; margin-top: 50px; border-top: 1px solid var(--border); }
.footer-grid { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; }
.footer h3 { margin-bottom: 20px; font-size: 18px; color: var(--primary); font-weight: 900; }
.footer p { font-size: 14px; color: var(--text-light); margin-bottom: 10px; font-weight: 600; }
.footer a { display: flex; align-items: center; gap: 8px; color: var(--text-light); margin-bottom: 12px; font-size: 14px; font-weight: 600; transition: var(--transition); }
.footer a:hover { color: var(--primary); transform: translateX(-5px); }
html[dir="ltr"] .footer a:hover { transform: translateX(5px); }
.social-contact-icons { display: flex; gap: 15px; font-size: 24px; margin-top: 10px; }
.social-contact-icons i { color: var(--primary); cursor: pointer; transition: var(--transition); }
.social-contact-icons i:hover { color: var(--primary-dark); transform: translateY(-3px); }

/* ==================== SHARED RESPONSIVE (header/banner/cart/footer only) ==================== */
@media (max-width: 768px) {
    .top-banner { padding: 10px 40px; gap: 6px; }
    .top-banner-icon { display: none; }
    .top-banner-content { font-size: 12.5px; }
    .header { padding: 12px 10px; }
    .logo h1 { font-size: 20px; }
    .icon-btn { width: 35px; height: 35px; font-size: 14px; }

    .cart-sidebar { width: 100vw; }
    html[dir="rtl"] .cart-sidebar { left: -100vw; }
    html[dir="rtl"] .cart-sidebar.show { transform: translateX(100vw); }
    html[dir="ltr"] .cart-sidebar { right: -100vw; }
    html[dir="ltr"] .cart-sidebar.show { transform: translateX(-100vw); }

    .cart-header { padding: 15px; }
    .cart-items { padding: 15px; }
    .cart-item { padding: 10px 0; gap: 10px; }
    .cart-item img { width: 60px; height: 60px; }
    .cart-item-info h4 { font-size: 13px; }
    .qty-btn { width: 24px; height: 24px; }
    .qty-val { width: 24px; font-size: 12px; }
    .cart-item-remove { width: 30px; height: 30px; font-size: 14px; }
    .cart-total-box { font-size: 16px; margin-bottom: 10px; }
    .cart-total-box .price-amount { font-size: 18px; }
    .cart-footer { padding: 15px; }
}