/*
 Theme Name:   Crozsi IT
 Theme URI:    https://crozsi.com
 Description:  Custom WordPress theme for Crozsi — IT Reseller. Built with Tailwind CSS.
 Author:       Crozsi
 Author URI:   https://crozsi.com
 Requires at least: 6.0
 Tested up to: 6.9
 Requires PHP: 7.4
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  https://www.gnu.org/licenses/gpl-2.0.html
 Text Domain:  crozsi-it
*/

/* ==========================================================================
   Crozsi Brand Design System — 60-30-10
   ---------------------------------------------------------------------------
   60 %  →  Off-White / Slate-50  (backgrounds, content areas)
   30 %  →  Deep Navy  / Slate-900 (header, footer, section blocks, cards)
   10 %  →  Electric Blue / Blue-600 (CTAs, links, accents)
   ========================================================================== */

:root {
    /* ── 60 % – Dominant ── */
    --crozsi-white:   #ffffff;
    --crozsi-light:   #f8fafc;   /* Slate-50 — easy on the eyes   */
    --crozsi-muted:   #e2e8f0;   /* Slate-200 — soft borders      */

    /* ── 30 % – Secondary ── */
    --crozsi-navy:    #0f172a;   /* Slate-900 — headers & footers */
    --crozsi-navy-80: #1e293b;   /* Slate-800 — elevated panels   */
    --crozsi-navy-60: #334155;   /* Slate-700 — secondary text    */

    /* ── 10 % – Accent ── */
    --crozsi-blue:    #2563eb;   /* Blue-600 — primary CTA        */
    --crozsi-blue-h:  #1d4ed8;   /* Blue-700 — hover state        */
    --crozsi-blue-10: rgba(37, 99, 235, 0.10); /* Blue ghost      */

    /* ── Design Tokens ── */
    --crozsi-radius:     8px;    /* rounded-lg — cards & inputs   */
    --crozsi-radius-xl: 12px;    /* rounded-xl — feature cards    */
    --crozsi-shadow:    0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); /* shadow-lg */
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', ui-sans-serif, system-ui,
                 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 'Helvetica Neue', Arial, 'Noto Sans', sans-serif,
                 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
                 'Noto Color Emoji';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--crozsi-navy);
    background-color: var(--crozsi-light);
}

/* ==========================================================================
   Partner Logos  — grayscale → full-colour on hover
   ========================================================================== */

.crozsi-partner-logo {
    filter: grayscale(100%);
    opacity: 0.6;
    transition: filter 0.35s ease, opacity 0.35s ease, transform 0.35s ease,
                background-color 0.35s ease, border-color 0.35s ease;
}

.crozsi-partner-logo:hover,
.crozsi-partner-logo:focus-visible {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.08);
}

/* ==========================================================================
   Store Archive — Sidebar & Filter Drawer
   ========================================================================== */

/* Custom checkbox styling */
.crozsi-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--crozsi-muted);
    border-radius: 4px;
    background: var(--crozsi-white);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    flex-shrink: 0;
}

.crozsi-checkbox:checked {
    background: var(--crozsi-blue);
    border-color: var(--crozsi-blue);
}

.crozsi-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid var(--crozsi-white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.crozsi-checkbox:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--crozsi-blue-10);
}

/* Mobile filter drawer */
@media (max-width: 1023px) {
    .crozsi-filter-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 320px;
        max-width: 85vw;
        z-index: 50;
        background: var(--crozsi-white);
        overflow-y: auto;
        padding: 24px;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .crozsi-filter-sidebar.crozsi-filter-drawer--open {
        transform: translateX(0);
    }
}

/* Pagination styling */
.page-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
    justify-content: center;
}

.page-numbers li {
    list-style: none;
}

.page-numbers a,
.page-numbers span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--crozsi-radius);
    border: 1px solid var(--crozsi-muted);
    color: var(--crozsi-navy-60);
    background: var(--crozsi-white);
    transition: all 0.2s ease;
    text-decoration: none;
}

.page-numbers a:hover {
    background: var(--crozsi-light);
    border-color: var(--crozsi-blue);
    color: var(--crozsi-blue);
}

.page-numbers .current {
    background: var(--crozsi-blue);
    border-color: var(--crozsi-blue);
    color: var(--crozsi-white);
}

/* ==========================================================================
   Sticky Checkout Bar  (mobile "Buy and Go" trigger)
   ========================================================================== */

.crozsi-sticky-checkout {
    /* Hidden on desktop, visible below lg */
    display: none;
}

@media (max-width: 1023px) {
    .crozsi-sticky-checkout {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        background: var(--crozsi-navy);
        border-top: 2px solid var(--crozsi-blue);
        padding: 12px 16px;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
        animation: crozsi-slide-up 0.35s ease-out;
    }
}

@keyframes crozsi-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ==========================================================================
   Floating CTA Button  ("Speak to an Architect" – consultation trigger)
   ========================================================================== */

.crozsi-floating-cta {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    animation: crozsi-bounce-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (max-width: 639px) {
    .crozsi-floating-cta {
        bottom: 16px;
        right: 16px;
    }
}

@keyframes crozsi-bounce-in {
    0%   { transform: scale(0) rotate(-12deg); opacity: 0; }
    60%  { transform: scale(1.1) rotate(2deg);  opacity: 1; }
    100% { transform: scale(1) rotate(0deg);    opacity: 1; }
}

.crozsi-floating-cta__pulse {
    position: absolute;
    inset: -4px;
    border-radius: 9999px;
    background: var(--crozsi-blue-10);
    animation: crozsi-pulse-ring 2s infinite;
}

@keyframes crozsi-pulse-ring {
    0%   { transform: scale(1);   opacity: 0.6; }
    70%  { transform: scale(1.3); opacity: 0; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* ==========================================================================
   MAIN HEADER — always on top so menu bar is never covered
   ========================================================================== */

body .crozsi-site-header {
    z-index: 100;
}

/* ==========================================================================
   NEW HEADER MEGAMENU — Explore Products dropdown (outside header, JS-driven)
   ========================================================================== */

@media (min-width: 1024px) {
    /* Panel is fixed below header; hidden until .crozsi-mega-panel--is-open */
    .crozsi-mega-panel--dropdown {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        top: 64px !important; /* starts below menu bar */
        margin: 0 !important;
        z-index: 90 !important; /* below header so menu bar stays visible */
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.2s ease-out, visibility 0.2s ease-out;
    }

    .crozsi-mega-panel--dropdown.crozsi-mega-panel--is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}

/* ==========================================================================
   FLOATING CHAT NOW BUTTON — Global, bottom-right (per screenshot)
   ========================================================================== */

.crozsi-chat-now {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9997;
}
@media (max-width: 639px) {
    .crozsi-chat-now {
        bottom: 16px;
        right: 16px;
    }
}

/* ==========================================================================
   MEGA MENU SYSTEM (Scoped & Isolated) — legacy wp_nav_menu mega
   ========================================================================== */

@media (min-width: 1024px) {

    /* ── 1. Top Level Links (The "Buttons" in the Navy Bar) ── */
    .crozsi-desktop-nav > ul > li > a {
        display: flex;
        align-items: center;
        height: 100%; /* Fill the bar height */
        padding: 1rem 0;
        font-size: 0.875rem; /* 14px */
        font-weight: 600;
        color: #cbd5e1; /* text-slate-300 */
        border-bottom: 3px solid transparent;
        transition: all 0.2s;
        text-decoration: none;
    }

    /* Top Level Hover */
    .crozsi-desktop-nav > ul > li:hover > a,
    .crozsi-desktop-nav > ul > li.current-menu-item > a {
        color: #ffffff;
        border-bottom-color: #2563eb; /* Active Blue Border */
    }

    /* ── 2. The Mega Dropdown Container ── */
    /* Ensure parent is static so dropdown can be full-width */
    .crozsi-desktop-nav > ul > li.mega-menu {
        position: static !important;
    }

    .crozsi-desktop-nav > ul > li.mega-menu > ul.sub-menu {
        /* Layout */
        display: grid !important;
        grid-template-columns: repeat(4, 1fr); /* 4 Columns */
        gap: 0;
        
        /* Positioning */
        position: absolute;
        left: 0;
        right: 0;
        top: 100%; /* Sits directly below Navy Bar */
        width: 100%;
        margin: 0;
        z-index: 99999;
        
        /* Visuals */
        background: #ffffff !important;
        border-top: 4px solid #2563eb;
        box-shadow: 0 50px 100px -20px rgba(15, 23, 42, 0.4);
        padding: 3rem max(2rem, calc((100vw - 1280px) / 2)); /* Center content */
        
        /* State */
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
        pointer-events: none;
    }

    /* ── 3. Hover Bridge (Keeps menu open) ── */
    .crozsi-desktop-nav > ul > li.mega-menu:after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 20px; /* Invisible buffer zone */
        transform: translateY(100%);
        z-index: 99998;
    }

    /* ── 4. Reveal Logic ── */
    /* Show when hovering the Link OR the Dropdown itself */
    .crozsi-desktop-nav > ul > li.mega-menu:hover > ul.sub-menu,
    .crozsi-desktop-nav > ul > li.mega-menu > ul.sub-menu:hover {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    /* ── 5. Dropdown RESET (Fixes the "2 Menus" Glitch) ── */
    /* This forces the dropdown links to look like standard links, not nav buttons */
    .crozsi-desktop-nav > ul > li.mega-menu > ul.sub-menu a {
        display: inline-block;
        padding: 0 !important;
        height: auto !important;
        border: none !important;
        color: #0f172a !important; /* Navy Text */
        font-weight: 500;
        background: transparent !important;
    }

    /* ── 6. Column Headers (Level 2) ── */
    .crozsi-desktop-nav > ul > li.mega-menu > ul.sub-menu > li {
        padding: 0 2rem;
        border-right: 1px solid #f1f5f9;
        list-style: none;
    }
    .crozsi-desktop-nav > ul > li.mega-menu > ul.sub-menu > li:last-child {
        border-right: none;
    }

    /* Header Text Style */
    .crozsi-desktop-nav > ul > li.mega-menu > ul.sub-menu > li > a {
        display: block;
        font-family: 'Plus Jakarta Sans', sans-serif;
        font-size: 0.75rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: #94a3b8 !important; /* Gray Label */
        margin-bottom: 1.5rem;
        pointer-events: none; /* Not clickable */
    }

    /* ── 7. Link Items (Level 3) ── */
    .crozsi-desktop-nav > ul > li.mega-menu > ul.sub-menu > li > ul.sub-menu {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    /* Link Item Style */
    .crozsi-desktop-nav > ul > li.mega-menu > ul.sub-menu > li > ul.sub-menu > li > a {
        font-size: 0.95rem;
        transition: transform 0.2s, color 0.2s;
    }

    /* Link Hover */
    .crozsi-desktop-nav > ul > li.mega-menu > ul.sub-menu > li > ul.sub-menu > li > a:hover {
        color: #2563eb !important; /* Blue */
        transform: translateX(6px);
    }
}

/* ==========================================================================
   Mobile Navigation — Toggle & Accordion Animations
   ========================================================================== */

@media (max-width: 1023px) {
    /* ── Mobile Menu Container ── */
    #crozsi-mobile-menu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
        opacity: 0;
    }

    #crozsi-mobile-menu.is-open {
        max-height: 1000px; /* Adjust based on content */
        opacity: 1;
        transition: max-height 0.4s ease-in, opacity 0.3s ease-in;
    }

    /* ── Sub-menu Accordion (all levels) ── */
    #crozsi-mobile-menu ul.sub-menu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
        padding-left: 1rem;
        margin-top: 0.25rem;
    }

    #crozsi-mobile-menu li.is-open > ul.sub-menu {
        max-height: 500px; /* Adjust based on content */
        transition: max-height 0.4s ease-in;
    }

    /* ── Nested sub-menus (level 3) ── */
    #crozsi-mobile-menu ul.sub-menu ul.sub-menu {
        padding-left: 1.5rem;
        margin-top: 0.25rem;
    }

    /* ── Parent menu items with sub-menus ── */
    #crozsi-mobile-menu li.menu-item-has-children > a,
    #crozsi-mobile-menu li.page_item_has_children > a,
    #crozsi-mobile-menu li.menu-item-has-children > span > a,
    #crozsi-mobile-menu li.page_item_has_children > span > a {
        position: relative;
        padding-right: 2rem;
    }

    /* ── Add arrow indicator for parent items ── */
    #crozsi-mobile-menu li.menu-item-has-children > a::after,
    #crozsi-mobile-menu li.page_item_has_children > a::after,
    #crozsi-mobile-menu li.menu-item-has-children > span > a::after,
    #crozsi-mobile-menu li.page_item_has_children > span > a::after {
        content: '';
        position: absolute;
        right: 0.75rem;
        top: 50%;
        transform: translateY(-50%) rotate(0deg);
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 6px solid currentColor;
        transition: transform 0.3s ease;
    }

    /* ── Rotate arrow when sub-menu is open ── */
    #crozsi-mobile-menu li.is-open > a::after,
    #crozsi-mobile-menu li.is-open > span > a::after {
        transform: translateY(-50%) rotate(180deg);
    }
}

/* Make Navy Menu items bolder and brighter */
.bg-crozsi-navy nav .menu-item a {
    font-weight: 600 !important; /* Make text bolder */
    letter-spacing: 0.03em;      /* Slight spacing for readability */
    opacity: 0.9;
}

.bg-crozsi-navy nav .menu-item a:hover {
    opacity: 1;
    color: #ffffff !important;   /* Pure white on hover */
}