/* Course Manager Frontend Styles */

/* ==========================================
   RESPONSIVT FUNDAMENT (v1.0.98) — fikser horisontal scroll på små
   telefoner ved å tvinge alle brede WP-tema-elementer til viewport-bredde.
   ========================================== */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* WP twentyseventeen-tema-elementer som har hardkodet 411px bredde og
   spillover på skjermer < 411px. Overstyres til å respektere viewport-bredde.
   Bruker 100vw (viewport-relativ) i stedet for 100% (parent-relativ) fordi
   forelder-elementet i seg selv har fast bredde. */
.custom-header,
.custom-header-media,
.wp-custom-header,
.site-branding,
.site-content-contain,
.site-header,
.site-content,
.site-footer,
.wrap {
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden;
}

/* Twentyseventeen har min-width via visse tema-regler ved 767px+; overstyres */
@media (max-width: 480px) {
    .wrap {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    .site-branding-text,
    .site-title,
    .site-description {
        max-width: calc(100vw - 24px) !important;
    }
}

.wp-custom-header img,
.wp-custom-header video {
    max-width: 100% !important;
    height: auto !important;
}

/* Sikre at bilder aldri overstiger viewport-bredde */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* Tap-target minimum 44px (Apple/Google-anbefaling for touch) */
.search-button,
.compact-search-input,
#course-search,
.filter-select,
.filter-input,
.sort-btn,
.clear-filters-btn,
.toggle-unavailable-btn,
.toggle-advanced-btn,
.search-help-btn {
    min-height: 44px;
}

/* Titel-håndtering på veldig små skjermer: unngå at ett ord bryter feil */
@media (max-width: 380px) {
    #course-manager-frontend h1,
    #course-manager-frontend h2,
    .entry-title,
    .page-title {
        word-break: normal;
        overflow-wrap: break-word;
        hyphens: auto;
    }
}


/* ==========================================
   HERO VIDEO SECTION (Future Feature)
   ==========================================
   Uncomment this section when ready to add intro video.
   Place video element before #course-manager-frontend

.hero-video-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: #000;
}

.hero-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-video-container.fade-out {
    animation: fadeOutVideo 1s ease-out forwards;
}

@keyframes fadeOutVideo {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
        display: none;
    }
}

.hero-skip-button {
    position: absolute;
    bottom: 30px;
    right: 30px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 10;
}

.hero-skip-button:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}
   ========================================== */

#course-manager-frontend {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Search and Filter Container */
.course-search-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(3, 52, 89, 0.1);
    padding: 24px;
    margin-bottom: 24px;
}

.search-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
}

.course-search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid rgba(3, 52, 89, 0.2);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
}

.course-search-input:focus {
    outline: none;
    border-color: #033459;
    box-shadow: 0 0 0 3px rgba(3, 52, 89, 0.1);
}

.search-button {
    background: linear-gradient(135deg, #033459, rgba(3, 52, 89, 0.8));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(3, 52, 89, 0.3);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    align-items: stretch;
}

.filter-select,
.filter-input {
    padding: 10px 14px;
    border: 2px solid rgba(3, 52, 89, 0.2);
    border-radius: 6px;
    background: white;
    font-size: 14px;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #033459;
    box-shadow: 0 0 0 3px rgba(3, 52, 89, 0.1);
}

.filter-select:disabled,
.filter-input:disabled {
    background: #f0f0f0;
    color: #999;
    cursor: not-allowed;
    border-color: rgba(3, 52, 89, 0.1);
}

.course-results-info {
    /* v1.3.5: kompakt rad — begge grupper til høyre-side, kompakte knapper.
       Ingen 545px "død luft" lenger mellom Nullstill og Sorter. */
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    max-width: 900px;
    margin: 12px auto 0;
    padding: 10px 20px 0;
    border-top: 1px solid rgba(3, 52, 89, 0.2);
    font-size: 13px;
    color: rgba(3, 52, 89, 0.7);
}
.course-results-info .clear-filters-btn {
    padding: 6px 14px;
    font-size: 13px;
    min-height: 32px;
}
.course-results-info .sort-buttons {
    gap: 4px;
}
.course-results-info .sort-btn {
    padding: 6px 12px;
    font-size: 13px;
    min-height: 32px;
}
.course-results-info .sort-label {
    font-size: 13px;
    margin-right: 4px;
}
/* v1.6.3: kort tekst på mobil */
.clear-filters-short { display: none; }
.clear-filters-full { display: inline; }

@media (max-width: 640px) {
    /* Overstyr Twenty Seventeens flex-direction: column */
    #course-manager-frontend .course-results-info {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 6px 12px 0;
        margin-top: 6px;
        font-size: 12px;
    }
    .course-results-info .clear-filters-btn {
        min-height: 28px;
        padding: 4px 10px;
        font-size: 12px;
        width: auto; /* overstyre temaets button width:100% */
        flex-shrink: 0;
    }
    .clear-filters-full { display: none; }
    .clear-filters-short { display: inline; }
    .course-results-info .sort-buttons {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 2px;
        flex-shrink: 0;
    }
    .course-results-info .sort-btn {
        min-height: 28px;
        padding: 4px 8px;
        font-size: 12px;
        width: auto;
    }
    .course-results-info .sort-label {
        font-size: 12px;
    }
}

/* v1.3.3: «Vis-alternativer»-rad i avansert filter — hvor «Fulle og utløpte»-
   bryteren nå bor. Egen visuell tone (subtil bakgrunn) så den ikke forveksles
   med hovedfiltrene over. */
.show-options-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding: 12px 16px;
    background: #f6f7f9;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
}
.show-options-label {
    font-weight: 600;
    color: #495057;
    flex-shrink: 0;
}
.show-options-hint {
    color: #6c757d;
    font-size: 12px;
    line-height: 1.4;
    flex: 1;
    min-width: 200px;
}
@media (max-width: 640px) {
    .show-options-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

.clear-filters-btn {
    background: #fff4e6;
    border: 1.5px solid #ff8c00;
    padding: 10px 18px;
    border-radius: 6px;
    color: #cc6600;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-filters-btn:hover {
    background: #ff8c00;
    color: #fff;
    border-color: #cc6600;
}

/* Ekstra nullstill-innfelling nederst i resultatlisten */
.clear-filters-bottom {
    text-align: center;
    margin: 24px 0 40px;
}
.clear-filters-bottom .clear-filters-btn {
    font-size: 15px;
    padding: 12px 28px;
}

/* ==========================================================
   QUICK WINS (v1.0.99): sticky bar, filter-chips, nylig sett
   ========================================================== */

/* Sticky bar: alltid synlig ved rulling i resultatlisten (Quick win #2) */
.results-sticky-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    border-bottom: 2px solid #e5e7eb;
    padding: 12px 16px;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.results-sticky-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.results-sticky-info h2 {
    font-size: 16px;
    margin: 0;
    line-height: 1.2;
    color: #033459;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.results-sticky-info #results-count {
    font-size: 13px;
    color: #666;
}
.results-sticky-bar .clear-filters-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 13px;
    min-height: 40px;
}
@media (max-width: 480px) {
    .results-sticky-bar {
        padding: 10px 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .results-sticky-bar .clear-filters-btn {
        width: 100%;
    }
}

/* Aktive filter-chips (Quick win #1) */
.active-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 4px 16px;
}
.active-filter-chips:empty { display: none; }
.filter-chip {
    display: inline-flex;
    align-items: center;
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: #1e3a8a;
    padding: 6px 8px 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1.3;
    gap: 6px;
}
.filter-chip-label { font-weight: 600; }
.filter-chip-value { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-chip-remove {
    background: transparent;
    border: none;
    color: #1e3a8a;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 50%;
    min-width: 24px;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.filter-chip-remove:hover {
    background: #dbeafe;
    color: #dc2626;
}

/* ==========================================================
   MÅLGRUPPE-INNGANGER (v1.1.9) — 4 karriereseg-baserte hurtiginnsteg
   ========================================================== */
.persona-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin: 0 0 32px;
}
.persona-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-left: 4px solid #ff8c00;
    border-radius: 8px;
    padding: 16px 16px 16px 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 76px;
    font-family: inherit;
}
.persona-card:hover {
    border-color: #033459;
    border-left-color: #ff8c00;
    background: #fff8ef;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(3,52,89,0.08);
}
.persona-card:focus-visible {
    outline: 3px solid #ff8c00;
    outline-offset: 2px;
}
.persona-icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    object-fit: contain;
    transition: transform 0.2s ease;
}
.persona-card:hover .persona-icon {
    transform: scale(1.05);
}
.persona-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.persona-title {
    font-size: 15px;
    font-weight: 700;
    color: #033459;
    line-height: 1.2;
}
.persona-sub {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.35;
}
@media (max-width: 480px) {
    .persona-cards {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .persona-card {
        padding: 12px 14px;
        min-height: 64px;
    }
    .persona-icon { width: 44px; height: 44px; }
    .persona-title { font-size: 14px; }
    .persona-sub { font-size: 11px; }
}

/* ==========================================================
   FANE-TOGGLE + NORGE-KART (v1.1.0) — Tema | Kart-visning
   ========================================================== */
.explore-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.explore-tabs {
    display: inline-flex;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 4px;
    gap: 2px;
}
.explore-tab {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
}
.explore-tab.active {
    background: #fff;
    color: #033459;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.explore-tab:hover:not(.active) { color: #033459; }

.explore-map-help {
    font-size: 14px;
    color: #555;
    margin: 0 0 16px;
    text-align: center;
}

.norge-map-wrapper {
    display: flex;
    justify-content: center;
    max-width: 100%;
    overflow: hidden;
}
.norge-map-wrapper svg,
.norge-map-wrapper .kompf-map-svg {
    width: 100%;
    max-width: 500px;
    height: auto;
    display: block;
}
/* Heatmap-farger — target path direkte siden SVG-en har <g data-map-id><path/></g>.
   fill må settes på path for pålitelig rendering på tvers av nettlesere. */
.norge-map-wrapper [data-map-id] path {
    fill: #e5e7eb;
    stroke: #fff;
    stroke-width: 1;
    transition: fill 0.2s ease, opacity 0.2s ease;
}
.norge-map-wrapper [data-map-id][data-count="0"] path { fill: #f3f4f6; }
.norge-map-wrapper [data-map-id]:not([data-count="0"]) { cursor: pointer; }
.norge-map-wrapper [data-map-id]:not([data-count="0"]) path:hover { opacity: 0.85; filter: brightness(1.1); }

/* Fargeskalaer via attr-selector — tallverdiene enumereres for 1-14 */
.norge-map-wrapper [data-map-id][data-count="1"] path,
.norge-map-wrapper [data-map-id][data-count="2"] path,
.norge-map-wrapper [data-map-id][data-count="3"] path,
.norge-map-wrapper [data-map-id][data-count="4"] path { fill: #93c5fd; }
.norge-map-wrapper [data-map-id][data-count="5"] path, .norge-map-wrapper [data-map-id][data-count="6"] path,
.norge-map-wrapper [data-map-id][data-count="7"] path, .norge-map-wrapper [data-map-id][data-count="8"] path,
.norge-map-wrapper [data-map-id][data-count="9"] path, .norge-map-wrapper [data-map-id][data-count="10"] path,
.norge-map-wrapper [data-map-id][data-count="11"] path, .norge-map-wrapper [data-map-id][data-count="12"] path,
.norge-map-wrapper [data-map-id][data-count="13"] path, .norge-map-wrapper [data-map-id][data-count="14"] path { fill: #3b82f6; }
/* 15+ håndteres av JS som legger til klasse .heat-high */
.norge-map-wrapper [data-map-id].heat-high path { fill: #1e3a8a; }

.norge-map-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    font-size: 12px;
    color: #6b7280;
    flex-wrap: wrap;
}

/* v1.5.2: Notis om digitale kurs under kartet */
.map-digital-notice {
    margin: 20px auto 0;
    max-width: 720px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 4px solid #3b82f6;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 14px;
    color: #1e3a8a;
    line-height: 1.5;
}
.map-digital-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
    padding-top: 2px;
}
.map-digital-text {
    flex: 1;
}
.map-digital-text strong {
    color: #1e40af;
}
.map-digital-cta {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}
.map-digital-cta:hover, .map-digital-cta:focus-visible {
    background: #2563eb;
    outline: none;
}
@media (max-width: 640px) {
    .map-digital-notice {
        flex-direction: column;
        gap: 8px;
    }
}
.legend-label { font-weight: 600; }
.legend-swatch {
    display: inline-block;
    width: 18px;
    height: 12px;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 2px;
}
.legend-0 { background: #f3f4f6; border: 1px solid #d1d5db; }
.legend-1 { background: #bfdbfe; }
.legend-2 { background: #60a5fa; }
.legend-3 { background: #1d4ed8; }

/* Region-etiketter kan legges over via SVG-innhold; hvis SVG'en har tekst-elementer, sikre lesbarhet */
.norge-map-wrapper text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px;
    fill: #033459;
    pointer-events: none;
}

@media (max-width: 480px) {
    .explore-tab { padding: 10px 14px; font-size: 14px; }
    .explore-tabs { width: 100%; }
    .explore-tab { flex: 1; justify-content: center; }
}

/* ==========================================================
   KURS SOM STARTER SNART-widget (v1.1.6) — kompakt radliste
   med scrollbar viewport og hover-autoscroll (topp/bunn) +
   ekspander-knapp for full-høyde visning.
   ========================================================== */

/* Viewport med fast maks-høyde og scroll når kollapset.
   Ved data-expanded="true" utvides til å vise alt (ingen scroll). */
.upcoming-viewport {
    position: relative;
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #ffcc80 transparent;
    transition: max-height 0.35s ease;
    /* Gradient-fade i topp og bunn indikerer at det er mer å scrolle */
    mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.upcoming-viewport[data-expanded="true"] {
    max-height: 2000px;
    mask-image: none;
    -webkit-mask-image: none;
}
.upcoming-viewport::-webkit-scrollbar { width: 6px; }
.upcoming-viewport::-webkit-scrollbar-track { background: transparent; }
.upcoming-viewport::-webkit-scrollbar-thumb { background: #ffcc80; border-radius: 3px; }

.upcoming-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    background: transparent;
    border: none;
    border-top: 1px solid #f3f4f6;
    color: #cc6600;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
    border-radius: 4px;
}
.upcoming-toggle:hover {
    background: #fff4e6;
    color: #ff8c00;
}
.upcoming-toggle-chevron {
    display: inline-block;
    font-size: 12px;
    transition: transform 0.2s ease;
}
.upcoming-toggle[aria-expanded="true"] .upcoming-toggle-chevron {
    transform: rotate(180deg);
}
.upcoming-toggle-text-expanded { display: none; }
.upcoming-toggle[aria-expanded="true"] .upcoming-toggle-text-collapsed { display: none; }
.upcoming-toggle[aria-expanded="true"] .upcoming-toggle-text-expanded { display: inline; }

.upcoming-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}
.upcoming-row {
    border-bottom: 1px solid #eef1f4;
}
.upcoming-row:last-child { border-bottom: none; }

.upcoming-row-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s ease;
    min-height: 44px;
}
.upcoming-row-link:hover {
    background: #fff8ef;
}
.upcoming-row-link:hover .upcoming-row-arrow {
    color: #ff8c00;
    transform: translateX(2px);
}

.upcoming-row-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 48px;
    padding: 4px 0;
    line-height: 1;
    border-right: 1px solid #eef1f4;
    padding-right: 12px;
    margin-right: 2px;
}
.upcoming-row-day {
    font-size: 20px;
    font-weight: 800;
    color: #033459;
}
.upcoming-row-month {
    font-size: 10px;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: 1px;
    margin-top: 2px;
}

.upcoming-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.upcoming-row-title-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}
.upcoming-row-title {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}
/* På smale skjermer der titler ofte er lange og lignende,
   tillat 2 linjer for å kunne skille dem visuelt */
@media (max-width: 640px) {
    .upcoming-row-title {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    .upcoming-row-title-line {
        align-items: flex-start;
        flex-wrap: wrap;
    }
}
.upcoming-row-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1.3;
    white-space: nowrap;
    flex-shrink: 0;
}
.upcoming-badge-today { background: #ff8c00; color: #fff; }
.upcoming-badge-soon  { background: #fff4e6; color: #cc6600; }
.upcoming-badge-later { background: #f3f4f6; color: #4b5563; }

.upcoming-row-meta {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.upcoming-row-price {
    font-size: 11px;
    font-weight: 600;
    color: #cc6600;
    background: #fff4e6;
    padding: 1px 6px;
    border-radius: 3px;
    flex-shrink: 0;
    margin-left: auto;
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upcoming-row-price.is-free {
    background: #033459;
    color: #fff;
}

.upcoming-row-arrow {
    flex-shrink: 0;
    font-size: 22px;
    color: #d1d5db;
    font-weight: 700;
    line-height: 1;
    transition: all 0.15s ease;
    padding-left: 4px;
}

/* Widget-boks selv */
.upcoming-courses-widget {
    background: #fff;
    border-left: 4px solid #ff8c00;
    border-radius: 4px;
    padding: 16px 18px 6px;
    margin: 0 0 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.upcoming-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-bottom: 4px;
    border-bottom: 2px solid #f3f4f6;
}
.upcoming-title {
    font-size: 20px;
    color: #033459;
    margin: 0;
    font-weight: 700;
    line-height: 1.1;
}
.upcoming-count {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

@media (max-width: 480px) {
    .upcoming-courses-widget {
        padding: 14px 12px 8px;
        border-left-width: 3px;
    }
    .upcoming-title { font-size: 17px; }
    .upcoming-row-link { padding: 8px 4px; gap: 10px; }
    .upcoming-row-date { width: 40px; padding-right: 10px; }
    .upcoming-row-day { font-size: 18px; }
    .upcoming-row-title { font-size: 13px; }
    .upcoming-row-meta { font-size: 11px; }
    /* På smale skjermer: skjul lengre meta-tekst, behold pris */
    .upcoming-row-meta {
        white-space: normal;
        -webkit-line-clamp: 1;
    }
}

/* Legacy kort/scroller-CSS fjernet i v1.1.4 — erstattet med kompakt radliste over. */

/* Nylig sett kurs (Quick win #5) */
.recent-courses-widget {
    background: #fefce8;
    border: 1px solid #fef08a;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 0 0 24px;
}
.recent-courses-title {
    font-size: 15px;
    margin: 0 0 12px;
    color: #713f12;
}
.recent-courses-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.recent-course-card {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 8px 12px;
    border-radius: 6px;
    color: #033459;
    text-decoration: none;
    font-size: 14px;
    max-width: 100%;
    min-height: 40px;
}
.recent-course-card:hover {
    border-color: #033459;
    background: #f8fafc;
}
.recent-course-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
}
.recent-course-arrow { color: #666; font-weight: bold; }

/* "Ingen resultat"-hjelp (Quick win #3) */
.no-results-help {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px 20px;
    margin: 20px 0;
    text-align: center;
}
.no-results-help h3 { color: #033459; margin: 0 0 8px; font-size: 18px; }
.no-results-help p { color: #666; margin: 0 0 16px; }
.no-results-help .suggestions {
    text-align: left;
    max-width: 400px;
    margin: 0 auto 20px;
    padding: 0;
    list-style: none;
}
.no-results-help .suggestions li {
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
    color: #444;
}
.no-results-help .suggestions li:last-child { border-bottom: none; }

/* Toggle: show unavailable courses */
.toggle-unavailable-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: 1px solid rgba(3, 52, 89, 0.2);
    padding: 6px 10px;
    border-radius: 6px;
    color: rgba(3, 52, 89, 0.7);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.toggle-unavailable-btn:hover {
    background: rgba(3, 52, 89, 0.05);
    border-color: rgba(3, 52, 89, 0.4);
}

.toggle-unavailable-btn.active {
    background: rgba(3, 52, 89, 0.08);
    border-color: rgba(3, 52, 89, 0.5);
    color: rgba(3, 52, 89, 0.9);
}

.toggle-unavailable-btn .toggle-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 14px;
    text-align: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
}

/* Sort buttons */
.sort-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sort-label {
    font-size: 13px;
    color: rgba(3, 52, 89, 0.7);
    margin-right: 6px;
}

.sort-btn {
    background: transparent;
    border: 1px solid rgba(3, 52, 89, 0.2);
    padding: 6px 14px;
    border-radius: 6px;
    color: rgba(3, 52, 89, 0.7);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.sort-btn:hover {
    background: rgba(3, 52, 89, 0.05);
    border-color: rgba(3, 52, 89, 0.4);
}

.sort-btn.active {
    background: #033459;
    border-color: #033459;
    color: white;
}

.sort-btn.active:hover {
    background: rgba(3, 52, 89, 0.9);
}

@media (max-width: 600px) {
    .course-results-info {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

/* Geographic search styling - spans 2 columns on desktop */
.filter-group.geo-search-container {
    grid-column: span 2;
}

@media (max-width: 900px) {
    .filter-group.geo-search-container {
        grid-column: span 1;
    }
}

/* Course Grid */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

/* Responsive grid adjustments */
@media (min-width: 768px) {
    .course-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

@media (min-width: 1200px) {
    .course-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Course Card */
.course-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(3, 52, 89, 0.1);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(3, 52, 89, 0.15);
}

.course-header {
    padding: 20px 20px 12px;
    border-bottom: 1px solid rgba(3, 52, 89, 0.1);
}

.course-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.4;
    color: #033459;
}

.course-member {
    font-size: 14px;
    color: #FDB13E;
    font-weight: 600;
}

.course-meta {
    padding: 16px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.course-category,
.course-level,
.course-duration {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.course-category {
    background: rgba(253, 177, 62, 0.2);
    color: rgba(253, 177, 62, 0.8);
}

.course-level {
    background: rgba(3, 52, 89, 0.2);
    color: rgba(3, 52, 89, 0.8);
}
/* v1.5.5: Sekundær nivå-badge — mindre visuell tyngde enn primær */
.course-level.course-level-secondary {
    background: rgba(3, 52, 89, 0.08);
    color: rgba(3, 52, 89, 0.65);
    font-weight: 400;
    font-size: 12px;
}

.course-duration {
    background: rgba(3, 52, 89, 0.1);
    color: rgba(3, 52, 89, 0.7);
}

/* v1.6.0: «Kun for medlemmer»-badge på kort/detalj */
.course-members-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.course-members-badge.course-members-locked {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}
.course-members-badge.course-members-conditional {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* v1.7.6: Konferanse-badge — signaliserer bransjetreff/dager-/forum-format */
.course-conference-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #c4b5fd;
}

/* v1.6.0: Medlemspris-sekundær-tekst i instans-pris */
.instance-price-member {
    color: rgba(3, 52, 89, 0.6);
    font-size: 13px;
    font-weight: 400;
    margin-left: 4px;
}

/* v1.3.6: subtil "Kurstilbyder oppgir"-linje under nivå-badge på kursdetalj */
.course-level-note {
    margin-top: 6px;
    font-size: 12px;
    color: rgba(3, 52, 89, 0.55);
    display: flex;
    align-items: center;
    gap: 6px;
}
.course-level-note em {
    font-style: italic;
}
.course-level-note-help {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    background: rgba(3, 52, 89, 0.1);
    color: rgba(3, 52, 89, 0.6);
    cursor: help;
    font-size: 11px;
}
.course-level-note-help:hover {
    background: rgba(3, 52, 89, 0.2);
}

.course-locations {
    padding: 0 20px 12px;
    font-size: 14px;
    color: rgba(3, 52, 89, 0.7);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Course instances styling */
.course-instances {
    padding: 0 20px 12px;
    font-size: 13px;
}

.course-instances h4 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(3, 52, 89, 0.8);
}

.course-instance {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(3, 52, 89, 0.1);
}

.course-instance:last-child {
    border-bottom: none;
}

.instance-date,
.instance-location,
.instance-price,
.course-instance .instance-deadline {
    font-size: 12px;
    line-height: 1.4;
    color: rgba(3, 52, 89, 0.7);
    white-space: nowrap;
    font-weight: normal;
}

.instance-register {
    background: linear-gradient(135deg, #FDB13E, rgba(253, 177, 62, 0.8));
    color: white;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: auto;
    transition: all 0.2s ease;
}

.instance-register:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(253, 177, 62, 0.3);
    text-decoration: none;
    color: white;
}

/* Card-level deadline & status states */
.course-instance.deadline-passed,
.course-instance.is-full {
    opacity: 0.85;
}

/* Verified courses (from Kompetanseattest API) */
/* Card list (compact): give symmetric horizontal padding so content has air on both sides */
.course-instance.is-verified {
    border-left: 3px solid rgba(3, 52, 89, 0.6);
    padding: 8px 14px;
    margin-left: 0;
    border-radius: 0 4px 4px 0;
}
/* Detail view: already has padding: 16px; just push content 3px more to clear the border */
.course-detail-instance.is-verified {
    border-left: 3px solid rgba(3, 52, 89, 0.6);
    padding-left: 19px;
}

.instance-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(3, 52, 89, 0.08);
    color: rgba(3, 52, 89, 0.9);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    margin-bottom: 4px;
    flex-basis: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.instance-verified-badge a {
    color: rgba(3, 52, 89, 0.85);
    text-decoration: underline;
    text-transform: none;
    letter-spacing: normal;
}

.course-detail-instance .instance-verified-badge {
    font-size: 12px;
    padding: 4px 10px;
    margin-bottom: 8px;
    flex-basis: auto;
    align-self: flex-start;
}

.course-instance .instance-status-banner {
    width: 100%;
    padding: 4px 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    flex-basis: 100%;
}

.course-instance .instance-status-full {
    background: rgba(3, 52, 89, 0.08);
    color: rgba(3, 52, 89, 0.85);
    border-left: 3px solid rgba(3, 52, 89, 0.5);
}

.course-instance .instance-status-deadline-passed {
    background: rgba(3, 52, 89, 0.05);
    color: rgba(3, 52, 89, 0.75);
    border-left: 3px solid rgba(3, 52, 89, 0.3);
    font-weight: 500;
}

.course-instance .instance-deadline-approaching {
    background: rgba(253, 177, 62, 0.12);
    color: rgba(3, 52, 89, 0.9);
    padding: 2px 8px;
    border-radius: 4px;
    border-left: 3px solid rgba(253, 177, 62, 0.7);
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    font-weight: 500;
}

.instance-register-secondary {
    background: rgba(3, 52, 89, 0.7) !important;
    background-image: none !important;
}

.instance-register-secondary:hover {
    background: rgba(3, 52, 89, 0.85) !important;
    box-shadow: 0 2px 6px rgba(3, 52, 89, 0.2) !important;
}

.instance-register-disabled {
    background: rgba(3, 52, 89, 0.4) !important;
    background-image: none !important;
    cursor: default;
    pointer-events: none;
}

.instance-more {
    font-size: 12px;
    color: rgba(3, 52, 89, 0.6);
    font-style: italic;
    padding: 4px 0;
}

.course-no-instances {
    padding: 0 20px 12px;
    font-size: 13px;
    color: rgba(3, 52, 89, 0.5);
    font-style: italic;
}

.course-description,
.course-objectives,
.course-prerequisites {
    padding: 0 20px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(3, 52, 89, 0.8);
    flex-grow: 1;
}

.course-description {
    color: rgba(3, 52, 89, 0.9);
}

.course-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(3, 52, 89, 0.1);
    background: rgba(3, 52, 89, 0.02);
    margin-top: auto;
}

.course-read-more {
    display: inline-block;
    background: linear-gradient(135deg, #FDB13E, rgba(253, 177, 62, 0.8));
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.course-read-more:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(253, 177, 62, 0.3);
    text-decoration: none;
    color: white;
}

/* Course detail page */
.course-detail {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(3, 52, 89, 0.1);
}

.course-detail-header {
    border-bottom: 2px solid rgba(3, 52, 89, 0.1);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.course-detail-title {
    font-size: 28px;
    font-weight: 700;
    color: #033459;
    margin: 0 0 10px;
}

.course-detail-member {
    font-size: 16px;
    color: #FDB13E;
    font-weight: 600;
    margin-bottom: 15px;
}

.course-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.course-detail-section {
    margin-bottom: 25px;
}

.course-detail-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #033459;
    margin: 0 0 10px;
    border-left: 4px solid #FDB13E;
    padding-left: 12px;
}

.course-detail-section p {
    line-height: 1.6;
    color: rgba(3, 52, 89, 0.8);
    margin: 0;
}

.course-external-link {
    display: inline-block;
    background: linear-gradient(135deg, #033459, rgba(3, 52, 89, 0.8));
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.2s ease;
    margin-top: 20px;
}

.course-external-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(3, 52, 89, 0.3);
    text-decoration: none;
    color: white;
}

.back-to-courses {
    display: inline-block;
    color: #033459;
    text-decoration: none;
    margin-bottom: 20px;
    font-weight: 600;
}

.back-to-courses:hover {
    color: #FDB13E;
    text-decoration: none;
}

/* Course detail instances */
.course-detail-instances {
    display: grid;
    gap: 16px;
}

.course-detail-instance {
    background: rgba(3, 52, 89, 0.03);
    border: 1px solid rgba(3, 52, 89, 0.1);
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
}

.course-detail-instance:hover {
    background: rgba(3, 52, 89, 0.05);
    border-color: rgba(3, 52, 89, 0.2);
}

.instance-info {
    margin-bottom: 8px;
    line-height: 1.6;
    color: rgba(3, 52, 89, 0.9);
}

.instance-info:last-child {
    margin-bottom: 0;
}

/* v1.7.7: Klokkeslett-span inne i instance-date / instance-info — litt mindre,
   avdempet farge, slik at datoen fortsatt er mest fremtredende. */
.instance-time {
    font-weight: 500;
    color: rgba(3, 52, 89, 0.7);
    margin-left: 4px;
    font-variant-numeric: tabular-nums;
}

.instance-register-link {
    display: inline-block;
    background: linear-gradient(135deg, #FDB13E, rgba(253, 177, 62, 0.8));
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    margin-top: 4px;
    transition: all 0.2s ease;
}

.instance-register-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(253, 177, 62, 0.3);
    text-decoration: none;
    color: white;
}

/* Registration deadline & status states */
.course-detail-instance.deadline-passed,
.course-detail-instance.is-full {
    background: rgba(3, 52, 89, 0.02);
    border-color: rgba(3, 52, 89, 0.15);
    opacity: 0.85;
}

.instance-status-banner {
    display: block;
    padding: 8px 12px;
    margin-bottom: 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.instance-status-full {
    background: rgba(3, 52, 89, 0.08);
    color: rgba(3, 52, 89, 0.85);
    border-left: 3px solid rgba(3, 52, 89, 0.5);
}

.instance-status-deadline-passed {
    background: rgba(3, 52, 89, 0.05);
    color: rgba(3, 52, 89, 0.75);
    border-left: 3px solid rgba(3, 52, 89, 0.3);
    font-weight: 500;
}

.instance-deadline {
    color: rgba(3, 52, 89, 0.75);
    font-size: 14px;
}

.instance-deadline-approaching {
    background: rgba(253, 177, 62, 0.12);
    border-left: 3px solid rgba(253, 177, 62, 0.7);
    padding: 8px 12px;
    border-radius: 4px;
    color: rgba(3, 52, 89, 0.9);
    font-size: 14px;
}

.instance-register-link-secondary {
    background: rgba(3, 52, 89, 0.7);
    background-image: none;
}

.instance-register-link-secondary:hover {
    background: rgba(3, 52, 89, 0.85);
    box-shadow: 0 4px 12px rgba(3, 52, 89, 0.2);
}

.instance-register-link-disabled {
    background: rgba(3, 52, 89, 0.4);
    background-image: none;
    cursor: default;
}

.instance-register-link-disabled:hover {
    transform: none;
    box-shadow: none;
    background: rgba(3, 52, 89, 0.4);
}

/* Loading indicator */
.loading-indicator {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: rgba(3, 52, 89, 0.7);
}

/* No courses found */
.no-courses-found {
    text-align: center;
    padding: 60px 20px;
    color: rgba(3, 52, 89, 0.7);
    grid-column: 1 / -1;
}

.no-courses-found h3 {
    margin: 0 0 12px;
    color: #033459;
    font-size: 20px;
}

.no-courses-found p {
    margin: 0 0 20px;
    font-size: 16px;
}

.back-to-search-btn {
    background: linear-gradient(135deg, #033459, #055a8c);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(3, 52, 89, 0.2);
}

.back-to-search-btn:hover {
    background: linear-gradient(135deg, #055a8c, #033459);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(3, 52, 89, 0.3);
}

/* Responsive design */
@media (max-width: 768px) {
    #course-manager-frontend {
        padding: 10px;
    }
    
    .course-search-container {
        padding: 16px;
        margin-left: -5px;
        margin-right: -5px;
    }
    
    .search-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .course-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .course-results-info {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
        text-align: center;
    }
    
    .course-search-input,
    .filter-select,
    .filter-input {
        width: 100%;
        box-sizing: border-box;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .search-button,
    .clear-filters-btn {
        width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    #course-manager-frontend {
        padding: 8px;
    }
    
    .course-search-container {
        padding: 12px;
        margin-left: -3px;
        margin-right: -3px;
        border-radius: 8px;
    }
    
    .course-card {
        border-radius: 8px;
        margin-left: 0;
        margin-right: 0;
    }
    
    .course-header {
        padding: 12px 12px 8px;
    }
    
    .course-meta {
        padding: 8px 12px;
        gap: 6px;
    }
    
    .course-locations,
    .course-description,
    .course-objectives,
    .course-prerequisites {
        padding: 0 12px 8px;
    }
    
    .course-footer {
        padding: 8px 12px;
    }
    
    .course-title {
        font-size: 15px;
        line-height: 1.3;
    }
    
    .course-member {
        font-size: 12px;
    }
    
    .course-category,
    .course-level,
    .course-duration {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .course-detail {
        margin: 5px;
        padding: 12px;
        border-radius: 8px;
    }
    
    .course-detail-title {
        font-size: 20px;
        line-height: 1.3;
    }
    
    .filter-row {
        gap: 6px;
    }
    
    .search-row {
        gap: 6px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    #course-manager-frontend {
        padding: 5px;
    }
    
    .course-search-container {
        padding: 10px;
        margin-left: -2px;
        margin-right: -2px;
    }
    
    .course-title {
        font-size: 14px;
    }
    
    .course-category,
    .course-level,
    .course-duration {
        font-size: 9px;
        padding: 2px 6px;
    }
}

/* Animation for loading new content */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.course-card {
    animation: fadeIn 0.3s ease-out;
}

/* Course Comparison Styles */
.add-to-comparison {
    background: transparent;
    border: 1px solid rgba(3, 52, 89, 0.3);
    color: rgba(3, 52, 89, 0.8);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
    display: inline-block;
}

.add-to-comparison:hover {
    background: rgba(3, 52, 89, 0.1);
    border-color: rgba(3, 52, 89, 0.5);
}

.add-to-comparison.in-comparison {
    background: #FDB13E;
    color: white;
    border-color: #FDB13E;
}

.add-to-comparison.in-comparison:hover {
    background: rgba(253, 177, 62, 0.8);
}

/* Comparison Bar */
.comparison-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #033459;
    color: white;
    padding: 12px 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
}

.comparison-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comparison-count {
    font-weight: 600;
}

.comparison-actions {
    display: flex;
    gap: 12px;
}

.comparison-btn,
.comparison-btn-secondary {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comparison-btn {
    background: #FDB13E;
    color: white;
}

.comparison-btn:hover:not(:disabled) {
    background: rgba(253, 177, 62, 0.8);
}

.comparison-btn:disabled {
    background: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}

.comparison-btn-secondary {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.comparison-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Comparison Modal */
.comparison-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.comparison-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 95vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(3, 52, 89, 0.1);
    background: rgba(3, 52, 89, 0.02);
}

.comparison-header h2 {
    margin: 0;
    color: #033459;
    font-size: 24px;
}

.comparison-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: rgba(3, 52, 89, 0.6);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.comparison-modal-close:hover {
    color: #033459;
}

.comparison-table-container {
    overflow: auto;
    max-height: calc(90vh - 80px);
    padding: 0;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.comparison-table th,
.comparison-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(3, 52, 89, 0.1);
    vertical-align: top;
}

.comparison-table th {
    background: rgba(3, 52, 89, 0.05);
    font-weight: 600;
    color: #033459;
    position: sticky;
    top: 0;
    z-index: 10;
}

.comparison-field {
    background: rgba(3, 52, 89, 0.08) !important;
    font-weight: 600;
    min-width: 120px;
    position: sticky;
    left: 0;
    z-index: 11;
}

.comparison-field-label {
    background: rgba(3, 52, 89, 0.05);
    font-weight: 600;
    color: rgba(3, 52, 89, 0.8);
    position: sticky;
    left: 0;
    z-index: 5;
    min-width: 120px;
}

.comparison-field-value {
    min-width: 200px;
    max-width: 300px;
    word-wrap: break-word;
}

.comparison-course {
    min-width: 200px;
    max-width: 300px;
    font-weight: 600;
    color: #033459;
}

.comparison-link {
    background: #FDB13E;
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    transition: all 0.2s ease;
}

.comparison-link:hover {
    background: rgba(253, 177, 62, 0.8);
    text-decoration: none;
    color: white;
}

.comparison-instances {
    font-size: 12px;
}

.comparison-instance {
    margin-bottom: 6px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(3, 52, 89, 0.1);
}

.comparison-instance:last-child {
    border-bottom: none;
}

.instance-date,
.instance-location,
.instance-price {
    display: block;
    color: rgba(3, 52, 89, 0.7);
    margin-bottom: 2px;
}

.instance-date {
    font-weight: 600;
    color: #033459;
}

.instance-more {
    font-style: italic;
    color: rgba(3, 52, 89, 0.6);
    margin-top: 4px;
}

.comparison-loading {
    padding: 40px;
    text-align: center;
    color: rgba(3, 52, 89, 0.7);
    font-size: 16px;
}

/* Responsive comparison */
@media (max-width: 768px) {
    .comparison-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .comparison-modal-content {
        max-width: 98vw;
        max-height: 95vh;
        margin: 10px;
    }
    
    .comparison-table {
        font-size: 12px;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 8px 12px;
    }
    
    .comparison-field,
    .comparison-field-label {
        min-width: 100px;
    }
    
    .comparison-field-value,
    .comparison-course {
        min-width: 150px;
        max-width: 200px;
    }
}

/* ==========================================
   COMPACT SEARCH BAR
   ========================================== */
.compact-search-container {
    background: #f8f9fa;
    padding: 20px;
    margin-bottom: 0;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s, padding 0.15s;
}
/* v1.3.4: Kompakt-modus når baren er festet — kutter padding og luft så
   baren tar mindre plass av viewport når man scroller. */
.compact-search-container.is-stuck {
    padding: 10px 20px;
}
.compact-search-container.is-stuck .compact-search-bar {
    gap: 8px;
}
.compact-search-container.is-stuck .compact-search-input {
    padding: 8px 12px;
    font-size: 14px;
}
.compact-search-container.is-stuck .search-button,
.compact-search-container.is-stuck .toggle-advanced-btn,
.compact-search-container.is-stuck .search-help-btn {
    padding: 8px 14px;
    font-size: 13px;
}
.compact-search-container.is-stuck .advanced-search-container {
    padding: 10px 14px;
    margin: 0;
}
.compact-search-container.is-stuck .filter-row {
    gap: 8px;
    margin-bottom: 8px;
}
.compact-search-container.is-stuck .filter-row:last-child {
    margin-bottom: 0;
}
.compact-search-container.is-stuck .filter-select,
.compact-search-container.is-stuck .filter-input {
    padding: 6px 10px;
    font-size: 13px;
    border-width: 1px;
    min-height: 32px;
}
.compact-search-container.is-stuck .compact-search-input,
.compact-search-container.is-stuck .search-button,
.compact-search-container.is-stuck .toggle-advanced-btn,
.compact-search-container.is-stuck .search-help-btn {
    min-height: 34px;
}
.compact-search-container.is-stuck .toggle-unavailable-btn {
    min-height: 28px;
}
/* Advanced-containeren har en inner .course-search-container med 24px padding
   som er unødvendig når vi er stuck — den er allerede innkapslet av det
   ytterste .advanced-search-container. */
.compact-search-container.is-stuck .course-search-container {
    padding: 0;
    margin: 0;
    background: transparent;
    box-shadow: none;
}
/* Tettere grid — mindre minmax → flere kolonner per rad → færre rader totalt */
.compact-search-container.is-stuck .filter-row {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
/* v1.6.4: på mobil (≤ 640px) — 1 kolonne selv i sticky-modus så tekst ikke kuttes */
@media (max-width: 640px) {
    .compact-search-container.is-stuck .filter-row {
        grid-template-columns: 1fr !important;
    }
    /* Geo-container: én kolonne på mobil, geo-input-wrap intakt */
    #course-manager-frontend .filter-group.geo-search-container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
    }
    #course-manager-frontend .filter-group.geo-search-container .geo-input-wrap {
        display: flex !important;
        position: relative !important;
        flex: 1 1 auto;
        min-width: 0;
    }
    #course-manager-frontend .filter-group.geo-search-container .filter-select {
        min-width: 90px;
        flex: 0 0 auto;
    }
}
.compact-search-container.is-stuck .show-options-row {
    padding: 6px 12px;
    margin-top: 8px;
    font-size: 12px;
}
.compact-search-container.is-stuck .show-options-hint {
    font-size: 11px;
}
.compact-search-container.is-stuck .toggle-unavailable-btn {
    padding: 4px 10px;
    font-size: 12px;
}
/* v1.3.1: Sticky søkefelt. Temaet (Twenty Seventeen) har overflow:hidden på
   flere forfedre, så position:sticky fungerer ikke — vi bruker JS-drevet
   position:fixed via .is-stuck-klassen i stedet. */
.compact-search-container.is-stuck {
    position: fixed;
    /* top settes dynamisk fra JS (getTopOffset) — inline style vinner over dette */
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    margin: 0 auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 0;
    /* v1.5.3: Max 70% av viewport, ellers scroll inne i baren — hindrer at
       en åpen «avansert filter» dekker hele skjermen på mobil */
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
/* Plass-holder som beholder plassen når baren er festet, så innhold under
   ikke hopper opp */
.compact-search-placeholder {
    display: none;
}
.compact-search-container.is-stuck + .compact-search-placeholder {
    display: block;
}
/* WordPress admin-bar (logged-in users) forskyver toppen 32px, 46px på smal skjerm */
body.admin-bar .compact-search-container.is-stuck { top: 32px; }
@media (max-width: 782px) {
    body.admin-bar .compact-search-container.is-stuck { top: 46px; }
}

/* Live-teller: kompakt badge til høyre i søkebaren, synlig kun ved aktivt filter */
.live-results-counter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #ff8c00;
    color: #fff !important;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(255, 140, 0, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
}
.live-results-counter:hover,
.live-results-counter:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 140, 0, 0.4);
    color: #fff !important;
}
.live-results-counter[data-empty="1"] {
    background: #6c757d;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}
.live-counter-arrow {
    font-size: 13px;
    animation: cm-bounce 1.4s ease-in-out infinite;
}
@keyframes cm-bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(3px); }
}
/* Puls-effekt når tallet oppdateres */
.live-results-counter.is-flash {
    animation: cm-flash 0.35s;
}
@keyframes cm-flash {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@media (max-width: 640px) {
    .live-results-counter {
        padding: 6px 10px;
        font-size: 12px;
    }
    .live-counter-label {
        display: none; /* Bare tall + pil på mobil */
    }
    .live-counter-label::before {
        content: '';
    }
}

/* v1.6.2: Kompakt mobil-layout for sticky søkebar.
   Pakker søk + knapper + teller tett så ikke alt bryter til egne linjer. */
@media (max-width: 640px) {
    .compact-search-container {
        padding: 8px 12px;
    }
    #course-manager-frontend .compact-search-bar {
        display: flex !important;
        flex-direction: row !important; /* overstyr Twenty Seventeens column-default */
        gap: 6px;
        flex-wrap: wrap; /* 2-radet layout: input full bredde, knapper på rad 2 */
        align-items: center;
        justify-content: flex-start;
    }
    .compact-search-bar .search-input-wrapper {
        flex: 1 1 100%; /* input tar hele første rad */
        min-width: 0;
    }
    .compact-search-input {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 14px;
    }
    .compact-search-bar .search-button {
        min-height: 36px;
        padding: 6px 14px;
        font-size: 13px;
        flex-shrink: 0;
        width: auto; /* overstyre Twenty Seventeen sitt width:100% på knapper */
    }
    /* «Flere søkekriterier»-knapp: bare ikon på mobil */
    .compact-search-bar .toggle-advanced-btn {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 13px;
        flex-shrink: 0;
        width: auto;
    }
    .compact-search-bar .toggle-advanced-btn .toggle-text {
        display: none;
    }
    /* Hjelp-knapp: skjules på mobil (allerede tilgjengelig via «?» inne i input) */
    .compact-search-bar .search-help-btn {
        display: none;
    }
    /* Live-teller: enda kompaktere */
    .compact-search-bar .live-results-counter {
        padding: 6px 10px;
        font-size: 13px;
        flex-shrink: 0;
    }
}

/* Enda mindre skjermer (≤ 400 px): teller kun tall */
@media (max-width: 400px) {
    .compact-search-bar {
        gap: 4px;
    }
    .compact-search-bar .toggle-advanced-btn .toggle-icon {
        margin: 0;
    }
    .live-counter-arrow {
        display: none;
    }
}

.compact-search-bar {
    display: flex;
    gap: 10px;
    max-width: 900px;
    margin: 0 auto;
    align-items: center;
}

.compact-search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.compact-search-input:focus {
    outline: none;
    border-color: #0066cc;
}

.toggle-advanced-btn {
    padding: 12px 20px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #495057;
    transition: all 0.3s;
}

.toggle-advanced-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s;
}

/* ==========================================
   THEME BOXES
   ========================================== */
.theme-boxes-container {
    display: block;
    margin: 30px 0 40px 0;
}

/* When advanced search is hidden, add bottom styling to search container */
#course-manager-frontend:not(.advanced-search-open) .compact-search-container {
    border-radius: 8px;
    margin-bottom: 30px;
}

/* When advanced search is open, remove bottom shadow from search container */
#course-manager-frontend.advanced-search-open .compact-search-container {
    box-shadow: none;
}

.theme-boxes-title {
    text-align: center;
    font-size: 28px;
    color: #212529;
    margin-bottom: 30px;
    font-weight: 600;
}

.theme-boxes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.theme-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.theme-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.1);
    opacity: 0;
    transition: opacity 0.3s;
}

.theme-box:hover::before {
    opacity: 1;
}

.theme-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.theme-box.active {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    outline: 3px solid #ffc107;
}

/* Different gradient colors for each theme - Blue and Orange palette */
.theme-box:nth-child(1) { background: linear-gradient(135deg, #0066CC 0%, #004B99 100%); } /* Deep blue */
.theme-box:nth-child(2) { background: linear-gradient(135deg, #FF8C00 0%, #FFA500 100%); } /* Orange */
.theme-box:nth-child(3) { background: linear-gradient(135deg, #1E90FF 0%, #0066CC 100%); } /* Bright blue */
.theme-box:nth-child(4) { background: linear-gradient(135deg, #FDB813 0%, #FF8C00 100%); } /* Golden yellow to orange */
.theme-box:nth-child(5) { background: linear-gradient(135deg, #0066CC 0%, #FDB813 100%); } /* Blue to golden yellow */
.theme-box:nth-child(6) { background: linear-gradient(135deg, #4169E1 0%, #1E90FF 100%); } /* Royal blue */
.theme-box:nth-child(7) { background: linear-gradient(135deg, #FFA500 0%, #FFB84D 100%); } /* Light orange */
.theme-box:nth-child(8) { background: linear-gradient(135deg, #87CEEB 0%, #4682B4 100%); } /* Sky blue */
.theme-box:nth-child(9) { background: linear-gradient(135deg, #FFB84D 0%, #FFCC80 100%); } /* Soft orange */
.theme-box:nth-child(10) { background: linear-gradient(135deg, #5B9BD5 0%, #4169E1 100%); } /* Medium blue */

.theme-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.9;
}

.theme-icon i {
    display: inline-block;
}

.theme-name {
    font-size: 20px;
    font-weight: 600;
    margin: 15px 0 10px;
    color: white;
}

.theme-description {
    font-size: 14px;
    line-height: 1.5;
    margin: 10px 0;
    opacity: 0.95;
    color: white;
}

.theme-count {
    font-size: 16px;
    font-weight: 600;
    margin-top: 15px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    display: inline-block;
    color: white;
}

/* ==========================================
   ADVANCED SEARCH (EXPANDABLE)
   ========================================== */
.advanced-search-container {
    margin: 0 0 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ==========================================
   RESULTS SECTION
   ========================================== */
.course-results-section {
    margin-top: 40px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.results-header h2 {
    margin: 0;
    font-size: 24px;
    color: #212529;
}

#results-count {
    font-size: 16px;
    color: #6c757d;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 768px) {
    .compact-search-bar {
        flex-direction: column;
    }
    
    .theme-boxes-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .theme-box {
        padding: 25px 15px;
    }
    
    .theme-icon {
        font-size: 36px;
    }
    
    .theme-name {
        font-size: 18px;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .compact-search-container {
        padding: 15px;
    }

    .theme-boxes-title {
        font-size: 22px;
    }

    .toggle-advanced-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================
   FILTER HELP TOOLTIPS
   ========================================== */

/* Search input wrapper with help icon */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
}

.search-input-wrapper .compact-search-input {
    flex: 1;
    padding-right: 35px;
}

.search-input-wrapper .filter-help-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* Filter group - container for select + help icon */
.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.filter-group .filter-select {
    flex: 1;
    min-width: 0; /* Allow shrinking */
}

.filter-group > .filter-help-icon {
    flex-shrink: 0;
}

/* Geo search container - special layout for two inputs + help icon */
.filter-group.geo-search-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group.geo-search-container .geo-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
}
.filter-group.geo-search-container .filter-input {
    flex: 1;
    min-width: 0;
    padding-right: 40px; /* plass til 📍-knapp inne i input */
}
.filter-group.geo-search-container .filter-select {
    flex: 0 0 auto;
    width: auto;
    min-width: 110px;
}

/* v1.3.9: Bruk-min-posisjon-knapp inne i input-feltet */
.geo-locate-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 1px solid rgba(3, 52, 89, 0.15);
    border-radius: 4px;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.geo-locate-btn:hover:not(:disabled) {
    background: rgba(3, 52, 89, 0.08);
    border-color: rgba(3, 52, 89, 0.35);
}
.geo-locate-btn:disabled {
    cursor: wait;
    opacity: 0.6;
}
.geo-locate-btn:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: 1px;
}

/* Help icon base styling */
.filter-help-icon {
    position: relative; /* Required for tooltip positioning */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    min-width: 16px;
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    transition: all 0.2s ease;
    border: none;
    flex-shrink: 0;
}

.filter-help-icon:hover,
.filter-help-icon:focus {
    background: #0066cc;
    color: white;
    outline: none;
}

/* Tooltip styling */
.filter-help-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    white-space: normal;
    width: 220px;
    max-width: 90vw;
    text-align: left;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

/* Tooltip arrow */
.filter-help-icon::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.filter-help-icon:hover::after,
.filter-help-icon:hover::before,
.filter-help-icon:focus::after,
.filter-help-icon:focus::before,
.filter-help-icon.tooltip-active::after,
.filter-help-icon.tooltip-active::before {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   SEARCH HELP BUTTON
   ========================================== */

.search-help-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: 8px;
    color: #495057;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.search-help-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.search-help-btn .help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #0066cc;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
}

/* ==========================================
   SEARCH HELP MODAL
   ========================================== */

.search-help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.search-help-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-help-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.search-help-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #212529;
}

.search-help-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.search-help-close:hover {
    background: #e9ecef;
    color: #212529;
}

.search-help-modal-body {
    padding: 24px;
    overflow-y: auto;
}

.help-section {
    margin-bottom: 24px;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h3 {
    font-size: 16px;
    color: #0066cc;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-section h3::before {
    content: '?';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: #e7f1ff;
    color: #0066cc;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
}

.help-section p {
    margin: 0;
    color: #495057;
    line-height: 1.6;
}

.help-section ul,
.help-section ol {
    margin: 8px 0 0 0;
    padding-left: 20px;
    color: #495057;
}

.help-section li {
    margin-bottom: 6px;
    line-height: 1.5;
}

.help-section li:last-child {
    margin-bottom: 0;
}

.help-section.help-tip {
    background: #e7f1ff;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #0066cc;
}

.help-section.help-tip h3 {
    color: #0055aa;
}

.help-section.help-tip h3::before {
    content: '💡';
    background: none;
}

/* ==========================================
   TOOLTIP RESPONSIVE ADJUSTMENTS
   ========================================== */

@media (max-width: 768px) {
    .search-help-btn .help-text {
        display: none;
    }

    .search-help-btn {
        padding: 10px 12px;
    }

    .filter-help-icon::after {
        width: 200px;
        font-size: 12px;
        padding: 8px 12px;
    }

    .filter-group.geo-search-container {
        flex-wrap: wrap;
    }

    .filter-group.geo-search-container .filter-input,
    .filter-group.geo-search-container .filter-select {
        flex: 1 1 45%;
        min-width: 100px;
    }

    .search-help-modal {
        padding: 10px;
    }

    .search-help-modal-content {
        max-height: 90vh;
    }

    .search-help-modal-header {
        padding: 16px 20px;
    }

    .search-help-modal-body {
        padding: 20px;
    }

    .help-section h3 {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .filter-help-icon::after {
        left: auto;
        right: 0;
        transform: none;
    }

    .filter-help-icon::before {
        left: auto;
        right: 6px;
        transform: none;
    }

    .filter-group.geo-search-container .filter-input,
    .filter-group.geo-search-container .filter-select {
        flex: 1 1 100%;
    }

    .search-help-modal-header h2 {
        font-size: 18px;
    }
}
