/* === Mobile / Tablet ================================================ */
@media (max-width: 900px) {
    .sidebar-toggle.sidebar-toggle-v2 { display: none !important; }
    /* Clear any rail state when transitioning to mobile */
    body.sidebar-rail .sidebar { width: auto !important; }
}

/* === Reduced motion =================================================== */
@media (prefers-reduced-motion: reduce) {
    .sidebar, .main, .sidebar-toggle, .sidebar-toggle svg, .sidebar-nav a {
        transition: none !important;
    }
}

/* Flash-free initial paint when restoring rail state */
body.no-sidebar-transition .sidebar,
body.no-sidebar-transition .main,
body.no-sidebar-transition .sidebar-toggle,
body.no-sidebar-transition .sidebar-toggle svg,
body.no-sidebar-transition .logo-text-wrap,
body.no-sidebar-transition .sidebar-nav a > span {
    transition: none !important;
}

/* ════════
   IT4U-SIDEBAR-RAIL-V2 END
   ════════ */
/* ════════
   IT4U-CONTENT-FILL-V2 START
   Replaces V1. Uses viewport-relative max-widths so content ALWAYS fills
   the available space minus a fixed gutter, regardless of viewport size.

   Math (rail mode, sidebar = 60 px, gutter = 32 px):
     • viewport 1440 px → max-width = 1348 px → 0 px margin (content fills)
     • viewport 1920 px → max-width = 1828 px → 0 px margin
     • viewport 2200 px → max-width = 2108 px → 0 px margin
     • viewport 2560 px → max-width = 2468 px → 0 px margin

   Math (sidebar expanded, sidebar = 244 px, gutter = 32 px):
     • viewport 1440 px → max-width = 1164 px
     • viewport 1920 px → max-width = 1644 px
     • viewport 2200 px → max-width = 1924 px

   In every case the content fills the FULL available main area minus 32px
   of breathing room. No "empty centered margins". Equivalent to what
   premium SaaS dashboards do.

   Text-heavy inner elements (.section-sub, .item-body, etc.) already have
   their own narrower max-widths for line-length readability — those are
   NOT touched. Only the SECTION-LEVEL containers expand fluidly.
   ════════ */

@media (min-width: 901px) {

    /* ── Default (sidebar expanded at 244 px) ──────── */
    .section,
    .me-inner,
    .hero,
    .trust-inner,
    .footer-top,
    .footer-bottom,
    .footer-inner {
        max-width: calc(100vw - 244px - 32px) !important;
        width: auto !important;
        margin-left: auto !important;
        margin-right: auto !important;
        transition: max-width 0.32s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    /* ── Rail mode (sidebar = 60 px) — content reclaims everything ──── */
    body.sidebar-rail .section,
    body.sidebar-rail .me-inner,
    body.sidebar-rail .hero,
    body.sidebar-rail .trust-inner,
    body.sidebar-rail .footer-top,
    body.sidebar-rail .footer-bottom,
    body.sidebar-rail .footer-inner {
        max-width: calc(100vw - 60px - 32px) !important;
    }

    /* ── Plans grid — flow into the freed space ──────── */
    .plans-grid {
        max-width: none !important;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
    }
    body.sidebar-rail .plans-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
    }

    /* ── Features grid — same fluid expansion ──────── */
    .feat-grid {
        max-width: none !important;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    }
    body.sidebar-rail .feat-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
    }

    /* ── Comparison table — let it fill ──────── */
    #cmp-table-container {
        max-width: none !important;
    }
}

/* === Narrow desktops (901-1100px): tighter gutter ==================== */
@media (min-width: 901px) and (max-width: 1100px) {
    .section,
    .me-inner,
    .hero,
    .trust-inner,
    .footer-top,
    .footer-bottom,
    .footer-inner {
        max-width: calc(100vw - 244px - 16px) !important;
    }
    body.sidebar-rail .section,
    body.sidebar-rail .me-inner,
    body.sidebar-rail .hero,
    body.sidebar-rail .trust-inner,
    body.sidebar-rail .footer-top,
    body.sidebar-rail .footer-bottom,
    body.sidebar-rail .footer-inner {
        max-width: calc(100vw - 60px - 16px) !important;
    }
}

/* === Reduced motion =================================================== */
@media (prefers-reduced-motion: reduce) {
    .section, .me-inner, .hero, .trust-inner,
    .footer-top, .footer-bottom, .footer-inner {
        transition: none !important;
    }
}

/* ════════
   IT4U-CONTENT-FILL-V2 END
   ════════ */
/* ════════
   IT4U-MAIN-UNCAP-V1 START
   Critical root-cause fix: the .main element itself was capped at
   max-width: calc(100vw - 232px) by a rule from the very first refinement.
   That 232px was hardcoded for the original expanded sidebar — it never
   recalculated for rail mode (60px), so .main stayed 1304px on a 1536px
   viewport even when the sidebar was railed.

   Forensics (verified via Chrome DevTools):
     viewport:  1536px
     body:      1531px (full)
     sidebar:   x=1471, width=60 (railed correctly)
     .main:     x=167, width=1304, max-width: 1304px ← ROOT CAUSE

   Fix: remove .main's max-width cap entirely. Let .main fill the full
   available width (body minus margin-right for the sidebar). Section-level
   max-widths inside .main (already viewport-relative via V2 content-fill)
   will then handle the actual content sizing.
   ════════ */

@media (min-width: 901px) {
    .main {
        max-width: none !important;
        width: auto !important;
    }
}

/* ════════
   IT4U-MAIN-UNCAP-V1 END
   ════════ */
/* ════════
   IT4U-MARKETING-MOBILE-FIX-V1 START
   Ensures mobile/tablet experience is clean and consistent with desktop V2.

   Verified issues addressed:
   1. Hamburger button (.topbar-menu-btn) must be visible on mobile
   2. Sidebar toggle V2 (#sidebar-collapse-toggle) must be hidden on mobile
   3. Body must not retain block-flex confusion across breakpoints
   4. Content area must take 100% width on mobile (no leftover sidebar offset)
   5. No horizontal overflow from V2/Uncap rules leaking into mobile
   ════════ */

@media (max-width: 900px) {
    /* Hide the desktop rail-toggle button on mobile (existing hamburger takes over) */
    #sidebar-collapse-toggle,
    .sidebar-toggle.sidebar-toggle-v2 {
        display: none !important;
    }

    /* Make sure the hamburger button IS visible in the topbar on mobile */
    .topbar-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    /* Body / main: reset desktop layout. body is BLOCK, main is full-width */
    body {
        display: block !important;
    }
    .main {
        display: block !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: 100vw !important;
    }

    /* Clear any rail-state class leak from desktop persistence */
    body.sidebar-rail .main {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    body.sidebar-rail .sidebar {
        /* Mobile sidebar uses translateX overlay system, not width-based rail */
        width: 82vw !important;
        max-width: 300px !important;
    }

    /* Section/hero widths fluid on mobile */
    .section, .me-inner, .hero, .trust-inner,
    .footer-top, .footer-bottom, .footer-inner {
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        width: auto !important;
    }

    /* Prevent horizontal overflow */
    html, body {
        overflow-x: hidden !important;
        overflow-x: clip !important;
        max-width: 100vw !important;
    }
}

/* === Tablet (768-900) — same as desktop refinements but smaller =====*/
@media (min-width: 768px) and (max-width: 900px) {
    /* Plans grid: 2 columns at tablet width */
    .plans-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .feat-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* === Phone (≤640px) — 1 column grids ================================ */
@media (max-width: 640px) {
    .plans-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ════════
   IT4U-MARKETING-MOBILE-FIX-V1 END
   ════════ */
/* ════════
   IT4U-MARKETING-SIDEBAR-POLISH-V1 START
   Enterprise polish for the MOBILE sidebar — same design language as desktop.

   Changes:
   • Smoother animation (cubic-bezier matching desktop)
   • Refined backdrop with backdrop-filter blur
   • Touch-friendly minimum tap targets (44px)
   • Visual feedback on tap (active state)
   • Improved spacing matching desktop V2 sidebar
   • Better scroll within sidebar on long content
   • RTL-aware close button affordance
   • Dark mode consistency
   ════════ */

@media (max-width: 900px) {
    /* === Sidebar — match desktop V2 design quality === */
    .sidebar {
        /* Smoother enterprise-grade animation */
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1) !important;
        /* Subtle inset highlight for premium feel */
        box-shadow:
            -8px 0 32px rgba(0, 0, 0, 0.35),
            0 0 0 1px inset rgba(255, 255, 255, 0.03) !important;
        /* Smooth internal scroll */
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        /* Refined width — slightly more breathing room */
        width: 84vw !important;
        max-width: 320px !important;
    }
    [dir="ltr"] .sidebar {
        box-shadow:
            8px 0 32px rgba(0, 0, 0, 0.35),
            0 0 0 1px inset rgba(255, 255, 255, 0.03) !important;
    }

    /* === Backdrop — enhanced with blur === */
    .sb-backdrop {
        background: rgba(3, 6, 12, 0.55) !important;
        backdrop-filter: blur(6px) saturate(140%) !important;
        -webkit-backdrop-filter: blur(6px) saturate(140%) !important;
        transition: opacity 0.32s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    /* === Internal sidebar polish — touch-friendly === */
    .sidebar-logo {
        padding: 20px 18px 16px !important;
        position: relative;
    }
    .logo-svg {
        width: 40px !important;
        height: 40px !important;
    }
    .logo-tagline {
        font-size: 9px !important;
        letter-spacing: 1.8px !important;
    }
    .sidebar-status {
        padding: 11px 16px !important;
        margin: 10px 14px !important;
        border-radius: 10px !important;
        font-size: 11px !important;
    }
    .sidebar-section {
        padding: 14px 14px !important;
    }
    .sidebar-section + .sidebar-section::before {
        content: "";
        position: absolute;
        top: 0;
        left: 14px;
        right: 14px;
        height: 1px;
        background: var(--border);
        opacity: 0.4;
    }
    .sidebar-section-title {
        font-size: 10.5px !important;
        letter-spacing: 1.5px !important;
        font-weight: 700 !important;
        opacity: 0.7;
        margin-bottom: 10px !important;
        padding-left: 4px;
    }
    /* Touch-friendly nav items */
    .sidebar-nav a {
        padding: 11px 12px !important;
        font-size: 15px !important;
        min-height: 44px !important;
        border-radius: 10px !important;
        gap: 12px !important;
        transition: background 0.15s ease, transform 0.1s ease !important;
        -webkit-tap-highlight-color: transparent;
    }
    .sidebar-nav a:active {
        background: var(--blue-fill) !important;
        color: #fff !important;
        transform: scale(0.98);
    }
    .sidebar-nav a:hover {
        background: linear-gradient(90deg, var(--blue-dim), transparent 90%) !important;
        color: var(--blue) !important;
    }
    .sidebar-nav a .nav-icon {
        width: 28px !important;
        height: 28px !important;
        font-size: 16px !important;
        background: transparent !important;
        border: none !important;
    }

    /* Contact links — touch-friendly */
    .sidebar-contact a {
        padding: 9px 4px !important;
        font-size: 14px !important;
        min-height: 36px !important;
        gap: 9px !important;
        border-radius: 8px;
        -webkit-tap-highlight-color: transparent;
    }
    .sidebar-contact a:active {
        background: var(--blue-dim);
    }

    .sidebar-about {
        font-size: 13.5px !important;
        line-height: 1.7 !important;
    }

    /* Bottom CTA — premium */
    .sidebar-bottom {
        padding: 14px 16px 18px !important;
        background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.08));
    }
    .cta-sidebar {
        padding: 13px !important;
        font-size: 15px !important;
        min-height: 48px !important;
        border-radius: 10px !important;
        box-shadow:
            0 1px 0 inset rgba(255, 255, 255, 0.12),
            0 4px 16px rgba(66, 153, 225, 0.35) !important;
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.1s ease, box-shadow 0.18s ease !important;
    }
    .cta-sidebar:active {
        transform: scale(0.98);
    }
    .dash-sidebar-btn {
        padding: 10px !important;
        font-size: 12px !important;
        min-height: 40px !important;
        border-radius: 9px !important;
        -webkit-tap-highlight-color: transparent;
    }
    .theme-toggle-btn {
        width: 38px !important;
        height: 38px !important;
        font-size: 16px !important;
        -webkit-tap-highlight-color: transparent;
    }

    /* === Hamburger button — touch-friendly === */
    .topbar-menu-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        font-size: 20px !important;
        -webkit-tap-highlight-color: transparent;
        transition: background 0.15s ease, transform 0.1s ease !important;
    }
    .topbar-menu-btn:active {
        transform: scale(0.94);
        background: var(--blue-fill) !important;
        color: #fff !important;
    }
}

/* === Reduce motion =================================================== */
@media (prefers-reduced-motion: reduce) and (max-width: 900px) {
    .sidebar, .sb-backdrop, .sidebar-nav a, .cta-sidebar, .topbar-menu-btn {
        transition: none !important;
        animation: none !important;
    }
}

/* === Dark mode mobile sidebar refinement === */
@media (max-width: 900px) {
    [data-theme="dark"] .sidebar {
        box-shadow:
            -8px 0 40px rgba(0, 0, 0, 0.6),
            0 0 0 1px inset rgba(255, 255, 255, 0.04) !important;
    }
    [data-theme="dark"][dir="ltr"] .sidebar,
    html[dir="ltr"][data-theme="dark"] .sidebar {
        box-shadow:
            8px 0 40px rgba(0, 0, 0, 0.6),
            0 0 0 1px inset rgba(255, 255, 255, 0.04) !important;
    }
}

/* ════════
   IT4U-MARKETING-SIDEBAR-POLISH-V1 END
   ════════ */
/* ════════
   IT4U-SIDEBAR-UNIFIED-V5 START
   DESKTOP-ONLY sidebar refinements. The mobile sidebar is intentionally
   left alone so the original drawer-overlay behavior (already defined
   elsewhere in the page CSS) takes effect on phones.

   Why V5: V1–V4 tried to unify desktop and mobile under one rail model.
   On real phones the rail UX was awkward — labels bleeding, layout
   breaks, no clear toggle button. User asked to revert mobile to the
   prior drawer behavior while keeping the desktop enterprise sidebar.

   V5 scope (this block):
   • Only @media (min-width: 901px) — desktop
   • Two states: expanded (244 px) and rail (60 px, via body.sidebar-rail)
   • Same colors / fonts / spacing as the panel's V2 rail design
   • Hover tooltips on rail icons
   • Edge toggle button visible
   • Topbar hamburger button hidden (rail toggle is the desktop UX)

   Mobile (≤900 px): NO rules from this block. The existing
   @media (max-width: 900px) drawer CSS earlier in the page wins.
   Mobile users get: sidebar hidden offscreen by default, hamburger in
   topbar opens it as a full overlay drawer with backdrop.
   ════════ */

@media (min-width: 901px) {
    /* === Sidebar shell — fixed-position rail/expanded === */
    .sidebar {
        background: var(--surface) !important;
        color: var(--text);
        position: fixed !important;
        top: 0 !important;
        height: 100vh !important;
        z-index: 50;
        overflow-y: auto;
        overflow-x: hidden;
        transition:
            transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
            width 0.32s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow:
            0 0 0 1px inset rgba(255, 255, 255, 0.025);
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        width: 244px !important;
        right: 0 !important;  /* RTL default */
        left: auto !important;
        border-left: 1px solid var(--border) !important;
        border-right: none !important;
        transform: translateX(0) !important;
    }
    [dir="ltr"] .sidebar {
        right: auto !important;
        left: 0 !important;
        border-left: none !important;
        border-right: 1px solid var(--border) !important;
    }

    /* === Sidebar internal styling — expanded layout === */
    .sidebar-logo {
        padding: 18px 16px 14px !important;
        border-bottom: 1px solid var(--border) !important;
    }
    .logo-svg { width: 36px !important; height: 36px !important; }
    .logo-tagline { font-size: 8.5px !important; letter-spacing: 1.6px !important; }

    .sidebar-status {
        padding: 10px 14px !important;
        margin: 10px 12px !important;
        border: 1px solid rgba(72, 187, 120, 0.15) !important;
        background: rgba(72, 187, 120, 0.06) !important;
        border-radius: 9px !important;
        font-size: 10.5px !important;
    }

    .sidebar-section {
        padding: 14px 14px 10px !important;
        border-bottom: 0 !important;
        position: relative;
    }
    .sidebar-section + .sidebar-section::before {
        content: "";
        position: absolute;
        top: 0;
        left: 14px;
        right: 14px;
        height: 1px;
        background: var(--border);
        opacity: 0.5;
    }
    .sidebar-section-title {
        font-size: 10px !important;
        letter-spacing: 1.4px !important;
        font-weight: 700 !important;
        margin-bottom: 8px !important;
        opacity: 0.75;
    }

    .sidebar-nav a {
        display: flex !important;
        align-items: center !important;
        padding: 10px 10px !important;
        font-size: 13.5px !important;
        font-weight: 500 !important;
        color: var(--text2) !important;
        border-radius: 9px !important;
        margin-bottom: 2px !important;
        gap: 11px !important;
        min-height: 40px;
        transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease !important;
        text-decoration: none;
    }
    .sidebar-nav a:hover {
        background: var(--blue-dim) !important;
        color: var(--blue) !important;
    }
    .sidebar-nav a:active {
        transform: scale(0.98);
    }
    .sidebar-nav a.is-active {
        background: var(--blue-fill) !important;
        color: #fff !important;
        font-weight: 600 !important;
    }
    .sidebar-nav a .nav-icon {
        width: 24px !important;
        height: 24px !important;
        font-size: 15px !important;
        background: transparent !important;
        border: none !important;
        flex-shrink: 0;
    }

    .sidebar-about {
        font-size: 12.5px !important;
        line-height: 1.7 !important;
        color: var(--muted) !important;
    }

    .sidebar-contact a {
        padding: 7px 4px !important;
        font-size: 12.5px !important;
        gap: 8px !important;
        min-height: 32px;
        transition: color 0.15s ease, padding 0.15s ease;
    }

    .sidebar-bottom {
        padding: 14px 14px 16px !important;
        border-top: 1px solid var(--border) !important;
        background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.06));
    }
    .cta-sidebar {
        padding: 11px !important;
        font-size: 14px !important;
        min-height: 44px;
        border-radius: 10px !important;
        box-shadow:
            0 1px 0 inset rgba(255, 255, 255, 0.1),
            0 4px 12px rgba(66, 153, 225, 0.28);
        transition: transform 0.1s ease, box-shadow 0.18s ease !important;
    }
    .cta-sidebar:active { transform: scale(0.98); }

    .dash-sidebar-btn {
        padding: 9px !important;
        font-size: 11px !important;
        min-height: 36px;
        border-radius: 9px !important;
    }


    .theme-toggle-btn {
        width: 34px !important;
        height: 34px !important;
        font-size: 14px !important;
        border-radius: 8px !important;
    }

    /* === Main content reserves space for the fixed sidebar === */
    .main {
        margin-right: 244px !important;
        margin-left: 0 !important;
        transition: margin 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    }
    [dir="ltr"] .main {
        margin-right: 0 !important;
        margin-left: 244px !important;
    }

    /* === RAIL mode (collapsed via body.sidebar-rail) === */
    body.sidebar-rail .sidebar {
        width: 60px !important;
    }
    body.sidebar-rail .main {
        margin-right: 60px !important;
    }
    [dir="ltr"] body.sidebar-rail .main {
        margin-left: 60px !important;
        margin-right: 0 !important;
    }
    /* Rail-state: hide labels, keep only icons centered */
    body.sidebar-rail .sidebar-logo .logo-text-wrap,
    body.sidebar-rail .sidebar-status,
    body.sidebar-rail .sidebar-section-title,
    body.sidebar-rail .sidebar-nav a > span:not(.nav-icon),
    body.sidebar-rail .sidebar-section:has(.sidebar-about),
    body.sidebar-rail .sidebar-section:has(.sidebar-contact),
    body.sidebar-rail .sidebar-bottom .cta-sidebar,
    body.sidebar-rail .sidebar-bottom .dash-sidebar-btn,
    body.sidebar-rail .sidebar-bottom .theme-row .theme-label {
        opacity: 0;
        max-width: 0;
        overflow: hidden;
        pointer-events: none;
    }
    body.sidebar-rail .sidebar-logo {
        padding: 18px 0 14px !important;
        text-align: center;
    }
    body.sidebar-rail .sidebar-logo .logo-wrap {
        justify-content: center !important;
        gap: 0 !important;
    }
    body.sidebar-rail .sidebar-nav a {
        justify-content: center !important;
        padding: 11px 0 !important;
        gap: 0 !important;
        position: relative;
    }
    body.sidebar-rail .sidebar-bottom {
        padding: 10px 0 !important;
        text-align: center;
    }
    body.sidebar-rail .sidebar-bottom .theme-row {
        justify-content: center !important;
    }

    /* === Toggle button — desktop only === */
    .sidebar-toggle.sidebar-toggle-v2 {
        display: flex !important;
    }
    .topbar-menu-btn {
        display: none !important;
    }

    /* === Hover tooltips on rail icons === */
    body.sidebar-rail .sidebar-nav a::after {
        content: attr(data-tooltip);
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: var(--surface2);
        color: var(--text);
        border: 1px solid var(--border);
        padding: 5px 10px;
        border-radius: 6px;
        font-size: 12.5px;
        font-weight: 500;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
        z-index: 60;
        right: 100%;
        margin-right: 12px;
    }
    [dir="ltr"] body.sidebar-rail .sidebar-nav a::after {
        right: auto;
        left: 100%;
        margin-right: 0;
        margin-left: 12px;
    }
    body.sidebar-rail .sidebar-nav a:hover::after {
        opacity: 1;
    }

    /* === Dark mode shadow refinement (desktop only) === */
    @media (prefers-color-scheme: dark) {
        .sidebar {
            box-shadow:
                -8px 0 32px rgba(0, 0, 0, 0.6),
                0 0 0 1px inset rgba(255, 255, 255, 0.04) !important;
        }
        [dir="ltr"] .sidebar {
            box-shadow:
                8px 0 32px rgba(0, 0, 0, 0.6),
                0 0 0 1px inset rgba(255, 255, 255, 0.04) !important;
        }
    }
}

/* === Page overflow safety (all viewports) — harmless on mobile === */
html, body {
    overflow-x: hidden !important;
    overflow-x: clip !important;
    max-width: 100vw !important;
}

/* === Reduced motion (all viewports) === */
@media (prefers-reduced-motion: reduce) {
    .sidebar, .sidebar-toggle, .sidebar-nav a, .sb-backdrop, .cta-sidebar, .topbar-menu-btn {
        transition: none !important;
        animation: none !important;
    }
}

/* ════════
   IT4U-SIDEBAR-UNIFIED-V5 END
   ════════ */
