/* SureCart Course Extension — Calendar Styles */
/* Version: 1.4.1 — Grid filters, redesigned tooltip & detail panel */

/* ============================================
   ROOT & VARIABLES
   ============================================ */
.sce-calendar-wrap {
    /* ── Brand variables inherited from the site theme ── */
    --sce-primary:       var(--primary,   #2e9c8b); /* teal  — active states, CTAs      */
    --sce-secondary:     var(--secondary, #6b46c1); /* purple — accents, filter focus    */
    --sce-accent:        var(--accent,    #06b6d4); /* cyan  — highlights, search focus  */
    --sce-tertiary:      var(--tertiary,  #f97316); /* orange — warnings/notices         */

    /* ── Neutral palette ── */
    --sce-primary-dark:  var(--primary,   #1f7a6d);
    --sce-text:          #1f2937;
    --sce-text-light:    #6b7280;
    --sce-text-lighter:  #9ca3af;
    --sce-border:        #e5e7eb;
    --sce-bg:            #ffffff;
    --sce-bg-light:      #f9fafb;
    --sce-hover:         #f3f4f6;
    --sce-shadow:        0 2px 8px rgba(0,0,0,0.08);
    --sce-shadow-lg:     0 4px 20px rgba(0,0,0,0.12);
    --sce-radius:        10px;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--sce-text);
    line-height: 1.5;
    max-width: 1400px;
    margin: 0 auto;
}

/* ============================================
   HEADER & NAV
   ============================================ */
.sce-calendar-header {
    background: var(--sce-bg);
    border: 1px solid var(--sce-border);
    border-top: 3px solid var(--sce-primary);  /* brand accent top line */
    border-radius: var(--sce-radius);
    padding: 16px 20px 14px;
    margin-bottom: 16px;
    box-shadow: var(--sce-shadow);
}

/* ── Nav bar: 3-column grid ── */
.sce-calendar-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--sce-border);
}

.sce-current-month {
    font-size: 20px;
    font-weight: 700;
    color: var(--sce-text);
    justify-self: center;   /* pin date to true centre */
}

.sce-nav-buttons {
    display: flex;
    gap: 6px;
    justify-self: end;      /* pin nav buttons to right */
}

.sce-nav-btn {
    background: var(--sce-bg);
    border: 1.5px solid var(--sce-border);
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--sce-text-light);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.sce-nav-btn:hover { border-color: var(--sce-primary); color: var(--sce-primary); }
.sce-nav-btn.sce-nav-today:hover {
    background: var(--sce-primary);
    border-color: var(--sce-primary);
    color: #fff;
}

/* ============================================
   FILTERS
   ============================================ */

.sce-filter-row { display: flex; align-items: center; gap: 10px; }

/* Search — full-width row between nav and dropdowns */
.sce-filter-row--search { margin-bottom: 8px; }
.sce-filter-row--search .sce-search-input { width: 100%; }

/* Dropdown grid */
.sce-filter-row--dropdowns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

/* Type filter tabs (now lives in nav, left column) */
.sce-type-filter-group {
    display: flex;
    gap: 4px;
    background: var(--sce-bg-light);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--sce-border);
    flex-shrink: 0;
}

.sce-type-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--sce-text-light);
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.sce-type-btn:hover  { background: rgba(0,0,0,0.05); color: var(--sce-text); }
.sce-type-btn.active { background: var(--sce-primary); color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }

/* Shared input/select */
.sce-search-input,
.sce-filter-select {
    padding: 8px 12px;
    border: 1.5px solid var(--sce-border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--sce-text);
    background: var(--sce-bg);
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}
/* Search gets the primary brand colour on focus */
.sce-search-input:focus  { outline: none; border-color: var(--sce-primary); box-shadow: 0 0 0 3px rgba(46,156,139,0.12); }
/* Dropdowns get the accent (cyan) on focus */
.sce-filter-select:focus { outline: none; border-color: var(--sce-accent); }
.sce-search-input::placeholder { color: var(--sce-text-lighter); }

/* ============================================
   CALENDAR GRID
   ============================================ */
.sce-calendar-grid {
    background: var(--sce-bg);
    border: 1px solid var(--sce-border);
    border-radius: var(--sce-radius);
    overflow: hidden;
    box-shadow: var(--sce-shadow);
    margin-bottom: 40px;
}

.sce-calendar-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--sce-primary);
    border-bottom: none;
}
.sce-calendar-header-cell {
    padding: 10px 8px;
    text-align: center;
    font-weight: 700;
    font-size: 11px;
    color: rgba(255,255,255,0.9);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sce-calendar-week-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--sce-border);
}
.sce-calendar-week-row:last-child { border-bottom: none; }

/* ============================================
   DAY CELLS
   ============================================ */
.sce-calendar-day {
    min-height: 110px;
    padding: 8px;
    border-right: 1px solid var(--sce-border);
    background: var(--sce-bg);
    vertical-align: top;
    overflow: hidden;
}
.sce-calendar-day:nth-child(7n) { border-right: none; }
.sce-calendar-day.other-month   { background: var(--sce-bg-light); }
.sce-calendar-day.today {
    background: rgba(46,156,139,0.07);
    box-shadow: inset 0 0 0 2px var(--sce-primary);
}

.sce-day-number {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--sce-text-light);
    margin-bottom: 4px;
    min-width: 22px;
    text-align: center;
    line-height: 22px;
    border-radius: 50%;
}
.sce-calendar-day.today .sce-day-number { background: var(--sce-primary); color: #fff; }
.sce-calendar-day.other-month .sce-day-number { color: var(--sce-text-lighter); }

/* ============================================
   DAY ENTRIES — icon chips
   ============================================ */
.sce-day-entries {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sce-day-entry {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 7px 3px 5px;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    transition: filter 0.15s, transform 0.1s;
    user-select: none;
}
.sce-day-entry:hover { filter: brightness(0.88); transform: translateX(1px); }

.sce-entry-title {
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

/* ── Icons ── */
.sce-entry-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    position: relative;
    flex-shrink: 0;
}

/* Course: stacked pages */
.sce-entry-course .sce-entry-icon::before,
.sce-entry-course .sce-entry-icon::after {
    content: '';
    position: absolute;
    width: 9px; height: 10px;
    border: 1.5px solid rgba(255,255,255,0.85);
    border-radius: 1px;
}
.sce-entry-course .sce-entry-icon::before { bottom: 0; left: 0; }
.sce-entry-course .sce-entry-icon::after  { top: 0; right: 0; background: rgba(255,255,255,0.15); }

/* Workshop: solid square */
.sce-entry-workshop .sce-entry-icon::before {
    content: '';
    position: absolute;
    width: 10px; height: 10px;
    background: rgba(255,255,255,0.85);
    border-radius: 1px;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

/* Event: diamond */
.sce-entry-event .sce-entry-icon::before {
    content: '';
    position: absolute;
    width: 9px; height: 9px;
    background: rgba(255,255,255,0.85);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

/* Featured: star */
.sce-entry-featured .sce-entry-icon::before {
    content: '\2605';
    position: absolute;
    font-size: 11px;
    line-height: 1;
    color: rgba(255,255,255,0.95);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

/* Seminar / training: circle */
.sce-entry-seminar .sce-entry-icon::before,
.sce-entry-training .sce-entry-icon::before {
    content: '';
    position: absolute;
    width: 10px; height: 10px;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

/* ============================================
   LOADING
   ============================================ */
.sce-loading {
    text-align: center;
    padding: 48px;
    color: var(--sce-text-lighter);
    font-size: 14px;
}

/* Navigation loading overlay */
.sce-calendar-grid { position: relative; }

.sce-calendar-grid.is-loading .sce-calendar-days {
    opacity: 0.35;
    pointer-events: none;
    transition: opacity 0.15s;
}

.sce-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    pointer-events: none;
}

.sce-loading-spinner {
    display: block;
    width: 36px;
    height: 36px;
    border: 3px solid var(--sce-border);
    border-top-color: var(--sce-primary);
    border-radius: 50%;
    animation: sce-spin 0.65s linear infinite;
}

@keyframes sce-spin { to { transform: rotate(360deg); } }

/* ============================================
   MONTH PICKER
   ============================================ */
.sce-current-month {
    position: relative;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.sce-month-cal-icon {
    flex-shrink: 0;
    color: var(--sce-text-light);
    transition: color 0.15s;
    position: relative;
    top: -1px;
}
.sce-current-month:hover { color: var(--sce-primary); }
.sce-current-month:hover .sce-month-cal-icon { color: var(--sce-primary); }

.sce-month-picker {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #fff;
    border: 1px solid var(--sce-border);
    border-radius: var(--sce-radius);
    box-shadow: 0 6px 24px rgba(0,0,0,0.13);
    z-index: 200;
    padding: 12px;
    min-width: 210px;
}

.sce-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--sce-border);
}

.sce-picker-year-label {
    font-weight: 700;
    font-size: 14px;
    color: var(--sce-text);
}

.sce-picker-year-btn {
    background: none;
    border: 1px solid var(--sce-border);
    border-radius: 4px;
    padding: 2px 9px;
    cursor: pointer;
    font-size: 17px;
    line-height: 1.3;
    color: var(--sce-text-light);
    transition: border-color 0.12s, color 0.12s;
}
.sce-picker-year-btn:hover:not([disabled]) { border-color: var(--sce-primary); color: var(--sce-primary); }
.sce-picker-year-btn[disabled] { opacity: 0.25; cursor: default; }

.sce-picker-months {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.sce-picker-month {
    background: none;
    border: 1.5px solid transparent;
    border-radius: 6px;
    padding: 8px 4px;
    font-size: 13px;
    cursor: pointer;
    color: var(--sce-text);
    text-align: center;
    transition: border-color 0.1s, background 0.1s, color 0.1s;
}
.sce-picker-month:hover:not([disabled]) { background: var(--sce-hover); border-color: var(--sce-border); }
.sce-picker-month.is-today { border-color: var(--sce-primary); color: var(--sce-primary); font-weight: 600; }
.sce-picker-month.is-active { background: var(--sce-primary); color: #fff !important; border-color: var(--sce-primary); font-weight: 600; }
.sce-picker-month.is-disabled { opacity: 0.25; cursor: default; }

/* ============================================
   TOOLTIP
   ============================================ */
.sce-tooltip {
    position: absolute;
    background: #fff;
    border: 1px solid var(--sce-border);
    border-radius: 10px;
    box-shadow: var(--sce-shadow-lg);
    padding: 12px 14px;
    max-width: 260px;
    z-index: 10000;
    pointer-events: none;
}
.sce-tooltip-color-bar {
    height: 4px;
    margin: -12px -14px 10px;
    border-radius: 10px 10px 0 0;
}
.sce-tooltip-type {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 3px;
}
.sce-tooltip-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--sce-text);
    margin-bottom: 3px;
    line-height: 1.3;
}
.sce-tooltip-subtitle {
    font-size: 12px;
    color: var(--sce-text-light);
    margin-bottom: 8px;
    font-style: italic;
}
.sce-tooltip-rows {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sce-tt-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    line-height: 1.5;
}
.sce-tt-row span:first-child {
    color: var(--sce-text-lighter);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.4px;
    white-space: nowrap;
    padding-top: 1px;
}
.sce-tt-row span:last-child { color: var(--sce-text); text-align: right; }
.sce-tooltip-cta {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--sce-border);
    font-size: 12px;
    color: var(--sce-primary);
    font-weight: 500;
}

/* ============================================
   DETAIL PANEL (SLIDEOUT)
   ============================================ */
.sce-detail-panel {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
}
.sce-detail-panel.active { display: block; }

.sce-detail-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
}

.sce-detail-content {
    position: absolute;
    top: 0; right: 0;
    width: min(460px, 100vw);
    height: 100%;
    background: #fff;
    box-shadow: -6px 0 24px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    animation: sceSlidein 0.26s cubic-bezier(0.25,0.46,0.45,0.94);
}
@keyframes sceSlidein {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

/* Scrollable body area */
.sce-detail-scroll {
    flex: unset;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Sticky footer with CTA button */
.sce-detail-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--sce-border);
    flex-shrink: 0;
}

.sce-detail-close {
    position: absolute;
    top: 14px; right: 14px;
    z-index: 10;
    background: rgba(0,0,0,0.12);
    border: none;
    border-radius: 50%;
    width: 34px; height: 34px;
    font-size: 20px;
    line-height: 1;
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.sce-detail-close:hover { background: rgba(0,0,0,0.26); }

.sce-detail-color-bar {
    height: 6px;
    width: 100%;
    flex-shrink: 0;
}

.sce-detail-body-inner {
    padding: 20px 24px 24px;
}

.sce-detail-type-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 3px 10px;
    border: 1.5px solid;
    border-radius: 20px;
    margin-bottom: 10px;
}

.sce-detail-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--sce-text);
    margin: 0 0 10px;
    line-height: 1.3;
}

.sce-detail-subtitle {
    font-size: 14px;
    color: var(--sce-text-light);
    margin: 0 0 12px;
    font-style: italic;
    line-height: 1.5;
}

.sce-detail-desc {
    font-size: 14px;
    color: var(--sce-text-light);
    line-height: 1.7;
    margin: 0 0 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--sce-border);
}

/* Info grid — label/value rows, no icons */
.sce-detail-info {
    display: grid;
    grid-template-columns: 110px 1fr;
    row-gap: 10px;
    column-gap: 12px;
    align-items: start;
    margin-top: 16px;
}

/* Session quick-info (class date + time) inside header — tighter, no top margin */
.sce-detail-info--session {
    margin-top: 0;
    row-gap: 6px;
}

.sce-info-item {
    display: contents; /* participate in parent grid */
}

.sce-info-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--sce-text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-top: 2px;
    white-space: nowrap;
}

.sce-info-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--sce-text);
    line-height: 1.4;
}
.sce-info-value small {
    font-size: 12px;
    color: var(--sce-text-light);
    font-weight: 400;
    display: block;
}

.sce-sold-out {
    color: #dc2626;
    font-weight: 600;
}

/* CTA button */
.sce-btn-primary {
    display: block;
    width: 100%;
    padding: 20px 15px;
    background: var(--primary, #2a9d8f);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.15s;
    box-sizing: border-box;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.sce-btn-primary:hover { opacity: 0.82; color: #fff; }

/* Header row: title+session-info left, thumbnail right */
.sce-detail-header-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}

.sce-detail-header-text {
    flex: 1;
    min-width: 0;
}

/* Thumbnail */
.sce-detail-thumbnail {
    flex-shrink: 0;
    width: 120px;
}
.sce-detail-thumbnail img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    aspect-ratio: 1;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .sce-filter-row--dropdowns {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .sce-calendar-header { padding: 12px 14px 10px; }
    .sce-calendar-nav { grid-template-columns: 1fr; gap: 10px; }
    .sce-current-month { justify-self: start; }
    .sce-nav-buttons { justify-self: start; }
    .sce-filter-row--search { gap: 8px; }
    .sce-filter-row--search .sce-search-input { margin-left: 0; min-width: 0; width: 100%; }
    .sce-filter-row--dropdowns { grid-template-columns: 1fr 1fr; }
    .sce-calendar-day { min-height: 72px; padding: 5px; }
    .sce-day-number { font-size: 12px; }
    .sce-entry-title { display: none; }
    .sce-day-entry { padding: 3px; justify-content: center; }
    .sce-detail-info { grid-template-columns: 90px 1fr; }
}
