/* =========================================
   500+MATEHUBTOOLS - PREMIUM SAAS DESIGN SYSTEM
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Dark Futuristic Theme (Forced default) */
    --bg-primary: #000212;
    --bg-secondary: #0A0F25;
    --text-primary: #ffffff;
    --text-secondary: #94A3B8;
    --accent-primary: #7F00FF; /* Neon Purple */
    --accent-secondary: #00E5FF; /* Neon Cyan */
    --accent-glow: rgba(127, 0, 255, 0.4);
    
    --glass-bg: rgba(10, 15, 37, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);
    
    --card-bg: #0d132e;
    --nav-bg: rgba(0, 2, 18, 0.7);
    --border-radius-lg: 1.5rem;
    --border-radius-md: 0.8rem;
}

/* Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', sans-serif;
}

body {
    background-color: var(--bg-primary);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    scroll-behavior: smooth;
    cursor: none; /* For custom cursor */
}

/* Premium Video Background */
#bg-video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -10;
    overflow: hidden;
    background-color: var(--bg-primary);
}

#bg-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8; /* Slight Fade for premium look */
}

.bg-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,2,18,0.7), rgba(0,2,18,0.4));
    z-index: 1;
}

/* Custom Cursor Glow */
.cursor-glow {
    position: fixed;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(127,0,255,0.15) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 1; /* Behind glass elements */
    transition: width 0.3s, height 0.3s;
}

.cursor-dot {
    position: fixed;
    width: 8px;
    height: 8px;
    background: var(--accent-secondary);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 9999;
    box-shadow: 0 0 10px var(--accent-secondary);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 2; /* Above cursor glow */
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* Glassmorphism 2.0 */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-highlight);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s;
    position: relative;
    overflow: hidden;
}

.glass::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.03) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    transition: 0.5s;
    z-index: 1;
}
.glass:hover::before { left: 200%; }

/* Navigation (Floating) */
nav {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    z-index: 1000;
    padding: 0.8rem 2rem;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    transition: 0.3s;
}

nav.scrolled {
    width: 100%;
    top: 0;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    position: relative;
    z-index: 1001;
}

.logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.3));
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 8px;
}

.logo:hover .logo-img {
    transform: scale(1.08) rotate(-2deg);
    filter: drop-shadow(0 0 20px rgba(0, 229, 255, 0.6));
}

/* Fallback text styles if logo image fails/missing */
.logo span { color: var(--accent-secondary); font-size: 1.5rem; font-weight: 800; }
.logo-text { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }

/* Premium Logo Fade-in Animation */
.animate-logo {
    opacity: 0;
    animation: logoFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.2s;
}

@keyframes logoFadeIn {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.9);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
        filter: blur(0);
    }
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1rem;
    transition: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
    transition: 0.3s;
    box-shadow: 0 0 10px var(--accent-secondary);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-primary);
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 100%;
}

/* Auth Buttons in Nav */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.user-greeting { font-weight: 600; color: var(--accent-secondary); }

/* =====================
   MEGA MENU
   ===================== */
.nav-mega-wrapper {
    position: relative;
}

.nav-mega-wrapper > a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-mega-wrapper > a .mega-chevron {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.nav-mega-wrapper:hover > a .mega-chevron {
    transform: rotate(180deg);
    color: var(--accent-secondary);
}

.mega-menu {
    position: absolute;
    top: calc(100% + 1.5rem);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 860px;
    background: rgba(5, 8, 30, 0.97);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-top: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(127, 0, 255, 0.1);
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    z-index: 9999;
    pointer-events: none;
}

.nav-mega-wrapper:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: all;
}

.mega-col {
    padding: 0 1.5rem;
    border-right: 1px solid var(--glass-border);
}

.mega-col:first-child { padding-left: 0; }
.mega-col:last-child { padding-right: 0; border-right: none; }

.mega-col-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--glass-border);
}

.mega-col-header i {
    font-size: 1rem;
    color: var(--accent-secondary);
}

.mega-col-header span {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.mega-col ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.mega-col ul li a {
    display: block;
    padding: 0.45rem 0.6rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mega-col ul li a:hover {
    color: var(--text-primary);
    background: rgba(0, 229, 255, 0.07);
    padding-left: 1rem;
    text-shadow: none;
}

.mega-col ul li a::after { display: none !important; }

.mega-view-all {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--glass-border);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-secondary) !important;
    text-decoration: none !important;
    transition: gap 0.2s ease !important;
    background: none !important;
    padding-left: 0.6rem !important;
}

.mega-view-all:hover {
    gap: 0.7rem !important;
    color: var(--accent-secondary) !important;
    background: none !important;
    padding-left: 0.6rem !important;
}

/* Hamburger Mobile Toggle */
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1.2rem;
    transition: 0.3s;
}
.nav-toggle:hover { border-color: var(--accent-secondary); color: var(--accent-secondary); }

/* Buttons & Ripple */
.btn {
    padding: 0.75rem 1.8rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.btn-primary {
    background: linear-gradient(90deg, var(--accent-primary), #a600ff);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(166, 0, 255, 0.6);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--text-primary);
}

/* Ripple logic computed via JS */
.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-anim 0.6s linear;
    background-color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
}
@keyframes ripple-anim {
    to { transform: scale(4); opacity: 0; }
}

/* SaaS Hero Section */
.hero {
    position: relative;
    padding: 14rem 0 8rem;
    text-align: center;
    overflow: hidden;
}

.hero h1 {
    font-size: 4.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    font-weight: 800;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 3rem;
}

.hero-ctas {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 4rem;
}

.counters {
    display: flex;
    justify-content: center;
    gap: 4rem;
    border-top: 1px solid var(--glass-border);
    padding-top: 3rem;
    max-width: 800px;
    margin: 0 auto;
}

.counter-box h3 {
    font-size: 3rem;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}
.counter-box p { font-size: 1rem; color: var(--text-secondary); margin: 0; letter-spacing: 1px; text-transform: uppercase; }

/* Grid Sections */
.section-title {
    text-align: center;
    margin: 6rem 0 3rem;
    font-size: 2.5rem;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}
.category-card {
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.category-card:hover { border-color: var(--accent-secondary); }
.category-card i { font-size: 3rem; margin-bottom: 1rem; color: var(--accent-secondary); }

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}
.tool-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--glass-border);
    background: var(--card-bg);
    border-radius: var(--border-radius-md);
    transition: 0.3s;
}
.tool-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}
.tool-tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    background: rgba(127, 0, 255, 0.15);
    color: var(--accent-secondary);
    font-weight: 700;
}

/* Tool Pages Form Inputs Customization */
.tool-container { padding: 10rem 0 4rem; }
.tool-ui-box { padding: 3rem; }
.tool-label { font-weight: 600; margin-bottom: 0.5rem; display: block; color: var(--text-secondary); }

.unit-input, .unit-select, textarea.tool-input {
    width: 100%;
    padding: 1.25rem;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.03);
    color: var(--text-primary);
    font-size: 1rem;
    transition: 0.3s;
    outline: none;
}
.unit-input:focus, .unit-select:focus, textarea.tool-input:focus {
    border-color: var(--accent-secondary);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
    background: rgba(255,255,255,0.06);
}

/* Search Bar Update */
.search-container { position: relative; max-width: 800px; margin: 0 auto; z-index: 10; }
.search-container input {
    width: 100%;
    padding: 1.5rem 2rem 1.5rem 4rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    background: rgba(10,15,37,0.8);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 1.25rem;
    box-shadow: var(--shadow);
    transition: 0.3s;
}
.search-container input:focus { border-color: var(--accent-primary); box-shadow: var(--shadow-glow); }
.search-container i { position: absolute; left: 1.5rem; top: 50%; transform: translateY(-50%); color: var(--text-secondary); font-size: 1.5rem; }

/* Testimonials */
.testimonials { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.testimonial-card { padding: 2rem; position: relative; }
.testimonial-card p { font-style: italic; color: #cbd5e1; margin-bottom: 1.5rem; }
.testimonial-user { display: flex; align-items: center; gap: 1rem; }
.testimonial-user img { width: 50px; height: 50px; border-radius: 50%; border: 2px solid var(--accent-primary); }
.testimonial-user h5 { margin: 0; color: white; }
.testimonial-user span { font-size: 0.8rem; color: var(--text-secondary); }

/* FAQ Accordion */
.faq-list { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.faq-box { border: 1px solid var(--glass-border); border-radius: var(--border-radius-md); background: var(--card-bg); overflow: hidden; }
.faq-header { padding: 1.5rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.faq-body { padding: 0 1.5rem; max-height: 0; transition: max-height 0.3s ease-out, padding 0.3s; color: var(--text-secondary); }
.faq-box.active .faq-body { padding: 0 1.5rem 1.5rem; max-height: 200px; }
.faq-box.active .faq-header i { transform: rotate(180deg); color: var(--accent-secondary); }

/* Loader AI Style */
#global-loader {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--bg-primary); z-index: 99999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.5s, visibility 0.5s;
}
.spinner {
    width: 60px; height: 60px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent-secondary);
    border-right-color: var(--accent-primary);
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scroll Anim (AOS custom) */
.reveal { opacity: 0; transform: translateY(40px); transition: 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal.active { opacity: 1; transform: translateY(0); }

/* Footer */
footer { padding: 6rem 0 3rem; background: var(--bg-secondary); margin-top: 8rem; border-top: 1px solid var(--glass-border); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 4rem; margin-bottom: 3rem; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 0.8rem; }
.footer-col ul li a { text-decoration: none; color: var(--text-secondary); transition: 0.2s; }
.footer-col ul li a:hover { color: var(--accent-secondary); padding-left: 5px; }

/* AdSense blocks */
.ad-section .glass { border-style: dashed; border-color: rgba(255,255,255,0.2); }

/* Utilities */
.toast {
    position: fixed; bottom: 2rem; right: 2rem; padding: 1rem 1.5rem; border-radius: var(--border-radius-md);
    display: flex; align-items: center; gap: 0.75rem; z-index: 2000; box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    background: var(--bg-secondary); border: 1px solid var(--glass-border); transition: 0.3s;
}
.animate-up { animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes fadeInUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Auth page specific */
.auth-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem;
}
.auth-box {
    width: 100%; max-width: 450px; padding: 3rem 2.5rem; text-align: center;
}
.auth-switch { display: flex; justify-content: center; margin-bottom: 2rem; gap: 1rem;}
.auth-switch span { font-size: 1.1rem; color: var(--text-secondary); cursor: pointer; font-weight: 600;}
.auth-switch span.active { color: var(--text-primary); border-bottom: 2px solid var(--accent-primary); }

/* SEO content padding fix */
.seo-content { margin-top: 5rem; }
.seo-content h2 { margin-top:2rem; margin-bottom:1rem; }
.seo-content p { margin-bottom: 1rem; }

/* Responsive */
@media (max-width: 1050px) {
    .mega-menu {
        width: 700px;
        grid-template-columns: repeat(2, 1fr);
    }
    .mega-col { padding: 1rem; }
    .mega-col:nth-child(2) { border-right: 1px solid var(--glass-border); }
    .mega-col:nth-child(3), .mega-col:nth-child(4) { border-right: none; }
}

@media (max-width: 768px) {
    .logo-img { height: 38px; }
    .hero h1 { font-size: 3rem; }
    .counters { flex-direction: column; gap: 2rem; }
    nav { top: 0; width: 100%; border-radius: 0; }
    .cursor-glow, .cursor-dot { display: none; }
    
    .nav-toggle { display: flex; }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(5, 8, 30, 0.98);
        backdrop-filter: blur(20px);
        border-top: 1px solid var(--glass-border);
        padding: 1.5rem;
        gap: 0.5rem;
        border-radius: 0 0 1.5rem 1.5rem;
        z-index: 999;
    }

    .nav-links.open { display: flex; }

    .nav-links li { width: 100%; }
    .nav-links a { display: block; padding: 0.8rem 1rem; border-radius: 0.8rem; }
    .nav-links a:hover { background: rgba(255,255,255,0.05); }

    .mega-menu {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        pointer-events: all;
        width: 100%;
        grid-template-columns: repeat(2, 1fr);
        padding: 1rem;
        border-radius: 1rem;
        margin-top: 0.5rem;
        box-shadow: none;
        display: none;
    }

    .nav-mega-wrapper.open .mega-menu { display: grid; }
    .mega-col { border-right: none !important; padding: 0.8rem; }
    .nav-auth { width: 100%; margin-top: 0.5rem; justify-content: center; }
}
