/**
 * WCG Course Catalog Styles
 * 
 * Dark hero command center with filterable course grid.
 * Renders inside Kadence header/footer — no page-level overrides needed.
 *
 * Color Palette:
 *   --wcg-hero-dark:    #0a0a0a → #141414  (hero gradient)
 *   --wcg-accent:       #f65401             (WCG orange — brand accent)
 *   --wcg-cream:        #faf7f2             (page background — cream)
 *   --wcg-card:         #ffffff             (card background — white)
 *   --wcg-border:       #e5e2dd             (card border — warm grey)
 *   --wcg-border-inner: #f0ede8             (card footer divider — lighter)
 *   --wcg-text-dark:    #1a1a1a             (headings)
 *   --wcg-text-body:    #777777             (card excerpt text)
 *   --wcg-text-muted:   rgba(255,255,255,0.35) (hero secondary text)
 *
 * Category Colors (inline via PHP):
 *   IWCF / IADC:           #f65401  (WCG orange — flagship)
 *   Energy Safety Canada:  #0e7c6b  (teal)
 *   WorkplaceNL:           #1a6fb5  (blue)
 *   Generic/Workplace:     #8b8b96  (muted grey)
 *
 * Breakpoints:
 *   ≤1024px  — Tablet (2-col grid, tighter spacing)
 *   ≤767px   — Mobile (1-col grid, stacked filters, scrollable pills)
 *   ≤480px   — Small mobile (further tightening)
 *
 * @package WCG
 * @version 1.0.0
 */


/* ==========================================================================
   BASE / RESET
   ========================================================================== */

.wcg-cat-hero *,
.wcg-cat-grid-wrap * {
    box-sizing: border-box;
}

/*
 * NOTE: Kadence applies global styles to <button> and <input> elements.
 * Component rules below use !important on properties that Kadence overrides
 * (background, border, color, box-shadow, padding). This is surgical — only
 * the specific properties that conflict get the flag, not everything.
 */


/* ==========================================================================
   DARK HERO
   ========================================================================== */

.wcg-cat-hero {
    /* Two-stop dark gradient — #0a0a0a (near-black) → #141414 (charcoal) */
    background: linear-gradient(180deg, #0a0a0a 0%, #141414 100%);
    padding: 3.5rem 0 2.5rem;
    position: relative;
    z-index: 10;                         /* ensure dropdown overlays content below */
    /* NOTE: no overflow:hidden — dropdown menu must extend below hero boundary */
}

/* Subtle engineering grid texture overlay */
.wcg-cat-hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}


/* ==========================================================================
   CONTAINER
   ========================================================================== */

.wcg-cat-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
}


/* ==========================================================================
   HEADER (title + count)
   ========================================================================== */

.wcg-cat-header {
    display: flex;
    align-items: flex-end;                       /* count aligns to bottom of title */
    gap: 1rem;
    margin-bottom: 2.25rem;
}

.wcg-cat-header-text {
    flex: 1;
}

.wcg-cat-overline {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(255,255,255,0.4);       /* hero secondary text */
    margin: 0 0 0.5rem;
    font-weight: 500;
    /* Orange accent bar — left border, vertically centered on overline text */
    border-left: 3px solid #f65401;     /* WCG orange */
    padding: 4px 0 4px 0.625rem;        /* top/bottom breathing room + left offset from border */
}

.wcg-cat-title {
    font-size: 2.5rem;
    font-weight: 400;
    color: #fff;
    margin: 0;
    line-height: 1.15;
}

.wcg-cat-count {
    color: rgba(255,255,255,0.35);      /* hero muted text */
    font-size: 0.875rem;
    margin: 0;
    white-space: nowrap;
}


/* ==========================================================================
   SEARCH BAR
   ========================================================================== */

.wcg-cat-search {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.06);         /* subtle glass effect */
    border: 1px solid rgba(255,255,255,0.1);    /* faint border */
    border-radius: 6px;
    padding: 0 1rem;
    margin-bottom: 2rem;
}

.wcg-cat-search-icon {
    width: 20px;
    height: 20px;
    color: rgba(255,255,255,0.4);
    flex-shrink: 0;
}

.wcg-cat-search input {
    flex: 1;
    background: transparent !important;          /* Kadence override */
    border: none !important;                     /* Kadence override */
    outline: none !important;
    padding: 0.875rem 0.75rem !important;        /* Kadence override */
    color: #fff !important;                      /* Kadence override */
    font-size: 0.9375rem;
    font-family: inherit;
    box-shadow: none !important;                 /* Kadence override */
}

.wcg-cat-search input:focus {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.wcg-cat-search input::placeholder {
    color: rgba(255,255,255,0.3);
}

.wcg-cat-search-clear {
    background: none !important;                 /* Kadence override */
    border: none !important;                     /* Kadence override */
    color: rgba(255,255,255,0.4) !important;     /* Kadence override */
    cursor: pointer;
    width: 18px;
    height: 18px;
    padding: 0 !important;                       /* Kadence override */
    line-height: 1;
    box-shadow: none !important;                 /* Kadence override */
}

.wcg-cat-search-clear:hover {
    color: rgba(255,255,255,0.7) !important;
    background: none !important;
}

.wcg-cat-search-clear svg {
    width: 100%;
    height: 100%;
}


/* ==========================================================================
   FILTER ROW
   ========================================================================== */

.wcg-cat-filters {
    display: flex;
    align-items: flex-end;
    gap: 2rem;
    flex-wrap: wrap;
}

.wcg-cat-filter-group {
    flex: 1;
    min-width: 0;
}

.wcg-cat-filter-label {
    display: block;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255,255,255,0.35);      /* hero muted label */
    margin-bottom: 0.5rem;
}


/* ==========================================================================
   SUBJECT PILLS (category filter buttons)
   ========================================================================== */

.wcg-cat-pills {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.wcg-cat-pill {
    padding: 0.5rem 0.875rem !important;         /* Kadence override */
    border-radius: 4px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;

    /* Default (inactive) state */
    border: 1px solid rgba(255,255,255,0.12) !important;   /* Kadence override */
    background: rgba(255,255,255,0.04) !important;          /* Kadence override */
    color: rgba(255,255,255,0.55) !important;               /* Kadence override */
    font-weight: 400;
    box-shadow: none !important;                             /* Kadence override */
}

/* Active pill — WCG orange accent */
.wcg-cat-pill[data-active="true"] {
    border-color: #f65401 !important;
    background: rgba(246,84,1,0.15) !important;
    color: #f65401 !important;
    font-weight: 600;
}

.wcg-cat-pill:hover {
    border-color: rgba(255,255,255,0.25) !important;
    color: rgba(255,255,255,0.75) !important;
    background: rgba(255,255,255,0.06) !important;
}

.wcg-cat-pill[data-active="true"]:hover {
    border-color: #f65401 !important;
    color: #f65401 !important;
    background: rgba(246,84,1,0.15) !important;
}


/* ==========================================================================
   LOCATION DROPDOWN (custom — replaces native <select> for full control)
   ========================================================================== */

.wcg-cat-loc-wrap {
    flex-shrink: 0;
}

.wcg-cat-loc-dropdown {
    position: relative;
}

/* Trigger button — styled to match pill aesthetics */
.wcg-cat-loc-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    appearance: none;
    background: rgba(255,255,255,0.04) !important; /* override Kadence global button styles */
    border: 1px solid rgba(255,255,255,0.12) !important;
    border-radius: 4px;
    color: rgba(255,255,255,0.65) !important;
    padding: 0.5rem 0.75rem !important;          /* Kadence override */
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    min-width: 160px;
    transition: border-color 0.15s;
    box-shadow: none !important;         /* override Kadence focus glow */
}

.wcg-cat-loc-trigger:hover {
    border-color: rgba(255,255,255,0.25) !important;
    background: rgba(255,255,255,0.06) !important;
    color: rgba(255,255,255,0.75) !important;
}

.wcg-cat-loc-trigger:focus,
.wcg-cat-loc-trigger:active {
    background: rgba(255,255,255,0.04) !important;
    color: rgba(255,255,255,0.65) !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Active state — when dropdown is open */
.wcg-cat-loc-dropdown[data-open="true"] .wcg-cat-loc-trigger {
    border-color: rgba(255,255,255,0.3) !important;
}

.wcg-cat-loc-trigger-text {
    flex: 1;
    text-align: left;
}

.wcg-cat-loc-chevron {
    width: 14px;
    height: 14px;
    color: rgba(255,255,255,0.35);
    flex-shrink: 0;
    transition: transform 0.2s;
}

.wcg-cat-loc-dropdown[data-open="true"] .wcg-cat-loc-chevron {
    transform: rotate(180deg);
}

/* Dropdown menu — positioned below trigger */
.wcg-cat-loc-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    background: #1a1a1a;                         /* charcoal dropdown bg */
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    padding: 4px 0;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.wcg-cat-loc-dropdown[data-open="true"] .wcg-cat-loc-menu {
    display: block;
}

/* Individual options */
.wcg-cat-loc-option {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.65);               /* readable light text on dark bg */
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    white-space: nowrap;
}

.wcg-cat-loc-option:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
}

/* Active/selected option */
.wcg-cat-loc-option--active {
    color: #f65401;                              /* WCG orange — selected */
    font-weight: 600;
}


/* ==========================================================================
   GRID CONTAINER
   ========================================================================== */

.wcg-cat-grid-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem 4rem;
}


/* ==========================================================================
   COURSE GRID
   ========================================================================== */

.wcg-cat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}


/* ==========================================================================
   COURSE CARD
   ========================================================================== */

.wcg-cat-card {
    background: #fff;                            /* card background */
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e5e2dd;                   /* warm grey border */
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

/* Hover — lift + shadow (desktop only) */
@media (hover: hover) {
    .wcg-cat-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    }

    .wcg-cat-card:hover .wcg-cat-card-arrow {
        color: #f65401;                          /* WCG orange on hover */
        transform: translateX(2px);
    }

    .wcg-cat-card:hover .wcg-cat-card-img {
        transform: scale(1.05);
    }
}

/* Hidden state — applied by JS when card doesn't match filters */
.wcg-cat-card[data-hidden="true"] {
    display: none;
}


/* ==========================================================================
   CARD: IMAGE
   ========================================================================== */

.wcg-cat-card-img-wrap {
    height: 180px;
    overflow: hidden;
}

.wcg-cat-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

/* Fallback when no featured image is set */
.wcg-cat-card-img-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a2332 0%, #2a1f1f 100%);
}


/* ==========================================================================
   CARD: CONTENT
   ========================================================================== */

.wcg-cat-card-content {
    padding: 1.25rem 1.25rem 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wcg-cat-card-title {
    font-size: 1.125rem;
    font-weight: 400;
    color: #1a1a1a;                              /* dark heading */
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

.wcg-cat-card-excerpt {
    color: #777;                                 /* body text grey */
    font-size: 0.8125rem;
    line-height: 1.6;
    margin: 0 0 auto;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* ==========================================================================
   CARD: FOOTER (category bar + arrow)
   ========================================================================== */

.wcg-cat-card-footer {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    margin-top: 1rem;
    border-top: 1px solid #f0ede8;               /* lighter inner divider */
}

.wcg-cat-card-category {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Small colored dash before category name */
.wcg-cat-card-category-bar {
    width: 14px;
    height: 2px;
    border-radius: 1px;
    flex-shrink: 0;
    /* background-color set inline via PHP (category-specific) */
}

.wcg-cat-card-category-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    /* color set inline via PHP (category-specific) */
}

/* Arrow — hidden by default, appears on hover */
.wcg-cat-card-arrow {
    margin-left: auto;
    width: 16px;
    height: 16px;
    color: transparent;
    transition: all 0.2s;
}

.wcg-cat-card-arrow svg {
    width: 100%;
    height: 100%;
}


/* ==========================================================================
   EMPTY STATE
   ========================================================================== */

.wcg-cat-empty {
    text-align: center;
    padding: 4rem 2rem;
}

.wcg-cat-empty-title {
    font-size: 1.25rem;
    color: #1a1a1a;                              /* dark heading */
    margin-bottom: 0.5rem;
}

.wcg-cat-empty-text {
    color: #666;
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
}

.wcg-cat-reset-btn {
    padding: 1.25rem 3rem !important;            /* Kadence override — match Load More */
    background: #f65401 !important;              /* Kadence override */
    color: #fff !important;                      /* Kadence override */
    border: none !important;                     /* Kadence override */
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    box-shadow: none !important;                 /* Kadence override */
}

.wcg-cat-reset-btn:hover {
    background: #ff9021 !important;              /* Kadence palette 2 */
    color: #fff !important;
}


/* ==========================================================================
   LOAD MORE
   ========================================================================== */

.wcg-cat-loadmore-wrap {
    text-align: center;
    margin-top: 2.5rem;
}

.wcg-cat-loadmore {
    padding: 1.25rem 3rem !important;            /* Kadence override — substantial sizing */
    background: #f65401 !important;              /* Kadence override — Kadence palette 1 */
    border: none !important;                     /* Kadence override */
    border-radius: 4px;
    color: #fff !important;                      /* Kadence override */
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    box-shadow: none !important;                 /* Kadence override */
}

@media (hover: hover) {
    .wcg-cat-loadmore:hover {
        background: #ff9021 !important;          /* Kadence palette 2 — lighter orange */
        color: #fff !important;
    }
}


/* ==========================================================================
   TABLET (≤1024px) — 2 columns, tighter spacing
   ========================================================================== */

@media (max-width: 1024px) {
    .wcg-cat-hero {
        padding: 2.5rem 0 2rem;
    }

    .wcg-cat-container {
        padding: 0 1.5rem;
    }

    .wcg-cat-title {
        font-size: 2rem;
    }

    .wcg-cat-header {
        margin-bottom: 1.75rem;
    }

    .wcg-cat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .wcg-cat-grid-wrap {
        padding: 2rem 1.5rem 3rem;
    }
}


/* ==========================================================================
   MOBILE (≤767px) — single column, stacked filters, scrollable pills
   ========================================================================== */

@media (max-width: 767px) {
    .wcg-cat-hero {
        padding: 2rem 0 1.75rem;
    }

    .wcg-cat-container {
        padding: 0 1rem;
    }

    .wcg-cat-title {
        font-size: 1.625rem;
    }

    /* Hide course count on mobile — redundant at this size */
    .wcg-cat-count {
        display: none;
    }

    .wcg-cat-search {
        margin-bottom: 1.5rem;
    }

    .wcg-cat-search input {
        padding: 0.75rem 0.625rem;
        font-size: 0.875rem;
    }

    /* Stack filters vertically */
    .wcg-cat-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 1.25rem;
    }

    .wcg-cat-loc-wrap {
        width: 100%;
    }

    .wcg-cat-loc-trigger {
        width: 100%;
        min-width: unset;
    }

    .wcg-cat-loc-menu {
        width: 100%;
    }

    /* Horizontal scroll for subject pills */
    .wcg-cat-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none;
        /* Fade mask to hint scrollable content on right edge */
        mask-image: linear-gradient(to right, black 85%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    }

    .wcg-cat-pills::-webkit-scrollbar {
        display: none;
    }

    .wcg-cat-pill {
        padding: 0.4375rem 0.625rem !important;
        font-size: 0.75rem;
    }

    /* Single column grid */
    .wcg-cat-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .wcg-cat-card-img-wrap {
        height: 160px;
    }

    .wcg-cat-grid-wrap {
        padding: 1.5rem 1rem 3rem;
    }
}


/* ==========================================================================
   SMALL MOBILE (≤480px) — further tightening
   ========================================================================== */

@media (max-width: 480px) {
    .wcg-cat-hero {
        padding: 1.5rem 0 1.5rem;
    }

    .wcg-cat-title {
        font-size: 1.375rem;
    }

    .wcg-cat-header {
        margin-bottom: 1.25rem;
    }

    .wcg-cat-card-img-wrap {
        height: 140px;
    }

    .wcg-cat-pill {
        padding: 0.375rem 0.5rem !important;
        font-size: 0.6875rem;
    }
}
