/* RTL Base */
html, body { direction: rtl; }

/* Tailwind space-x auto-reverse in RTL */
[dir="rtl"] [class*="space-x-"] { --tw-space-x-reverse: 1; }
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800;900&display=swap');
* {
    font-family: 'Cairo', sans-serif;
}

body {
    overflow-x: hidden;
}

/* ============================================
   ENHANCED PRODUCT CARD ANIMATIONS
   ============================================ */

/* Product Card - Smooth & Professional */
.product-card {
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    will-change: transform;
}

.product-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* Product Image - Enhanced Zoom */
.product-image-wrapper {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 1rem;
}

.product-image {
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.product-card:hover .product-image {
    transform: scale(1.12) rotate(1deg);
}

/* Quick Actions - Smooth Reveal */
.quick-actions {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: opacity, transform;
}

.product-card:hover .quick-actions {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Action Button Press Effect */
.quick-actions button,
.quick-actions a {
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quick-actions button:active,
.quick-actions a:active {
    transform: scale(0.92);
}

/* Icon Buttons Hover */
.icon-action {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.icon-action:hover {
    transform: scale(1.15) rotate(5deg);
}

.icon-action:active {
    transform: scale(0.95);
}

/* ============================================
   ENHANCED MODAL & SIDEBARS
   ============================================ */

/* Quick View Modal - Professional */
.modal-backdrop {
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.65);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    animation: modalSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center;
}

@keyframes modalSlideUp {
    0% {
        opacity: 0;
        transform: translateY(60px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Cart Sidebar - Smooth Slide */
.cart-sidebar {
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: -10px 0 50px rgba(0, 0, 0, 0.15);
}

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

/* Cart Item Animation */
.cart-item {
    animation: cartItemFadeIn 0.3s ease-out;
}

@keyframes cartItemFadeIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   SCROLLBAR & UI ELEMENTS
   ============================================ */

/* Enhanced Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #6b7280 0%, #4b5563 100%);
    border-radius: 10px;
    border: 2px solid #f9fafb;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #4b5563 0%, #374151 100%);
    border-color: #f3f4f6;
}

/* Search Dropdown Animation */
#search-dropdown {
    animation: dropdownSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Badge Pulse Animation */
.badge-pulse {
    animation: badgePulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}
            animation: slideDown 0.3s ease-out;
        }

        @keyframes slideDown {
            from {
                opacity: 0;
                transform: translateY(-10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Cart Item الكمية Button Animations */
        .quantity-btn {
            transition: all 0.2s ease;
        }

        .quantity-btn:active {
            transform: scale(0.95);
        }

        /* Sale Banner Animation */
        @keyframes slideText {
            0% { transform: translateX(0); }
            100% { transform: translateX(-50%); }
        }

        .animate-slide {
            animation: slideText 15s linear infinite;
        }

        /* Line clamp utility */
        .line-clamp-2 {
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

/* --- Nassaj Enhancements --- */
.toast-root{
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}
.toast{
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 12px;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.95);
  box-shadow: 0 12px 35px rgba(0,0,0,.12);
  backdrop-filter: blur(10px);
  animation: toastIn .22s ease-out;
}
.toast-hide{ animation: toastOut .22s ease-in forwards; }
.toast-icon{
  height: 34px; width: 34px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  background: rgba(0,0,0,.06);
  color: #111827;
  flex: 0 0 auto;
}
.toast-title{ font-weight: 900; color: #111827; font-size: 13px; }
.toast-msg{ color: #4B5563; font-weight: 700; font-size: 12px; line-height: 1.5; margin-top: 2px; }
.toast-close{
  margin-right: auto;
  height: 30px; width: 30px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.10);
  background: transparent;
  color: #6B7280;
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
}
.toast-success .toast-icon{ background: rgba(16,185,129,.12); color: rgb(6,95,70); }
.toast-danger .toast-icon{ background: rgba(239,68,68,.12); color: rgb(153,27,27); }
.toast-info .toast-icon{ background: rgba(59,130,246,.12); color: rgb(30,64,175); }

@keyframes toastIn{
  from { transform: translateY(-6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes toastOut{
  to { transform: translateY(-6px); opacity: 0; }
}

.view-toggle button{
  height: 42px;
  padding: 0 14px;
  border-radius: 18px;
  border: 1px solid #E5E7EB;
  font-weight: 800;
}
.view-toggle button.is-active{
  background: #111827;
  color: #fff;
  border-color: #111827;
}

/* --- Product Card (Icons + Hover) --- */
.product-card{
  position: relative;
}
.product-card .card-actions{
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 8px;
  z-index: 10;
  opacity: 0;
  transform: translateY(-4px);
  transition: all .2s ease;
}
.product-card:hover .card-actions{
  opacity: 1;
  transform: translateY(0);
}
.icon-btn{
  height: 40px;
  width: 40px;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover{ background: white; }
.icon-btn.is-active{
  background: #111827;
  border-color: #111827;
  color: #fff;
}
.icon-btn svg{ width: 18px; height: 18px; }

.suggest-item{
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
}
.suggest-item:hover{ background: #F9FAFB; }
.suggest-thumb{
  height: 36px; width: 44px;
  border-radius: 14px;
  overflow: hidden;
  background: #F3F4F6;
  flex: 0 0 auto;
}
.suggest-thumb img{ height: 100%; width: 100%; object-fit: cover; }

/* Drawer animation */
.drawer-open aside{ animation: drawerIn .22s ease-out; }
@keyframes drawerIn { from { transform: translateX(-10px); opacity: .7; } to { transform: translateX(0); opacity: 1; } }

/* --- Unified Card Design (Modern) --- */
.card-unified{
  position: relative;
  background: #fff;
  border-radius: 28px;
  overflow: visible;
  transition: all .25s cubic-bezier(.4,0,.2,1);
}
.card-unified:hover{
  transform: translateY(-4px);
}

.card-unified .card-img-wrap{
  position: relative;
}

.card-unified .card-badge{
  position: absolute;
  top: 16px;
  left: 16px;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.card-unified .card-top-actions{
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.card-unified .card-icon-btn{
  height: 44px;
  width: 44px;
  border-radius: 999px;
  border: none;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(10px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.card-unified .card-icon-btn:hover{
  background: white;
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
.card-unified .card-icon-btn.is-active{
  background: #111827;
  color: #fff;
}
.card-unified .card-icon-btn svg{
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.card-unified .card-bottom-actions{
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  opacity: 0;
  transform: translateY(8px);
  transition: all .25s ease;
  z-index: 10;
}
.card-unified:hover .card-bottom-actions{
  opacity: 1;
  transform: translateY(0);
}

.card-unified .card-action-btn{
  height: 48px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: all .2s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  transform: translateY(0);
  will-change: transform;
}
.card-unified .card-action-btn:active{
  transform: scale(0.95);
}
.card-unified .card-action-btn.primary{
  background: #111827;
  color: #fff;
}
.card-unified .card-action-btn.primary:hover{
  background: #000;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.card-unified .card-action-btn.secondary{
  background: rgba(255,255,255,.95);
  color: #111827;
  border: 1px solid rgba(0,0,0,.08);
}
.card-unified .card-action-btn.secondary:hover{
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}

.card-unified .card-content{
  padding: 20px 4px 4px;
  cursor: pointer;
  transition: opacity .2s ease;
}
.card-unified .card-content:hover{
  opacity: 0.85;
}

.card-unified .card-category{
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #6B7280;
  margin-bottom: 8px;
}

.card-unified .card-title{
  font-size: 15px;
  font-weight: 900;
  color: #111827;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .2s ease;
  margin-bottom: 10px;
}
.card-unified a:hover .card-title{
  color: #4B5563;
}

.card-unified .card-colors{
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.card-unified .color-dot{
  height: 32px;
  width: 32px;
  border-radius: 999px;
  border: 2px solid #E5E7EB;
  cursor: pointer;
  transition: all .2s ease;
  padding: 0;
}
.card-unified .color-dot:hover{
  transform: scale(1.1);
  border-color: #111827;
}
.card-unified .color-dot[style*="#FFFFFF"],
.card-unified .color-dot[style*="#ffffff"]{
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}

.card-unified .card-price-row{
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 6px;
}

.card-unified .card-price{
  font-size: 20px;
  font-weight: 900;
  color: #111827;
  direction: ltr;
  text-align: right;
}

.card-unified .card-price-old{
  font-size: 15px;
  font-weight: 800;
  color: #D1D5DB;
  text-decoration: line-through;
  direction: ltr;
}

.card-unified .card-stock-warning{
  font-size: 11px;
  font-weight: 800;
  color: #DC2626;
}

/* --- Product Card V2 (Reference Style - LEGACY) --- */
.card-v2{
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid #E5E7EB;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}
.card-v2 .img-wrap{
  position: relative;
  background: #F3F4F6;
}
.card-v2 .badge{
  position: absolute;
  top: 12px;
  left: 12px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.badge-new{ background: #CDEB7B; color: #111827; }
.badge-sale{ background: #CDEB7B; color: #111827; }
.badge-limited{ background: #EDE9FE; color: #4C1D95; }
.badge-hot{ background: #DCFCE7; color: #065F46; }

.card-v2 .top-icons{
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-v2 .top-icons .icon-btn{
  height: 44px; width: 44px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.08);
}

.card-v2 .overlay-actions{
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  opacity: 0;
  transform: translateY(6px);
  transition: all .22s ease;
}
.card-v2:hover .overlay-actions{
  opacity: 1;
  transform: translateY(0);
}
.card-v2 .pill-btn{
  height: 48px;
  border-radius: 999px;
  font-weight: 900;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
}
.card-v2 .pill-btn.primary{
  background: #111827;
  color: #fff;
  border-color: #111827;
}
.card-v2 .thumbs{
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* Variants (show on hover) */
.variant-swatches{
  display: flex;
  gap: 10px;
  margin-top: 12px;
  opacity: 0;
  transform: translateY(6px);
  transition: all .22s ease;
}
.card-v2:hover .variant-swatches{
  opacity: 1;
  transform: translateY(0);
}
.variant-swatches .swatch{
  height: 44px;
  width: 44px;
  border-radius: 16px;
  border: 1px solid #E5E7EB;
  background: #F3F4F6;
  overflow: hidden;
}
.variant-swatches .swatch[style*="#FFFFFF"],
.variant-swatches .swatch[style*="#ffffff"]{
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.card-v2 .thumb{
  height: 44px; width: 44px;
  border-radius: 16px;
  overflow: hidden;
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
}
.card-v2 .thumb.active{
  outline: 3px solid rgba(17,24,39,.12);
}
.price-line{
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.price-old{
  color: #9CA3AF;
  text-decoration: line-through;
  font-weight: 800;
}
.price-badge{
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #CDEB7B;
  color: #111827;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
}

/* --- Drawer Animation (RTL Left) --- */
#cart-drawer > aside{
  transform: translateX(-100%);
  transition: transform .25s ease;
}
#cart-drawer.drawer-open > aside{
  transform: translateX(0);
}
/* prevent background scroll already handled */

/* ============================================
   ENHANCED TOAST NOTIFICATIONS
   ============================================ */

.toast {
    animation: toastSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.toast-hide {
    animation: toastSlideOut 0.3s ease-in forwards;
}

@keyframes toastSlideOut {
    to {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }
}

/* Toast Success with Icon Animation */
.toast-success .toast-icon {
    animation: iconSuccess 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes iconSuccess {
    0% { transform: scale(0) rotate(-180deg); }
    50% { transform: scale(1.2) rotate(0deg); }
    100% { transform: scale(1); }
}

/* ============================================
   LOADING STATES & SKELETON
   ============================================ */

.loading-skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s ease-in-out infinite;
}

@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-spinner {
    border: 3px solid #f3f4f6;
    border-top-color: #111827;
    border-radius: 50%;
    animation: spinnerRotate 0.8s linear infinite;
}

@keyframes spinnerRotate {
    to { transform: rotate(360deg); }
}

/* ============================================
   BUTTON PRESS EFFECTS
   ============================================ */

.btn-press {
    transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-press:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* ============================================
   IMAGE GALLERY ENHANCEMENTS
   ============================================ */

.thumbnail-item {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.thumbnail-item:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.thumbnail-item.active {
    border: 3px solid #111827;
    transform: scale(1.08);
}

/* ============================================
   COLOR & SIZE SELECTORS
   ============================================ */

.color-option {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.color-option:hover {
    transform: scale(1.15);
}

.color-option.selected {
    border: 3px solid #111827;
    transform: scale(1.2);
}

.size-option {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

.size-option:hover {
    background: #f3f4f6;
    transform: scale(1.05);
}

.size-option.selected {
    background: #111827;
    color: white;
    transform: scale(1.1);
}

/* ============================================
   RATING STARS ANIMATION
   ============================================ */

.star-rating {
    display: inline-flex;
    gap: 2px;
}

.star-rating svg {
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.star-rating:hover svg {
    transform: scale(1.15);
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 768px) {
    .product-card:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

:focus-visible {
    outline: 3px solid #CDEB7B;
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    box-shadow: 0 0 0 3px rgba(205, 235, 123, 0.5);
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.gpu-accelerate {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}


/* ========== Enhanced Active State Styles ========== */
button[data-color],
button[data-size],
button[data-material],
.h-12.px-5 {
  transition: all 0.2s ease;
}

button[data-color].!border-gray-900,
button[data-size].!border-gray-900,
button[data-material].!border-gray-900 {
  border-width: 4px !important;
  border-color: #111827 !important;
  background-color: #f9fafb !important;
  font-weight: 900 !important;
}

.ring-2 {
  box-shadow: 0 0 0 2px #111827;
}

.ring-offset-2 {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111827;
}
