/* ============================================================
   Jackrabbit Class Map v2 — Styles
   ============================================================ */

:root {
    --jr-green:      #254A45;
    --jr-green-lt:   #E8F0EF;
    --jr-green-mid:  #C5D8D6;
    --jr-gold:       #F3C813;
    --jr-gold-dk:    #e0b500;
    --jr-navy:       #1A1A2E;
    --jr-dark:       #1E1E2E;
    --jr-purple:     #5E59C0;
    --jr-gray:       #555;
    --jr-lgray:      #F5F7FA;
    --jr-border:     #E0E0E0;
    --jr-white:      #fff;
    --jr-radius:     10px;
    --jr-shadow:     none;
}

/* ── Wrapper ───────────────────────────────────────────────── */
/* Width is controlled by Elementor/theme container.           */
/* Set your Elementor section to Full Width for edge-to-edge.  */

#jr-map-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    position: relative;
    width: 100%;
    border-radius: var(--jr-radius);
    overflow: hidden;
    box-shadow: var(--jr-shadow);
}

/* ── Placeholder ───────────────────────────────────────────── */

#jr-map-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #eef3fa 0%, #dde8f5 100%);
    border-radius: var(--jr-radius);
    width: 100%;
}

#jr-map-placeholder-inner {
    text-align: center;
    padding: 40px 20px;
    max-width: 380px;
}

#jr-map-placeholder-inner svg {
    display: block;
    margin: 0 auto 16px;
    animation: jr-pulse 2.4s ease-in-out infinite;
}

@keyframes jr-pulse {
    0%, 100% { transform: translateY(0); opacity: .85; }
    50%       { transform: translateY(-5px); opacity: 1; }
}

#jr-map-placeholder-text {
    font-size: 20px;
    font-weight: 700;
    color: #1a2f4a;
    margin: 0 0 20px;
}

#jr-map-location-btn {
    display: block;
    width: 100%;
    padding: 12px 28px;
    background: var(--jr-green);
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 10px;
    transition: background .15s, transform .1s;
}
#jr-map-location-btn:hover  { background: #1a3430; transform: translateY(-1px); }
#jr-map-location-btn:active { transform: translateY(0); }

.jr-placeholder-or {
    font-size: 13px;
    color: #888;
    margin: 8px 0;
}

#jr-map-load-btn {
    display: inline-block;
    padding: 10px 24px;
    background: transparent;
    color: var(--jr-green);
    border: 2px solid var(--jr-green);
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 14px;
    transition: all .15s;
}
#jr-map-load-btn:hover { background: var(--jr-green); color: #fff; }

#jr-map-placeholder-sub {
    font-size: 13px;
    color: #6a7f9a;
    margin: 0;
}

/* ── Loading ───────────────────────────────────────────────── */

#jr-map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(3px);
    font-size: 15px;
    color: #333;
    z-index: 10;
    pointer-events: none;
}

.jr-spinner {
    display: inline-block;
    width: 22px; height: 22px;
    border: 3px solid var(--jr-green-mid);
    border-top: 3px solid var(--jr-green);
    border-radius: 50%;
    animation: jr-spin .7s linear infinite;
}
@keyframes jr-spin { to { transform: rotate(360deg); } }

/* ── Search view layout ────────────────────────────────────── */

#jr-map-layout {
    display: flex;
    align-items: flex-start;
    gap: 0;
}

#jr-map-left {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: sticky;
    top: 0;
}

#jr-map-sidebar {
    flex: 1 1 60%;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-left: 1px solid var(--jr-border);
    overflow: visible;
    min-height: 0;
}

/* ── Map controls bar ──────────────────────────────────────── */

#jr-map-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #ffffff;
    border-bottom: 2px solid var(--jr-green);
    flex-wrap: wrap;
}

#jr-map-search {
    flex: 1 1 220px;
    padding: 12px 18px 12px 44px;
    border: 1.5px solid #e0e0e0;
    border-radius: 50px;
    font-size: 15px;
    outline: none;
    background: #f8f9fa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 14px center;
    transition: all .2s;
    color: #1a1a1a;
}
#jr-map-search::placeholder { color: #999; }
#jr-map-search:focus {
    border-color: var(--jr-green);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(37,74,69,.1);
}

#jr-map-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--jr-green);
    white-space: nowrap;
    background: var(--jr-green-lt);
    padding: 5px 12px;
    border-radius: 50px;
}

/* ── Context bar (above map + sidebar) ─────────────────────── */

#jr-context-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 24px;
    background: #fff;
    border: 1px solid var(--jr-border);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    flex-wrap: wrap;
}

/* On subsites (no CTA), center the franchise name + count */
#jr-context-bar.jr-context-bar-centered {
    justify-content: center;
    text-align: center;
}
#jr-context-bar.jr-context-bar-centered .jr-context-info {
    flex: 0 1 auto;
    text-align: center;
}

.jr-context-info {
    flex: 1;
    min-width: 0;
}

#jr-context-title {
    margin: 0 0 4px 0;
    font-size: 22px;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -.01em;
    line-height: 1.2;
}

#jr-context-count {
    margin: 0;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

#jr-context-cta {
    flex-shrink: 0;
}

/* Visit Local Page button — brand yellow with dark text for proper contrast */
.jr-context-btn {
    display: inline-block;
    padding: 13px 28px;
    background: #F3C813;
    color: #1a1a1a !important;
    text-decoration: none !important;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    line-height: 1.2;
    border: none;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.jr-context-btn:hover {
    background: #e0b500;
    color: #1a1a1a !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

@media (max-width: 640px) {
    #jr-context-bar {
        padding: 16px;
        gap: 14px;
    }
    #jr-context-title { font-size: 18px; }
    .jr-context-btn { width: 100%; padding: 12px 20px; }
    #jr-context-cta { width: 100%; }
}

#jr-sidebar-controls {
    padding: 14px 20px 8px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.jr-filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.jr-filter-pill {
    padding: 9px 20px;
    background: #f3f4f6;
    border: 1.5px solid #e5e7eb;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    line-height: 1.2;
}
.jr-filter-pill:hover {
    background: #e5e7eb;
    color: #1f2937;
    border-color: #d1d5db;
}
.jr-filter-pill.active {
    background: #0D815E;
    border-color: #0D815E;
    color: #ffffff !important;
}
.jr-filter-pill.active:hover {
    background: #0a6b4d;
    border-color: #0a6b4d;
    color: #ffffff !important;
}

.jr-sort-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}
.jr-sort-wrap label {
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    font-size: 14px;
}
.jr-sort-wrap select {
    flex: 1;
    padding: 10px 36px 10px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%230D815E' stroke-width='2'><polyline points='1,1 6,6 11,1'/></svg>") no-repeat right 14px center;
    background-size: 12px 8px;
    font-size: 14px;
    font-family: inherit;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.jr-sort-wrap select:hover {
    border-color: #0D815E;
}
.jr-sort-wrap select:focus {
    outline: none;
    border-color: #0D815E;
    box-shadow: 0 0 0 3px rgba(13, 129, 94, 0.12);
}

#jr-sidebar-cards {
    flex: 1;
    overflow: visible;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── No results in sidebar ─────────────────────────────────── */

.jr-no-results {
    padding: 30px 20px;
    text-align: center;
}

.jr-no-results-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.jr-no-results-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 10px;
}

.jr-no-results-body {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin: 0 0 20px;
}

.jr-no-results-browse {
    display: inline-block;
    padding: 10px 22px;
    background: var(--jr-green);
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.jr-no-results-browse:hover { background: #1a3430; }

.jr-sidebar-empty {
    padding: 20px;
    color: #888;
    font-style: italic;
    font-size: 13px;
    text-align: center;
}

/* ── Class Card ────────────────────────────────────────────── */

.jr-class-card {
    border-radius: var(--jr-radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    background: #fff;
    border: 1px solid var(--jr-border);
}

.jr-card-header {
    background: var(--jr-dark);
    padding: 14px 16px 12px;
}

.jr-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.35;
}

.jr-card-price {
    background: var(--jr-purple);
    color: var(--jr-gold);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    padding: 8px 16px;
}

.jr-card-meta {
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid var(--jr-border);
}

.jr-card-row {
    display: flex;
    gap: 8px;
    font-size: 13px;
    color: #333;
    margin-bottom: 6px;
}
.jr-card-row:last-child { margin-bottom: 0; }

.jr-card-label {
    font-weight: 700;
    min-width: 90px;
    flex-shrink: 0;
    color: #1a1a1a;
}

.jr-card-row a { color: var(--jr-green); text-decoration: none; }
.jr-card-row a:hover { text-decoration: underline; }

.jr-card-actions {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: var(--jr-purple);
    align-items: center;
}

.jr-btn-signup {
    display: inline-block;
    padding: 9px 20px;
    background: var(--jr-gold);
    color: #1a1a1a;
    border: none;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s;
}
.jr-btn-signup:hover { opacity: .88; }

.jr-btn-details {
    display: inline-block;
    padding: 9px 20px;
    background: var(--jr-dark);
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s;
}
.jr-btn-details:hover { opacity: .85; }

.jr-card-powered {
    padding: 8px 16px;
    font-size: 11px;
    color: #aaa;
    background: var(--jr-purple);
    text-align: center;
}
.jr-card-powered a { color: #ccc; text-decoration: none; }
.jr-card-powered a:hover { color: #fff; }

/* ── Standard popup (map-only view) ────────────────────────── */

.jr-popup { width: 320px; max-width: 90vw; font-size: 13px; color: #222; line-height: 1.45; }
.jr-popup-header { padding: 10px 12px 6px; border-bottom: 1px solid #eee; }
.jr-popup-header strong { display: block; font-size: 15px; font-weight: 700; color: #1a1a1a; }
.jr-popup-city { font-size: 12px; color: #666; }
.jr-popup-addr { padding: 7px 12px; font-size: 12px; color: #444; border-bottom: 1px solid #f0f0f0; }
.jr-popup-addr a { color: var(--jr-green); text-decoration: none; }
.jr-popup-addr a:hover { text-decoration: underline; }
.jr-popup-classes { padding: 8px 12px; }
.jr-popup-classes-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #888; margin-bottom: 6px; }
.jr-class-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.jr-class-table tr + tr td { border-top: 1px solid #f2f2f2; }
.jr-class-table td { padding: 4px 4px; vertical-align: top; }
.jr-class-name { width: 55%; font-weight: 500; }
.jr-class-name a { color: var(--jr-green); text-decoration: none; }
.jr-class-name a:hover { text-decoration: underline; }
.jr-class-meta { width: 35%; color: #555; font-size: 11px; }
.jr-class-open { width: 10%; text-align: right; font-size: 11px; color: #2a8a2a; white-space: nowrap; }
.jr-full { color: #c0392b; }
.jr-more { padding: 6px 4px; color: #888; font-style: italic; font-size: 11px; text-align: center; }
.jr-no-classes { padding: 10px 12px; margin: 0; color: #888; font-style: italic; font-size: 12px; }
.jr-popup-footer { padding: 8px 12px 10px; border-top: 1px solid #eee; }
.jr-btn { display: inline-block; padding: 6px 14px; background: var(--jr-green); color: #fff !important; border-radius: 5px; font-size: 12px; font-weight: 600; text-decoration: none !important; transition: background .15s; }
.jr-btn:hover { background: #1a3430; }

/* Google Maps InfoWindow chrome */
.gm-style .gm-style-iw-c { padding: 0 !important; border-radius: 8px !important; overflow: hidden !important; }
.gm-style .gm-style-iw-d { overflow: hidden !important; max-height: 420px !important; }
.gm-style .gm-style-iw-ch { padding-top: 6px !important; }

/* ── Details Modal ─────────────────────────────────────────── */

#jr-class-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}

#jr-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.6);
    cursor: pointer;
}

#jr-modal-box {
    position: relative;
    background: #fff;
    border-radius: var(--jr-radius);
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,.25);
    z-index: 1;
}

#jr-modal-content {
    padding-bottom: 10px;
}

/* Force modal text colours against theme resets */
#jr-modal-box * { color: inherit; }
.jr-modal-title {
    margin: 0;
    padding: 24px 28px 12px;
    font-size: 24px;
    font-weight: 800;
    color: #1a1a1a;
    text-align: center;
    line-height: 1.3;
}

.jr-modal-price {
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    color: var(--jr-green);
    padding: 8px 24px 16px;
    letter-spacing: -.01em;
}

.jr-modal-signup-top,
.jr-modal-signup-bottom {
    text-align: center;
    padding: 10px 24px;
}

/* Rainbow divider — matches Kidokinetics brand (5 colors, repeating) */
.jr-modal-rainbow {
    height: 6px;
    background: linear-gradient(
        to right,
        #ED2B2A 0%, #ED2B2A 20%,
        #5E59C0 20%, #5E59C0 40%,
        #0D815E 40%, #0D815E 60%,
        #F3C813 60%, #F3C813 80%,
        #F07BA2 80%, #F07BA2 100%
    );
    margin: 6px 0;
}

.jr-modal-details-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 24px 28px;
    border-bottom: 1px solid var(--jr-border);
}

.jr-modal-details-col h4,
.jr-modal-host-col h4 {
    margin: 0 0 14px;
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
}

.jr-modal-row {
    display: flex;
    gap: 8px;
    font-size: 15px;
    margin-bottom: 8px;
    color: #333;
}

.jr-modal-label {
    font-weight: 700;
    min-width: 70px;
    color: #1a1a1a;
}

.jr-modal-host-col {
    font-size: 15px;
    color: #333;
    line-height: 1.6;
}

.jr-modal-host-col strong { color: #1a1a1a; }

.jr-modal-addr { color: #555; font-size: 14px; }

.jr-modal-directions {
    color: var(--jr-green);
    text-decoration: none;
    font-size: 15px;
}
.jr-modal-directions:hover { text-decoration: underline; }

.jr-modal-powered { color: #888; font-size: 12px; }
.jr-modal-host-col a { color: var(--jr-green); text-decoration: none; }
.jr-modal-host-col a:hover { text-decoration: underline; }

.jr-modal-about,
.jr-modal-dates {
    padding: 20px 28px;
    border-bottom: 1px solid var(--jr-border);
    font-size: 15px;
    color: #333;
    line-height: 1.65;
}

.jr-modal-about h4,
.jr-modal-dates h4 {
    margin: 0 0 12px;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
}

.jr-modal-fullpage-link {
    display: inline-block;
    color: var(--jr-green) !important;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: color .15s;
}
.jr-modal-fullpage-link:hover { color: #1a3430 !important; text-decoration: underline; }

.jr-modal-close-wrap {
    text-align: center;
    padding: 16px 24px 20px;
}

.jr-modal-close-btn {
    padding: 12px 36px;
    background: #333 !important;
    color: #fff !important;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.jr-modal-close-btn:hover { background: #111 !important; color: #fff !important; }

/* ── CSS isolation — prevent theme styles bleeding in ──────── */

#jr-map-wrapper * {
    box-sizing: border-box;
}

/* Ensure card text colours are never overridden by theme resets */
#jr-map-wrapper .jr-card-title  { color: #fff !important; }
#jr-map-wrapper .jr-card-price  { color: var(--jr-gold) !important; }
#jr-map-wrapper .jr-card-label  { color: #1a1a1a !important; }
#jr-map-wrapper .jr-card-row    { color: #333 !important; }
#jr-map-wrapper .jr-card-row a  { color: var(--jr-green) !important; }
#jr-map-wrapper .jr-btn-signup  { color: #1a1a1a !important; }
#jr-map-wrapper .jr-btn-details { color: #fff !important; }
#jr-map-wrapper .jr-card-powered,
#jr-map-wrapper .jr-card-powered a { color: #ccc !important; }
#jr-map-wrapper #jr-context-title { color: #1a1a1a !important; }
#jr-map-wrapper #jr-context-count { color: #666 !important; }

/* ── Responsive ────────────────────────────────────────────── */

@media ( max-width: 768px ) {

    /* Stack map on top, cards below */
    #jr-map-layout {
        flex-direction: column;
        height: auto;
    }

    /* Shorter map on mobile so cards are visible without scrolling */
    #jr-map-left {
        flex: none;
        width: 100%;
    }

    #jr-class-map {
        height: 280px !important;
    }

    /* Sidebar expands naturally on mobile — page scroll handles overflow */
    #jr-map-sidebar {
        flex: none;
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--jr-border);
        max-height: none;
        overflow-y: visible;
        overflow: visible;
    }

    #jr-sidebar-cards {
        padding: 8px;
        gap: 8px;
        overflow: visible;
        max-height: none;
    }

    /* Ensure Shadow DOM host elements expand fully */
    #jr-sidebar-cards > div {
        display: block !important;
        overflow: visible !important;
        width: 100% !important;
    }

    /* Cards full width on mobile */
    .jr-class-card {
        width: 100%;
    }

    .jr-card-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .jr-btn-signup,
    .jr-btn-details {
        flex: 1;
        text-align: center;
        min-width: 100px;
    }

    /* Placeholder shorter on mobile */
    #jr-map-placeholder {
        min-height: 320px;
    }

    /* Modal full screen on mobile */
    #jr-class-modal {
        padding: 0;
        align-items: flex-end;
    }

    #jr-modal-box {
        max-height: 92vh;
        border-radius: var(--jr-radius) var(--jr-radius) 0 0;
        width: 100%;
        max-width: 100%;
    }

    .jr-modal-details-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Force modal text colours against theme resets */
#jr-modal-box * { color: inherit; }
.jr-modal-title {
        font-size: 17px;
        padding: 18px 16px 8px;
    }

    .jr-modal-details-row,
    .jr-modal-about,
    .jr-modal-dates {
        padding: 14px 16px;
    }

    /* Map controls wrap on mobile */
    #jr-map-controls {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 10px;
    }

    #jr-map-search {
        min-width: 0;
        flex: 1 1 140px;
    }

    .jr-popup { width: 240px; }
}

/* Extra small screens */
@media ( max-width: 380px ) {
    #jr-class-map { height: 240px !important; }
    #jr-map-sidebar { max-height: none; overflow: visible; }
}
