/* ============================================
   LURAN — Professional Animations & Polish
   ============================================ */

/* ===== Page-load entrance (subtle, no jank) ===== */
@keyframes luran-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes luran-fade-in-up {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes luran-fade-in-scale {
    from { opacity: 0; transform: scale(.96); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes luran-shimmer {
    0%   { background-position: -468px 0; }
    100% { background-position: 468px 0; }
}
@keyframes luran-pulse-soft {
    0%, 100% { opacity: 1; }
    50%      { opacity: .55; }
}
@keyframes luran-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
@keyframes luran-spin {
    to { transform: rotate(360deg); }
}
@keyframes luran-slide-in-right {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes luran-slide-in-left {
    from { opacity: 0; transform: translateX(-24px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes luran-bounce-in {
    0%   { opacity: 0; transform: scale(.6); }
    60%  { opacity: 1; transform: scale(1.04); }
    100% { transform: scale(1); }
}

/* Apply gentle entrance to common building blocks */
.section-title, .section-subtitle { animation: luran-fade-in-up .6s ease both; }
.hero-content > * { animation: luran-fade-in-up .7s ease both; }
.hero-content > *:nth-child(2) { animation-delay: .08s; }
.hero-content > *:nth-child(3) { animation-delay: .16s; }
.hero-content > *:nth-child(4) { animation-delay: .24s; }

.product-card,
.brand-card,
.feature-card,
.card {
    animation: luran-fade-in-up .5s ease both;
}

/* Staggered grid entrance — light on perf, fixed delays */
.grid-products .product-card:nth-child(1)  { animation-delay: .05s; }
.grid-products .product-card:nth-child(2)  { animation-delay: .10s; }
.grid-products .product-card:nth-child(3)  { animation-delay: .15s; }
.grid-products .product-card:nth-child(4)  { animation-delay: .20s; }
.grid-products .product-card:nth-child(5)  { animation-delay: .25s; }
.grid-products .product-card:nth-child(6)  { animation-delay: .30s; }
.grid-products .product-card:nth-child(7)  { animation-delay: .35s; }
.grid-products .product-card:nth-child(8)  { animation-delay: .40s; }

/* ===== Hero polish ===== */
.hero {
    background:
        radial-gradient(circle at 85% 15%, rgba(var(--brand-rgb), .14), transparent 55%),
        radial-gradient(circle at 12% 80%, rgba(var(--brand-rgb), .08), transparent 60%),
        linear-gradient(135deg, var(--bg-header) 0%, var(--bg-main) 100%);
    overflow: hidden;
    position: relative;
}
.hero::before {
    content: "";
    position: absolute;
    width: 320px; height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--brand-rgb), .25), transparent 70%);
    top: -80px; right: -80px;
    animation: luran-float 6s ease-in-out infinite;
}
body[dir="rtl"] .hero::before { right: auto; left: -80px; }
.hero-decoration {
    position: absolute;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--brand-rgb), .18), transparent 70%);
    bottom: -60px; left: 30%;
    animation: luran-float 8s ease-in-out infinite reverse;
    pointer-events: none;
}
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 18px;
    background: rgba(var(--brand-rgb), .12);
    color: var(--brand-dark);
    border-radius: var(--radius-full);
    font-size: .85rem;
    font-weight: 600;
    backdrop-filter: blur(6px);
    margin-bottom: 16px;
}
.hero-content { position: relative; z-index: 2; max-width: 620px; }
.hero-content h1 { font-size: clamp(1.8rem, 4vw, 3rem); line-height: 1.15; margin-bottom: 16px; }
.hero-content p { color: var(--text-secondary); font-size: 1.05rem; line-height: 1.7; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* ===== Buttons — refined hover & ripple-feel ===== */
.btn {
    position: relative;
    overflow: hidden;
    transition: transform .22s ease, box-shadow .22s ease, background .22s ease, color .22s ease;
}
.btn::before {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,.35), transparent 60%);
    opacity: 0;
    transition: opacity .25s ease;
    pointer-events: none;
}
.btn:hover::before { opacity: 1; }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary:hover { box-shadow: 0 12px 28px rgba(var(--brand-rgb), .35); }

/* ===== Cards — elevation on hover ===== */
.card,
.product-card,
.brand-card,
.feature-card,
.checkout-summary {
    transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease, border-color .25s ease;
    will-change: transform;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.feature-card { border-radius: var(--radius); background: var(--bg-main); box-shadow: var(--shadow-sm); }
.feature-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.feature-card-icon { transition: transform .3s ease; }
.feature-card:hover .feature-card-icon { transform: scale(1.08) rotate(-6deg); }

/* ===== Product card polish ===== */
.product-card { background: var(--bg-card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.product-card-img { position: relative; overflow: hidden; aspect-ratio: 4/5; background: var(--bg-section); }
.product-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.product-card:hover .product-card-img img { transform: scale(1.07); }
.product-card-wishlist {
    position: absolute; top: 12px;
    inset-inline-end: 12px;
    width: 38px; height: 38px;
    background: rgba(255,255,255,.92);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: none; cursor: pointer;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    transform: translateY(-4px);
    opacity: 0;
}
.product-card:hover .product-card-wishlist { opacity: 1; transform: translateY(0); }
.product-card-wishlist:hover { background: var(--brand); color: #fff; }
.product-card-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card-category { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.product-card-name { font-size: 1rem; font-weight: 600; line-height: 1.4; min-height: 2.8em; }
.product-card-name a { color: inherit; }
.product-card-name a:hover { color: var(--brand); }
.product-card-rating { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--text-muted); }
.product-card-rating .stars { color: #f5a623; letter-spacing: 1px; }
.product-card-price { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.product-card-actions { margin-top: 10px; display: flex; gap: 8px; }

/* Sale badge animated entry */
.sale-badge { animation: luran-bounce-in .5s ease both; }

/* ===== Section titles get an underline accent ===== */
.section-title { position: relative; display: inline-block; padding-bottom: 6px; }
.section-title::after {
    content: "";
    position: absolute;
    inset-inline-start: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 64px; height: 3px;
    background: linear-gradient(90deg, var(--brand-light), var(--brand));
    border-radius: var(--radius-full);
    transition: width .4s ease;
}
.section .container > .section-title:hover::after { width: 120px; }
body[dir="rtl"] .section-title::after { transform: translateX(50%); }

/* ===== Form polish ===== */
input, textarea, select {
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12);
    background: var(--bg-main);
}

/* ===== Alerts get an entrance + accent ===== */
.alert { animation: luran-fade-in .35s ease both; border-left: 4px solid transparent; }
body[dir="rtl"] .alert { border-left: none; border-right: 4px solid transparent; }
.alert-success { border-color: var(--success); }
.alert-error   { border-color: var(--danger); }

/* ===== Admin layout polish ===== */
.admin-card,
.stat-card,
.form-section-card {
    transition: transform .25s ease, box-shadow .25s ease;
}
.stat-card { animation: luran-fade-in-up .45s ease both; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card-icon { transition: transform .25s ease; }
.stat-card:hover .stat-card-icon { transform: scale(1.08) rotate(-4deg); }

.admin-card { animation: luran-fade-in .35s ease both; }
.admin-card:hover { box-shadow: var(--shadow-md); }

.admin-table tbody tr {
    transition: background .15s ease, transform .15s ease;
}
.admin-table tbody tr:hover {
    background: rgba(var(--brand-rgb), .04);
}

.admin-nav-item {
    position: relative;
    transition: var(--transition);
}
.admin-nav-item::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 0;
    background: var(--brand);
    border-radius: var(--radius-full);
    transition: height .25s ease;
}
.admin-nav-item:hover { background: rgba(var(--brand-rgb), .06); }
.admin-nav-item.active { background: rgba(var(--brand-rgb), .1); color: var(--brand); }
.admin-nav-item.active::before { height: 22px; }

.status-badge { animation: luran-fade-in .3s ease both; transition: transform .15s ease; }
.status-badge:hover { transform: scale(1.04); }

/* ===== Skeleton loader (for future use) ===== */
.luran-skeleton {
    background: linear-gradient(90deg, #f1f1f5 0%, #fafafd 50%, #f1f1f5 100%);
    background-size: 936px 100%;
    animation: luran-shimmer 1.4s ease-in-out infinite;
    border-radius: var(--radius-sm);
    min-height: 16px;
}

/* ===== Small loader spinner ===== */
.luran-spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid rgba(var(--brand-rgb), .2);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: luran-spin .7s linear infinite;
    vertical-align: middle;
}

/* ===== Smooth scroll & global polish ===== */
html { scroll-behavior: smooth; }

::selection { background: rgba(var(--brand-rgb), .25); color: var(--text-primary); }

/* Custom scrollbar (desktop) */
@media (hover: hover) {
    ::-webkit-scrollbar { width: 10px; height: 10px; }
    ::-webkit-scrollbar-track { background: var(--bg-section); }
    ::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, var(--brand-light), var(--brand));
        border-radius: 10px;
        border: 2px solid var(--bg-section);
    }
    ::-webkit-scrollbar-thumb:hover { background: var(--brand-dark); }
}

/* ===== Modal-like dropdown entrance ===== */
.user-dropdown.active,
.admin-dropdown[style*="display: block"],
.admin-dropdown:not([style*="display: none"]) {
    animation: luran-fade-in-scale .18s ease both;
    transform-origin: top right;
}
body[dir="rtl"] .user-dropdown.active,
body[dir="rtl"] .admin-dropdown:not([style*="display: none"]) {
    transform-origin: top left;
}

/* ===== Newsletter card hover float ===== */
.newsletter-section { transition: transform .35s ease, box-shadow .35s ease; }
.newsletter-section:hover { transform: translateY(-4px); box-shadow: 0 24px 48px rgba(var(--brand-rgb), .35); }

/* ===== Brand cards subtle tilt ===== */
.brand-card { transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease, opacity .25s ease; }
.brand-card:hover { transform: translateY(-6px) rotate(-1deg); }

/* ===== Admin topbar polish ===== */
.admin-topbar { transition: box-shadow .2s ease; }
.admin-topbar-btn {
    transition: var(--transition);
}
.admin-topbar-btn:hover { transform: translateY(-2px); }

/* ===== Page-load body fade ===== */
body { animation: luran-fade-in .3s ease both; }

/* ===== Reduced motion preference ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
