/* =========================================================================
   Class Schedule Calendar - Public Frontend Styles
   Designed to match the provided screenshot exactly
   Compatible with Astra, Elementor, and most WP themes
   ========================================================================= */

/* Reset - ensure theme compatibility */
.csc-schedule-wrapper,
.csc-schedule-wrapper * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.csc-schedule-wrapper {
    max-width: var(--csc-max-width, 1200px);
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* =========================================================================
   DESKTOP TABLE VIEW
   ========================================================================= */

.csc-schedule-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: fixed;
    background: #fff;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* Header row */
.csc-schedule-table thead tr {
    background: var(--csc-header-bg, #2D425C);
}

.csc-schedule-table thead th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 15px;
    color: #fff;
    border: none;
    border-right: 1px solid rgba(255,255,255,0.12);
    letter-spacing: 0.02em;
}
.csc-schedule-table thead th:last-child {
    border-right: none;
}

/* Time column header - Yellow per screenshot */
.csc-th-time {
    width: 70px;
    min-width: 70px;
    color: var(--csc-time-color, #F5C233) !important;
    font-weight: 700 !important;
}

/* Body cells */
.csc-schedule-table tbody td {
    padding: 10px 8px;
    vertical-align: top;
    border-bottom: 1px solid var(--csc-border, #DEE2E6);
    border-right: 1px solid var(--csc-border, #DEE2E6);
    min-height: 70px;
    height: 80px;
    background: #fff;
    transition: background 0.15s ease;
}
.csc-schedule-table tbody td:last-child {
    border-right: none;
}
.csc-schedule-table tbody tr:last-child td {
    border-bottom: none;
}

/* Time cell - yellow bold text */
.csc-td-time {
    text-align: center;
    vertical-align: middle !important;
    background: #fafafa !important;
    border-right: 2px solid var(--csc-border, #DEE2E6) !important;
}
.csc-time-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--csc-time-color, #F5C233);
    white-space: nowrap;
}

/* Empty cells - light grey background like screenshot */
.csc-td-empty {
    background: #f8f9fa !important;
}

/* =========================================================================
   CLASS CARD (inside table cell)
   ========================================================================= */

.csc-class-card {
    background: var(--csc-cell-bg, #E8ECF0);
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    color: var(--csc-cell-text, #333);
    min-height: 50px;
}

.csc-class-card:hover,
.csc-class-card:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(45,66,92,0.18);
    outline: none;
    background: #dce2e8;
}

.csc-class-title {
    font-weight: 700;
    font-size: 13px;
    line-height: 1.3;
    color: #1a2a3a;
    margin-bottom: 2px;
}

.csc-class-caption {
    font-size: 12px;
    color: #555;
    line-height: 1.3;
    font-style: italic;
}

.csc-class-dates {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
    line-height: 1.3;
}

.csc-class-instructor {
    font-size: 12px;
    color: #555;
    margin-top: 5px;
    font-style: italic;
    cursor: pointer;
    display: inline-block;
    border-bottom: 1px dashed rgba(0,0,0,0.3);
    transition: color 0.15s;
}

.csc-class-instructor:hover,
.csc-class-instructor:focus-visible {
    color: #2D425C;
    border-bottom-color: #2D425C;
    outline: none;
}


/* =========================================================================
   MOBILE VIEW - Tab-based day navigation
   ========================================================================= */

.csc-schedule-mobile {
    display: none;
}

/* Day tabs - horizontal scrollable */
.csc-mobile-day-tabs {
    display: flex;
    gap: 0;
    background: var(--csc-header-bg, #2D425C);
    border-radius: 10px 10px 0 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.csc-mobile-day-tabs::-webkit-scrollbar {
    display: none;
}

.csc-mobile-tab {
    flex: 1;
    min-width: 0;
    padding: 14px 6px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
    letter-spacing: 0.02em;
    border-bottom: 3px solid transparent;
}
.csc-mobile-tab:hover {
    color: rgba(255,255,255,0.85);
}
.csc-mobile-tab.active {
    color: #fff;
    border-bottom-color: var(--csc-time-color, #F5C233);
    background: rgba(255,255,255,0.08);
}

/* Day content panels */
.csc-mobile-day-content {
    display: none;
    padding: 12px 0;
}
.csc-mobile-day-content.active {
    display: block;
    animation: cscFadeIn 0.25s ease;
}

@keyframes cscFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.csc-mobile-day-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--csc-header-bg, #2D425C);
    padding: 8px 4px 12px;
    border-bottom: 2px solid var(--csc-border, #DEE2E6);
    margin-bottom: 12px;
}

/* Mobile class cards */
.csc-mobile-class-card {
    display: flex;
    align-items: flex-start;
    background: #fff;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border-left: 4px solid var(--csc-header-bg, #2D425C);
    cursor: pointer;
    transition: all 0.2s ease;
}
.csc-mobile-class-card:hover,
.csc-mobile-class-card:focus-visible {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateX(2px);
    outline: none;
}

.csc-mobile-time {
    font-weight: 700;
    font-size: 15px;
    color: var(--csc-time-color, #F5C233);
    min-width: 55px;
    padding-right: 14px;
    border-right: 2px solid var(--csc-border, #DEE2E6);
    margin-right: 14px;
    text-align: center;
    line-height: 1.4;
}

.csc-mobile-details {
    flex: 1;
}

.csc-mobile-title {
    font-weight: 700;
    font-size: 15px;
    color: #1a2a3a;
    line-height: 1.3;
}

.csc-mobile-caption {
    font-size: 13px;
    color: #666;
    margin-top: 2px;
    font-style: italic;
}

.csc-mobile-dates {
    font-size: 12px;
    color: #888;
    margin-top: 3px;
}

.csc-mobile-instructor {
    font-size: 13px;
    color: #555;
    margin-top: 6px;
    font-style: italic;
    cursor: pointer;
    display: inline-block;
    border-bottom: 1px dashed rgba(0,0,0,0.3);
}
.csc-mobile-instructor:hover {
    color: #2D425C;
    border-bottom-color: #2D425C;
}

.csc-mobile-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
    font-style: italic;
}


/* =========================================================================
   POPUP / MODAL
   ========================================================================= */

.csc-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 20px;
}
.csc-popup-overlay.csc-popup-visible {
    opacity: 1;
}

.csc-popup-content {
    background: var(--csc-popup-bg, #fff);
    border-radius: 12px;
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    position: relative;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
}
.csc-popup-overlay.csc-popup-visible .csc-popup-content {
    transform: scale(1) translateY(0);
}

.csc-popup-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
    z-index: 2;
}
.csc-popup-close:hover {
    color: #333;
    background: #f0f0f0;
}

.csc-popup-body {
    padding: 28px;
}

/* Popup loading */
.csc-popup-loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}

/* Popup class details */
.csc-popup-class-header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}
.csc-popup-class-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a2a3a;
    line-height: 1.3;
}
.csc-popup-class-caption {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
    font-style: italic;
}

.csc-popup-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}
.csc-popup-meta-item {
    font-size: 13px;
    line-height: 1.5;
}
.csc-popup-meta-label {
    font-weight: 600;
    color: #555;
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}
.csc-popup-meta-value {
    color: #333;
}

.csc-popup-description {
    font-size: 14px;
    line-height: 1.6;
    color: #444;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}
.csc-popup-description p {
    margin-bottom: 10px;
}

/* Popup instructor details */
.csc-popup-instructor {
    text-align: center;
}
.csc-popup-instructor-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 16px;
    display: block;
    border: 3px solid var(--csc-header-bg, #2D425C);
}
.csc-popup-instructor-name {
    font-size: 22px;
    font-weight: 700;
    color: #1a2a3a;
    margin-bottom: 4px;
}
.csc-popup-instructor-specialties {
    font-size: 13px;
    color: var(--csc-time-color, #F5C233);
    font-weight: 600;
    margin-bottom: 16px;
}
.csc-popup-instructor-bio {
    font-size: 14px;
    line-height: 1.6;
    color: #444;
    text-align: left;
    padding-top: 16px;
    border-top: 1px solid #eee;
}
.csc-popup-instructor-bio p {
    margin-bottom: 10px;
}
.csc-popup-instructor-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: #e8ecf0;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #aaa;
}


/* =========================================================================
   ASTRA / ELEMENTOR COMPATIBILITY OVERRIDES
   ========================================================================= */

/* Prevent Astra from overriding table styles */
.csc-schedule-wrapper table,
.csc-schedule-wrapper th,
.csc-schedule-wrapper td {
    border: none;
    background: none;
    padding: 0;
}
.csc-schedule-table thead th {
    padding: 14px 12px;
    background: var(--csc-header-bg, #2D425C);
    color: #fff;
}
.csc-schedule-table tbody td {
    padding: 10px 8px;
    background: #fff;
    border-bottom: 1px solid var(--csc-border, #DEE2E6);
    border-right: 1px solid var(--csc-border, #DEE2E6);
}

/* Elementor container resets */
.elementor-widget-container .csc-schedule-wrapper {
    width: 100%;
}
.elementor-section .csc-schedule-table {
    margin: 0;
}

/* Ensure our popup is above Elementor overlays */
.csc-popup-overlay {
    z-index: 999999 !important;
}

/* Prevent WP theme link styles from leaking in */
.csc-schedule-wrapper a,
.csc-schedule-wrapper a:hover {
    text-decoration: none;
    box-shadow: none;
}

/* =========================================================================
   PRINT STYLES
   ========================================================================= */

@media print {
    .csc-schedule-mobile,
    .csc-popup-overlay {
        display: none !important;
    }
    .csc-schedule-desktop {
        display: block !important;
    }
    .csc-schedule-table {
        box-shadow: none;
        font-size: 11px;
    }
    .csc-class-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
