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

:root {
    --jr-green:      #254A45;
    --jr-green-lt:   #E8F0EF;
    --jr-green-mid:  #C5D8D6;
    --jr-gold:       #F5A623;
    --jr-navy:       #1A1A2E;
    --jr-dark:       #1E1E2E;
    --jr-purple:     #3D3A8C;
    --jr-gray:       #555;
    --jr-lgray:      #F5F7FA;
    --jr-border:     #E0E0E0;
    --jr-white:      #fff;
    --jr-radius:     10px;
    --jr-shadow:     0 4px 20px rgba(0,0,0,.12);
}

/* ── 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;
    height: 100%;
}

#jr-map-left {
    flex: 1 1 60%;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#jr-map-sidebar {
    flex: 0 0 380px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-left: 1px solid var(--jr-border);
    overflow: hidden;
}

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

#jr-map-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fff;
    border-bottom: 1px solid var(--jr-border);
    flex-wrap: wrap;
}

#jr-map-search {
    flex: 1 1 220px;
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}
#jr-map-search:focus { border-color: var(--jr-green); box-shadow: 0 0 0 3px rgba(37,74,69,.12); }

#jr-map-count { font-size: 13px; color: #666; white-space: nowrap; }

/* ── Sidebar header ────────────────────────────────────────── */

#jr-sidebar-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--jr-border);
    background: var(--jr-lgray);
    display: flex;
    align-items: baseline;
    gap: 8px;
}

#jr-sidebar-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
}

#jr-sidebar-count {
    font-size: 12px;
    color: #888;
}

#jr-sidebar-cards {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── 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;
}

.jr-modal-title {
    margin: 0;
    padding: 22px 24px 10px;
    font-size: 20px;
    font-weight: 800;
    color: #1a1a1a;
    text-align: center;
    line-height: 1.3;
}

.jr-modal-price {
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--jr-green);
    padding: 6px 24px 14px;
}

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

/* Rainbow divider — matches Kidokinetics brand */
.jr-modal-rainbow {
    height: 6px;
    background: linear-gradient(
        to right,
        #e74c3c 0%, #e74c3c 14.28%,
        #e67e22 14.28%, #e67e22 28.57%,
        #f1c40f 28.57%, #f1c40f 42.85%,
        #2ecc71 42.85%, #2ecc71 57.14%,
        #3498db 57.14%, #3498db 71.42%,
        #9b59b6 71.42%, #9b59b6 85.71%,
        #e91e8c 85.71%, #e91e8c 100%
    );
    margin: 6px 0;
}

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

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

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

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

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

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

.jr-modal-addr { color: #555; }

.jr-modal-directions {
    color: var(--jr-green);
    text-decoration: none;
    font-size: 13px;
}
.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: 18px 24px;
    border-bottom: 1px solid var(--jr-border);
    font-size: 13px;
    color: #333;
    line-height: 1.65;
}

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

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

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

/* ── 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-sidebar-title { color: #1a1a1a !important; }
#jr-map-wrapper .jr-sidebar-count { color: #888 !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 fills remaining space, scrollable */
    #jr-map-sidebar {
        flex: none;
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--jr-border);
        max-height: 60vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #jr-sidebar-cards {
        padding: 8px;
        gap: 8px;
    }

    /* 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;
    }

    .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: 55vh; }
}
