/* ==========================================================================
   ABRAR TRADERS - PREMIUM ENTERPRISE STYLESHEET v7.0
   ========================================================================== */

/* --- 1. CSS VARIABLES (THEME) --- */
:root {
    --primary-color: #607afb; 
    --secondary-color: #8e9bfa; 
    --accent-color: #a78bfa; 
    --text-color: #0d0f1c;
    --bg-light: #f8f9fc;
    --bg-medium: #e6e9f4;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: rgba(31, 38, 135, 0.15);
}

/* --- 2. BASE & RESET --- */
html { 
    scroll-behavior: smooth; 
    scroll-padding-top: 120px; /* Accounts for sticky nav + some breathing room */
}
html.lenis, html.lenis body { height: auto; width: 100%; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth iframe { pointer-events: none; }

body {
    font-family: 'Be Vietnam Pro', sans-serif;
    color: var(--text-color);
    background: linear-gradient(to tr, var(--bg-light), var(--bg-medium));
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-light);
}
/* We only hide the cursor when the JS specifically adds this class to the body */
body.has-custom-cursor, 
body.has-custom-cursor a, 
body.has-custom-cursor button, 
body.has-custom-cursor input, 
body.has-custom-cursor textarea, 
body.has-custom-cursor select, 
body.has-custom-cursor .cursor-pointer { 
    cursor: none !important; 
}
body::-webkit-scrollbar { width: 8px; }
body::-webkit-scrollbar-track { background: var(--bg-light); }
body::-webkit-scrollbar-thumb { background-color: var(--primary-color); border-radius: 4px; border: 2px solid var(--bg-light); }

/* --- 3. TYPOGRAPHY --- */
h1, h2, #modalProductName, .font-serif {
    font-family: 'Playfair Display', serif !important;
    letter-spacing: -0.02em; 
}

/* --- 4. CORE COMPONENTS --- */
/* Unified Glassmorphism */
.glass {
    background-color: var(--glass-bg);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px var(--glass-shadow);
    will-change: transform; 
    /* Removed backdrop-filter to save massive amounts of VRAM */
}

/* Progress Bar */
.progress-bar { position: fixed; top: 0; left: 0; height: 4px; background: linear-gradient(to right, var(--primary-color), var(--secondary-color)); width: 0; z-index: 9999; }

/* --- 5. NAVIGATION --- */
.sticky-nav {
    position: sticky; top: 1rem; z-index: 10000; 
    background: rgba(255, 255, 255, 0.70); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid #e2e8f0; /* Crisp, solid light-grey border */
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.sticky-nav.scrolled { 
    background: rgba(255, 255, 255, 0.95); 
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08); 
    border-color: #cbd5e1; /* Slightly darker border when scrolled */
    padding-top: 0.5rem !important; 
    padding-bottom: 0.5rem !important;
}
.nav-link { position: relative; padding-bottom: 4px; transition: color 0.3s; border-radius: 4px; }
.nav-link:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 4px; }
.nav-link::after {
    content: ''; position: absolute; width: 0; height: 2px; bottom: 0; right: 0; /* Animates from right */
    background-color: var(--primary-color); transition: all 0.3s ease;
}
.nav-link:hover::after, .nav-link.active::after { width: 100%; left: 0; }
.nav-link:hover, .nav-link.active { color: var(--text-color); }

/* --- 6. BUTTONS & CARDS --- */
.btn-glow { position: relative; overflow: hidden; }
.btn-glow::after {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 60%);
    transform: scale(0); opacity: 0; transition: transform 0.6s, opacity 0.6s;
}
.btn-glow:hover::after { transform: scale(1); opacity: 1; transition: 0s; }
.btn-glow:hover { box-shadow: 0 0 20px rgba(37, 99, 235, 0.5); }

.action-button { position: relative; overflow: hidden; z-index: 1; }
.action-button::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); z-index: -1;
}
.action-button:hover::before { left: 100%; }
.action-button:active { transform: scale(0.98); }

.product-card { transition: transform 0.3s ease, box-shadow 0.3s ease; position: relative; overflow: hidden; cursor: pointer; }
.product-card::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(45deg, rgba(96,122,251,0.1), rgba(142,155,250,0.1));
    opacity: 0; transition: opacity 0.3s ease; z-index: 1; pointer-events: none;
}
.product-card:hover { transform: translateY(-5px); box-shadow: 0 12px 24px rgba(31, 38, 135, 0.2); }
.product-card:hover::before { opacity: 1; }
.product-card > * { position: relative; z-index: 2; }
.product-card h3 { color: #1f2937 !important; } 
.product-card p { color: #4b5563 !important; }

.review-card { border-left: 5px solid var(--primary-color); padding-left: 1.5rem; position: relative; }
.review-card::before {
    content: "“"; position: absolute; top: -0.5rem; left: 0.5rem; font-size: 4rem;
    color: rgba(96,122,251,0.2); font-family: sans-serif; line-height: 1; z-index: 0;
}
.review-card > * { position: relative; z-index: 1; }

.gallery-item { position: relative; overflow: hidden; border-radius: 1rem; }
.gallery-item img { transition: transform 0.3s ease; }
.gallery-item:hover img { transform: scale(1.05); }
.gallery-item::after { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.2); opacity: 0; transition: opacity 0.3s ease; pointer-events: none; }
.gallery-item:hover::after { opacity: 1; }

/* --- 7. MODALS, MENUS & OVERLAYS --- */
#menuBackdrop, #productModalBackdrop {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    opacity: 0; pointer-events: none; transition: opacity 0.4s ease, backdrop-filter 0.4s ease; z-index: 19999; 
}
#menuBackdrop.open, #productModalBackdrop.open { opacity: 1; pointer-events: auto; }

#productModal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.9);
    opacity: 0; visibility: hidden; transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    z-index: 21000; width: 90vw; height: 90vh; max-width: 900px; max-height: 700px; overflow-y: auto;
}
#productModal.open { transform: translate(-50%, -50%) scale(1); opacity: 1; visibility: visible; }
#productModal .close-button { position: absolute; top: 1rem; right: 1rem; background: white; border-radius: 50%; padding: 0.5rem; box-shadow: 0 2px 5px rgba(0,0,0,0.2); cursor: pointer; transition: transform 0.2s; z-index: 10; }
#productModal .close-button:hover { transform: scale(1.1); }

#mobileMenu {
    position: fixed; top: 0; right: 0; width: 100%; max-width: 400px; height: 100vh;
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(30px) saturate(150%); -webkit-backdrop-filter: blur(30px) saturate(150%);
    display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding-left: 3rem; gap: 2rem;
    transform: translateX(100%); pointer-events: none; opacity: 0; transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.5s ease; z-index: 20000;
    border-left: 1px solid rgba(255,255,255,0.4); box-shadow: -20px 0 50px rgba(0,0,0,0.1);
}
#mobileMenu.open { transform: translateX(0); opacity: 1; pointer-events: auto; }
#mobileMenu a { font-size: 2rem; font-weight: 800; font-family: 'Playfair Display', serif; color: var(--text-color); transition: transform 0.3s ease, color 0.3s ease; opacity: 0; transform: translateY(20px); }
#mobileMenu.open a { opacity: 1; transform: translateY(0); }
/* Staggered animation for mobile links */
#mobileMenu.open a:nth-of-type(1) { transition-delay: 0.1s; }
#mobileMenu.open a:nth-of-type(2) { transition-delay: 0.15s; }
#mobileMenu.open a:nth-of-type(3) { transition-delay: 0.2s; }
#mobileMenu.open a:nth-of-type(4) { transition-delay: 0.25s; }
#mobileMenu.open a:nth-of-type(5) { transition-delay: 0.3s; }
#mobileMenu.open a:nth-of-type(6) { transition-delay: 0.35s; }
#mobileMenu a:hover { color: var(--primary-color); transform: translateX(15px) !important; }

#menuButton:focus-visible,
#themeToggle:focus-visible,
#closeMenuButton:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* --- 8. SOCIAL SIDEBAR --- */
.social-sidebar {
    position: fixed; top: 40%; left: 0; display: flex; flex-direction: column; z-index: 9000; 
    transform: translateX(-75%); opacity: 0.8; transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease; padding-right: 10px;
}
.social-sidebar:hover, .social-sidebar.peek-out { transform: translateX(0); opacity: 1; }
.social-sidebar .social-icon {
    width: 48px; height: 48px; margin: 8px 0 !important; border-radius: 50%;
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px rgba(96, 122, 251, 0.15); border: 1px solid rgba(96, 122, 251, 0.2);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; overflow: hidden;
}
.social-sidebar .social-icon img { width: 24px; height: 24px; transition: all 0.3s ease; filter: invert(48%) sepia(79%) saturate(2476%) hue-rotate(200deg) brightness(100%) contrast(101%); }
.social-sidebar .social-icon:nth-child(1):hover { background: #1877F2; border-color: #1877F2; transform: translateX(8px) scale(1.1); box-shadow: 0 8px 20px rgba(24, 119, 242, 0.4); }
.social-sidebar .social-icon:nth-child(2):hover { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); border-color: #d6249f; transform: translateX(8px) scale(1.1); box-shadow: 0 8px 20px rgba(214, 36, 159, 0.4); }
.social-sidebar .social-icon:nth-child(3):hover { background: #25D366; border-color: #25D366; transform: translateX(8px) scale(1.1); box-shadow: 0 8px 20px rgba(37, 211, 102, 0.4); }
.social-sidebar .social-icon:nth-child(4):hover { background: #0A66C2; border-color: #0A66C2; transform: translateX(8px) scale(1.1); box-shadow: 0 8px 20px rgba(10, 102, 194, 0.4); }
.social-sidebar .social-icon:hover img { filter: brightness(0) invert(1); transform: scale(1.1) rotate(5deg); }

/* --- 9. TOAST NOTIFICATIONS --- */
#toast-container { 
    position: fixed; 
    bottom: 5rem; 
    right: 1.5rem; 
    z-index: 2147483647; /* Max allowed by browsers to ensure it is always on top */
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    pointer-events: none; 
}
.toast {
    background: rgba(15, 23, 42, 0.95); color: white; padding: 12px 24px; border-radius: 50px; font-weight: 600; font-size: 0.95rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2); display: flex; align-items: center; gap: 10px;
    opacity: 0; transform: translateY(20px); animation: toastSlideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.1);
}
.toast.success svg { color: #4ade80; }
.toast.info svg { color: #607afb; }

/* --- 10. ANIMATIONS & UTILITIES --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blob {
    0%, 100% { transform: translate(0px, 0px) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}
@keyframes toastSlideUp { to { opacity: 1; transform: translateY(0); } }
@keyframes toastFadeOut { to { opacity: 0; transform: translateY(-20px); } }

.animate-fade-in { animation: fadeIn 1s ease-out forwards; }
.animate-fade-in-delay { animation: fadeIn 1s ease-out 0.5s forwards; }
.animate-slide-up { animation: slideUp 0.8s ease-out forwards; }
.animate-blob { 
    animation: blob 15s infinite ease-in-out;
    will-change: transform; 
    transform: translateZ(0);
    backface-visibility: hidden;
    filter: blur(40px) !important; /* Capped blur size */
}

/* FIX: Reduce intensive filter calculations on mobile */
@media (max-width: 768px) {
    .animate-blob {
        filter: blur(40px) !important;
        animation-duration: 20s; /* Slow down animation on mobile to save battery */
    }
}
.animation-delay-2000 { animation-delay: 2s; }
.animation-delay-4000 { animation-delay: 4s; }

/* --- 11. MIDNIGHT CARBON DARK MODE --- */
body.dark-mode {
    --text-color: #f8fafc;
    --bg-light: #0b1120;
    --bg-medium: #151e32;
    --glass-bg: rgba(15, 23, 42, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: rgba(0, 0, 0, 0.6);
}

/* Navigation & Menus */
body.dark-mode .sticky-nav { background: rgba(15, 23, 42, 0.75) !important; border: 1px solid #334155 !important; box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
body.dark-mode .sticky-nav.scrolled { background: rgba(11, 17, 32, 0.95) !important; border-color: #475569 !important; }
body.dark-mode #mobileMenu { background: rgba(15, 23, 42, 0.85) !important; border-left-color: rgba(255,255,255,0.1) !important; }
body.dark-mode .nav-link { color: #cbd5e1; }
body.dark-mode .nav-link:hover, body.dark-mode .nav-link.active { color: var(--primary-color) !important; }

/* Forms & Calculators */
body.dark-mode input, body.dark-mode select, body.dark-mode textarea {
    background-color: rgba(15, 23, 42, 0.6) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
}
body.dark-mode input::placeholder, body.dark-mode textarea::placeholder { color: #64748b !important; }
body.dark-mode option { background-color: #0b1120; color: #f8fafc; }

/* --- 12. 3D PRODUCT VIEWER --- */
.perspective-1000 { perspective: 1000px; }
.preserve-3d { transform-style: preserve-3d; }
.face { 
    backface-visibility: hidden; 
    background-size: cover; 
    background-position: center; 
    border-radius: 4px; 
}

/* Folding the faces into a 13rem (208px) cube. Translate is exactly half (6.5rem) */
.cube-front  { transform: rotateY(0deg) translateZ(6.5rem); }
.cube-back   { transform: rotateY(180deg) translateZ(6.5rem); }
.cube-right  { transform: rotateY(90deg) translateZ(6.5rem); }
.cube-left   { transform: rotateY(-90deg) translateZ(6.5rem); }
.cube-top    { transform: rotateX(90deg) translateZ(6.5rem); }
.cube-bottom { transform: rotateX(-90deg) translateZ(6.5rem); }

/* --- 13. GSM THICKNESS VISUALIZER --- */
:root {
    --edge-light: #cbd5e1;
    --edge-dark: #94a3b8;
}
body.dark-mode {
    --edge-light: #334155;
    --edge-dark: #1e293b;
}

.paper-isometric {
    transform: rotateX(60deg) rotateY(0deg) rotateZ(-45deg);
    transform-style: preserve-3d;
    background-color: #f8fafc;
    border: 1px solid rgba(0,0,0,0.1);
    /* Transition only transforms and bg, we want box-shadow to be instant for the slider */
    transition: transform 0.4s ease, background-color 0.4s ease;
}

/* Custom Slider Styling */
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 28px; width: 28px; border-radius: 50%;
    background: #4f46e5; cursor: none;
    margin-top: -10px;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.4);
    border: 3px solid white;
}
input[type=range]::-moz-range-thumb {
    height: 28px; width: 28px; border-radius: 50%;
    background: #4f46e5; cursor: none;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.4);
    border: 3px solid white;
}

/* --- 14. APP-LIKE PAGE TRANSITIONS --- */
/* Enable native cross-document view transitions */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: 0.4s cubic-bezier(0.4, 0, 0.2, 1) both fade-out-page,
               0.4s cubic-bezier(0.4, 0, 0.2, 1) both slide-to-left;
}

::view-transition-new(root) {
    animation: 0.4s cubic-bezier(0.4, 0, 0.2, 1) both fade-in-page,
               0.4s cubic-bezier(0.4, 0, 0.2, 1) both slide-from-right;
}

@keyframes fade-out-page { to { opacity: 0; } }
@keyframes fade-in-page { from { opacity: 0; } }
@keyframes slide-to-left { to { transform: translateX(-30px) scale(0.98); } }
@keyframes slide-from-right { from { transform: translateX(30px) scale(0.98); } }

/* --- 15. LIVE TICKER ANIMATION --- */
@keyframes marquee { 0% { transform: translateX(0%); } 100% { transform: translateX(-50%); } }
.animate-marquee { animation: marquee 25s linear infinite; }

/* --- 16. AURORA BACKGROUND --- */
.aurora-bg {
    position: absolute;
    top: 50%; left: 50%;
    width: 80vw; height: 80vw;
    background: conic-gradient(from 0deg at 50% 50%, #8e9bfa, #607afb, #a78bfa, #8e9bfa);
    filter: blur(90px);
    opacity: 0.35;
    transform: translate(-50%, -50%);
    animation: spin-aurora 20s linear infinite;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    /* Force GPU rendering */
    transform-style: preserve-3d;
    backface-visibility: hidden;
}
@keyframes spin-aurora { 
    0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
    50% { transform: translate(-50%, -50%) rotate(180deg) scale(1.1) scaleY(0.8); }
    100% { transform: translate(-50%, -50%) rotate(360deg) scale(1); }
}
body.dark-mode .aurora-bg { opacity: 0.15; }

@media (max-width: 768px) {
    .aurora-bg { filter: blur(50px); opacity: 0.25; animation-duration: 30s; }
}

/* --- 17. NEXT-GEN AESTHETICS & UI POLISH --- */

/* 1. Custom Brand Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9; /* Light mode track */
}
.dark-mode ::-webkit-scrollbar-track {
    background: #0f172a; /* Dark mode track */
}
::-webkit-scrollbar-thumb {
    background: #3b82f6; /* Blue brand color */
    border-radius: 10px;
    border: 2px solid #f1f5f9;
}
.dark-mode ::-webkit-scrollbar-thumb {
    border: 2px solid #0f172a;
}
::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

/* 2. Custom Text Highlight Color */
::selection {
    background: rgba(59, 130, 246, 0.3); /* Soft blue highlight */
    color: inherit;
}
.dark-mode ::selection {
    background: rgba(99, 102, 241, 0.5); /* Indigo highlight for dark mode */
}

/* 3. Smooth Image Blur-Up Loading */
img {
    transition: filter 0.5s ease-out, opacity 0.5s ease-out;
}
img[loading="lazy"] {
    filter: blur(10px);
    opacity: 0;
}
img.loaded {
    filter: blur(0);
    opacity: 1;
}

/* --- 18. Advanced Skeleton Loader for Images --- */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    color: transparent; /* Hides broken alt text while loading */
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

img.loaded {
    background: none;
    animation: none;
}

/* --- 19. AMBIENT EDGE-LIT GLASS & KINETIC FOIL --- */

/* Kinetic Foil Typography */
.foil-text {
    background: linear-gradient(
        120deg, 
        #ffffff 20%, 
        var(--secondary-color) 35%, 
        #ffffff 50%, 
        #ffffff 70%, 
        var(--accent-color) 85%, 
        #ffffff 100%
    );
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: foilShine 6s linear infinite;
    /* Keeps the drop shadow from breaking the transparent text */
    filter: drop-shadow(0px 10px 20px rgba(96, 122, 251, 0.3)); 
}

@keyframes foilShine {
    0% { background-position: 200% center; }
    100% { background-position: 0% center; }
}

/* Edge-Lit Glass Cards */
.edge-lit-card {
    position: relative;
    /* Removes the static border so our dynamic glow can take over */
    border: none !important; 
}

.edge-lit-card::before {
    content: "";
    position: absolute;
    inset: -1px; /* Expands slightly outside the card */
    border-radius: inherit;
    padding: 1.5px; /* The thickness of the glowing border */
    /* The radial gradient tracks the --mouse-x and --mouse-y CSS variables */
    background: radial-gradient(
        400px circle at var(--mouse-x, 0) var(--mouse-y, 0), 
        rgba(255, 255, 255, 0.8), 
        transparent 40%
    );
    /* Masks out the center so ONLY the border glows */
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: -1;
    transition: opacity 0.3s ease;
}

/* Subtle inner glow for extra depth */
.edge-lit-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        600px circle at var(--mouse-x, 0) var(--mouse-y, 0), 
        rgba(255, 255, 255, 0.04), 
        transparent 40%
    );
    pointer-events: none;
    z-index: 0;
}

















