/* Premium Responsive Light/Dark Palette */
:root {
    --bg-main: #F8FAFC;
    --bg-card: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --primary-blue: #2563EB;
    --primary-blue-hover: #1D4ED8;
    --accent-orange: #F97316;
    --accent-orange-hover: #EA580C;
    --border-color: #E2E8F0;
    --nav-bg: rgba(255, 255, 255, 0.85);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.dark-mode {
    --bg-main: #0B0F19;
    --bg-card: #131A2E;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --primary-blue: #3B82F6;
    --primary-blue-hover: #60A5FA;
    --accent-orange: #FB923C;
    --accent-orange-hover: #FDBA74;
    --border-color: rgba(255, 255, 255, 0.08);
    --nav-bg: rgba(11, 15, 25, 0.85);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', system-ui, sans-serif; }
body { background-color: var(--bg-main); color: var(--text-main); transition: var(--transition); overflow-x: hidden; padding-top: 80px; scroll-behavior: smooth; }
a { text-decoration: none; color: inherit; }

/* Sticky Glassmorphic Navbar */
.navbar { position: fixed; top: 0; left: 0; width: 100%; z-index: 1000; display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 8%; background: var(--nav-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--border-color); transition: var(--transition); }
.logo { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.5px; color: var(--primary-blue); transition: var(--transition); }
.logo:hover { transform: scale(1.02); }
.logo span { color: var(--accent-orange); }

.nav-links { display: flex; gap: 2.5rem; align-items: center; }
.nav-links a { font-weight: 600; font-size: 1rem; color: var(--text-main); position: relative; transition: var(--transition); padding: 0.5rem 0; }
.nav-links a::after { content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 2.5px; background: linear-gradient(90deg, var(--primary-blue), var(--accent-orange)); transition: var(--transition); border-radius: 50px; }
.nav-links a:hover { color: var(--primary-blue); }
.nav-links a:hover::after { width: 100%; }

.controls { display: flex; gap: 1.2rem; align-items: center; }
#theme-toggle { background: transparent; border: none; font-size: 1.4rem; color: var(--text-main); cursor: pointer; transition: var(--transition); }
#theme-toggle:hover { color: var(--accent-orange); transform: rotate(20deg) scale(1.15); }
.menu-btn { display: none; font-size: 1.5rem; cursor: pointer; color: var(--text-main); transition: var(--transition); }
.menu-btn:hover { color: var(--primary-blue); transform: scale(1.1); }

/* Fully Mobile Responsive Sidebar */
.sidebar { position: fixed; top: 0; right: -320px; width: 300px; height: 100vh; background: var(--bg-card); z-index: 2000; padding: 3rem 2rem; display: flex; flex-direction: column; gap: 2rem; transition: var(--transition); border-left: 1px solid var(--border-color); box-shadow: var(--shadow-lg); }
.sidebar.active { right: 0; }
.sidebar a { font-size: 1.2rem; font-weight: 600; color: var(--text-main); transition: var(--transition); padding-left: 0; }
.sidebar a:hover { color: var(--primary-blue); padding-left: 10px; }
.close-btn { align-self: flex-end; font-size: 1.6rem; cursor: pointer; color: var(--text-muted); transition: var(--transition); }
.close-btn:hover { color: var(--accent-orange); transform: rotate(90deg); }
.overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); opacity: 0; visibility: hidden; z-index: 1500; transition: var(--transition); }
.overlay.active { opacity: 1; visibility: visible; }

/* Interactive Action Buttons */
.btn-blue { background: var(--primary-blue); color: #ffffff !important; padding: 0.8rem 2rem; border-radius: 10px; font-weight: 700; transition: var(--transition); display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer; }
.btn-blue:hover { background: var(--primary-blue-hover); transform: translateY(-3px) scale(1.02); box-shadow: 0 12px 24px rgba(37, 99, 235, 0.3); }
.btn-orange { background: var(--accent-orange); color: #ffffff !important; padding: 1rem 2.5rem; border-radius: 12px; font-weight: 700; transition: var(--transition); display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer; }
.btn-orange:hover { background: var(--accent-orange-hover); transform: translateY(-4px) scale(1.02); box-shadow: 0 15px 30px rgba(249, 115, 22, 0.35); }

/* Landing Framework */
.hero { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 0 8%; position: relative; }
.hero h1 { font-size: 4.5rem; font-weight: 900; letter-spacing: -2px; line-height: 1.1; margin-bottom: 1.5rem; }
.hero h1 span { background: linear-gradient(135deg, var(--primary-blue), var(--accent-orange)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 1.3rem; color: var(--text-muted); max-width: 700px; line-height: 1.6; margin-bottom: 3rem; }

.tools-showcase { padding: 6rem 8% 4rem; text-align: center; }
.section-title { font-size: 3rem; font-weight: 800; letter-spacing: -1px; margin-bottom: 1rem; }
.section-subtitle { color: var(--text-muted); font-size: 1.15rem; margin-bottom: 4rem; }

.grid-advanced { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2.5rem; text-align: left; }
.adv-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 20px; padding: 2.5rem; display: flex; flex-direction: column; justify-content: space-between; transition: var(--transition); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; max-width: 100%; }
.adv-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: linear-gradient(90deg, var(--primary-blue), var(--accent-orange)); opacity: 0; transition: var(--transition); }
.adv-card:hover { transform: translateY(-12px); box-shadow: var(--shadow-lg); border-color: transparent; }
.adv-card:hover::before { opacity: 1; }
.adv-card i { font-size: 2.5rem; color: var(--accent-orange); margin-bottom: 1.5rem; display: block; transition: var(--transition); transform-origin: left bottom; }
.adv-card:hover i { transform: scale(1.15) rotate(-5deg); color: var(--primary-blue); }
.adv-card h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.8rem; transition: var(--transition); }
.adv-card:hover h3 { color: var(--primary-blue); }
.adv-card p { color: var(--text-muted); font-size: 1rem; line-height: 1.5; margin-bottom: 2rem; flex-grow: 1; }

/* --- COMPLETELY REWRITTEN TOOLS SUBPAGE LAYOUT (STACKED) --- */
.all-tools-header { text-align: center; padding: 6rem 8% 4rem; background: var(--bg-card); border-bottom: 1px solid var(--border-color); }
.all-tools-header h1 { font-size: 3rem; font-weight: 900; }

/* The Central Column Container (Prevents overlap and blank spaces) */
.tool-detail-container {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding: 4rem 5%;
    max-width: 900px;
    margin: 0 auto;
}

/* Individual Stacked Blocks */
.tool-info, .faq-section {
    width: 100%;
    text-align: left;
}

.tool-info h2, .tool-info h3 { font-size: 2rem; font-weight: 800; letter-spacing: -0.5px; margin-top: 1rem; margin-bottom: 1.2rem; color: var(--primary-blue); }
.tool-info p { color: var(--text-muted); font-size: 1.05rem; line-height: 1.8; margin-bottom: 1.5rem; }

/* Deep SEO Card Block (No fixed heights, pure flow) */
#dyn-seo-card-pane {
    background: var(--bg-card); 
    border: 1px solid var(--border-color); 
    border-radius: 24px;
    padding: 3.5rem; 
    box-shadow: var(--shadow-sm);
    width: 100%;
    box-sizing: border-box;
}

#dyn-seo-card-pane h2 { position: relative; padding-bottom: 0.5rem; margin-top: 2rem; font-size: 1.8rem; }
#dyn-seo-card-pane h2:first-of-type { margin-top: 0; }
#dyn-seo-card-pane h2::after { content: ''; position: absolute; bottom: 0; left: 0; width: 40px; height: 4px; background: var(--primary-blue); border-radius: 2px; }

#dyn-seo-card-pane ul { list-style: none; margin-left: 0; margin-bottom: 2.5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; }
#dyn-seo-card-pane li { font-size: 1rem; color: var(--text-muted); position: relative; padding-left: 1.8rem; line-height: 1.5; transition: var(--transition); }
#dyn-seo-card-pane li::before { content: "➔"; position: absolute; left: 0; color: var(--accent-orange); font-weight: bold; font-size: 0.9rem; transition: var(--transition); }
#dyn-seo-card-pane li:hover { color: var(--text-main); }
#dyn-seo-card-pane li:hover::before { transform: translateX(4px); color: var(--primary-blue); }

/* Related Pills */
#dyn-seo-card-pane ul:last-of-type { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }
#dyn-seo-card-pane ul:last-of-type li { padding: 0; }
#dyn-seo-card-pane ul:last-of-type li::before { content: none; }
#dyn-seo-card-pane ul:last-of-type a { display: inline-block; background: var(--bg-main); border: 1px solid var(--border-color); color: var(--primary-blue) !important; padding: 0.6rem 1.5rem; border-radius: 50px; font-weight: 600; font-size: 0.95rem; transition: var(--transition); }
#dyn-seo-card-pane ul:last-of-type a:hover { background: var(--primary-blue); color: #ffffff !important; border-color: var(--primary-blue); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(37, 99, 235, 0.15); }

/* LaTeX & Code Math Blocks */
p[style*="font-family: monospace"], #dyn-seo-card-pane p[style*="font-family: monospace"] {
    font-family: 'Inter', system-ui, sans-serif !important;
    background: var(--bg-main) !important;
    border: 1px solid var(--border-color) !important;
    padding: 1.8rem !important;
    border-radius: 14px !important;
    box-shadow: var(--shadow-sm);
    overflow-x: auto; /* IMPORTANT: Stops wide formulas from breaking the box */
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.MathJax { font-size: 1.2rem !important; color: var(--primary-blue) !important; outline: none; margin-inline: auto; padding: 0.5rem 0; overflow-x: auto; }

/* FAQs Stacked */
.faq-section h3 { font-size: 1.8rem; font-weight: 800; margin-bottom: 2rem; color: var(--text-main); }
.faq-item { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; margin-bottom: 1.2rem; overflow: hidden; box-shadow: var(--shadow-sm); transition: var(--transition); }
.faq-item:hover { border-color: var(--primary-blue); }
.faq-question { width: 100%; text-align: left; padding: 1.5rem; background: transparent; border: none; font-size: 1.1rem; font-weight: 700; color: var(--text-main); cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: var(--transition); }
.faq-answer { padding: 0 1.5rem; max-height: 0; overflow: hidden; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); color: var(--text-muted); line-height: 1.6; }
.faq-item.active .faq-answer { padding: 0 1.5rem 1.5rem; max-height: 200px; }
.faq-item.active .faq-question { color: var(--primary-blue); }

/* Footer */
/* --- ADVANCED FOOTER STYLES --- */
.advanced-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding-top: 5rem;
    position: relative;
    overflow: hidden;
}

.footer-grid-pro {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 4rem;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 8% 4rem;
}

/* Brand Section */
.footer-brand .logo {
    display: inline-block;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.footer-brand p {
    color: var(--text-muted);
    line-height: 1.8;
    font-size: 0.95rem;
    margin-bottom: 2rem;
    max-width: 320px;
}

/* Hover-Animated Social Links */
.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    font-size: 1.15rem;
}

.social-links a:hover {
    background: var(--primary-blue);
    color: #fff;
    border-color: var(--primary-blue);
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

/* Links Columns */
.footer-links-col h4 {
    color: var(--text-main);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.8rem;
    position: relative;
}

.footer-links-col h4::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 30px;
    height: 3px;
    background: var(--accent-orange);
    border-radius: 2px;
}

.footer-links-col ul {
    list-style: none;
}

.footer-links-col ul li {
    margin-bottom: 1.1rem;
}

.footer-links-col ul a {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-block;
}

.footer-links-col ul a:hover {
    color: var(--primary-blue);
    transform: translateX(6px);
}

/* Bottom Bar & Status Indicator */
.footer-bottom-pro {
    border-top: 1px solid var(--border-color);
    background: var(--bg-main);
    padding: 1.5rem 8%;
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1300px;
    margin: 0 auto;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-bottom-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg-card);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
}

/* Pulsing Green Dot */
.status-dot {
    width: 10px;
    height: 10px;
    background: #10B981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10B981;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Responsive Scaling Constraints */
@media (max-width: 992px) {
    .footer-grid-pro {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }
}

@media (max-width: 768px) {
    .footer-grid-pro {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
        justify-content: center;
    }
    .server-status {
        margin: 0 auto;
    }
}
/* Layout Media Breakpoints */
@media (max-width: 992px) {
    .nav-links, .navbar .controls .btn-blue { display: none; }
    .menu-btn { display: block; }
    .hero h1 { font-size: 3.2rem; }
    #dyn-seo-card-pane { padding: 2rem; }
}

/* Animations */
.reveal { opacity: 1; transform: translateY(0); transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
@media (prefers-reduced-motion: no-preference) { .reveal:not(.active) { opacity: 0; transform: translateY(30px); } }


/* --- INLINE TOOL WORKSPACE (TRUE SLIDE-DOWN UI) --- */
.inline-workspace {
    background: var(--bg-card);
    border: 2px solid var(--primary-blue);
    border-radius: 16px;
    margin: 0 auto;
    max-width: 900px;
    width: 90%;
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.15);
    
    /* Smooth Slide-Down Magic */
    max-height: 0;
    padding: 0 2.5rem; /* Vertical padding 0 initially */
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    transform: translateY(-20px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 10;
}

.inline-workspace.active {
    max-height: 1000px; /* Box ko failne ke liye space dega */
    padding: 2.5rem;    /* Vertical padding wapas aayegi */
    margin-top: 2rem;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.2rem;
    margin-bottom: 2rem;
}

.workspace-header h3 {
    color: var(--primary-blue);
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
}

.close-workspace-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.close-workspace-btn:hover {
    background: #EF4444;
    color: white;
    transform: rotate(90deg);
}

.tool-ui-area {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background: var(--bg-main);
}

/* --- CALCULATOR COMPONENTS STYLES --- */
.calculator-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
}

.input-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.input-group input {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    cursor: text;
}

.input-group input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.error-msg {
    background: #FEE2E2;
    color: #B91C1C;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    text-align: center;
    font-weight: 600;
    border: 1px solid #FCA5A5;
}

body.dark-mode .error-msg {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #F87171;
}

/* Result Dashboard */
.result-box {
    margin-top: 2.5rem;
    background: linear-gradient(135deg, var(--bg-main), var(--bg-card));
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.5s ease;
}

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

.result-box h4 {
    color: var(--text-main);
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.age-highlights {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.age-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    border-radius: 12px;
    flex: 1;
    min-width: 100px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.age-box span {
    display: block;
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.age-box p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.extra-stats {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.extra-stats strong {
    color: var(--accent-orange);
    font-size: 1.3rem;
}

@media (max-width: 768px) {
    .input-row { flex-direction: column; gap: 1rem; }
}