/* Calendar Page Styles */
.calendar-page-container {
    padding: 0;
    max-width: 100%;
    margin: 0 auto;
}

.calendar-grid-header {
    display: grid;
    grid-template-columns: 120px repeat(4, 1fr);
    background: #004165; /* TM Blue */
    color: white;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    margin-bottom: 2px;
}

.calendar-grid-header div {
    padding: 12px 15px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-row {
    display: grid;
    grid-template-columns: 120px repeat(4, 1fr);
    background: white;
    margin-bottom: 2px;
    min-height: 140px;
}

.calendar-row:last-child {
    border-radius: 0 0 12px 12px;
}

.month-label {
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #004165;
    border-right: 1px solid #e2e8f0;
    padding: 15px;
    text-align: center;
    font-size: 1rem;
    line-height: 1.2;
}

.calendar-cell {
    border-right: 1px solid #e2e8f0;
    padding: 8px;
    background: #fff;
    transition: background 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0; /* Allow inner content to wrap */
}

.calendar-cell:last-child {
    border-right: none;
}

.calendar-cell:hover {
    background: #f8fafc;
}

.empty-cell {
    background: #fdfdfd;
}

.meeting-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    flex-grow: 1;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.meeting-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: var(--z-sticky);
}

/* Status-based Backgrounds */
.status-running {
    background-color: #f0fdf4; /* Very light green */
    border-color: #bbf7d0;
}

.status-finished {
    background-color: #f1f5f9; /* Fallback */
    border-color: rgba(0, 0, 0, 0.05);
    opacity: 1;
    filter: none;
}

.status-finished.type-keynote-speech { background-color: #e0f2fe; }
.status-finished.type-speech-marathon { background-color: #fef3c7; }
.status-finished.type-speech-contest { background-color: #fce7f3; }
.status-finished.type-panel-discussion { background-color: #ede9fe; }
.status-finished.type-debate { background-color: #ffedd5; }
.status-finished.type-pecha-kucha { background-color: #f1f5f9; }
.status-finished.type-gavel-passing { background-color: #dcfce7; }
.status-finished.type-club-election { background-color: #fae8ff; }

.status-finished .meeting-type-badge {
    background-color: white !important;
    color: black !important;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.meeting-card.is-upcoming {
    background-color: #f8fafc; /* Light gray */
    border-color: #e2e8f0;
}

.status-finished .meeting-footer {
    border-top: 1px solid #cbd5e1; /* Darker line for past meetings */
}

.status-cancelled {
    background-color: #fef2f2; /* Light red */
    border-color: #fecaca;
    opacity: 0.8;
}

.status-unpublished, .status-not-started {
    background-color: #ffffff;
}

/* Highlight Ongoing/Upcoming - Now in Maroon */
.meeting-card.highlight {
    border: 2px solid #772432; /* TM Maroon */
    background-color: #fdf2f2; /* Very light maroon bg */
    box-shadow: 0 4px 12px rgba(119, 36, 50, 0.15);
}

.meeting-card.highlight.status-running {
    border-color: #772432;
    background-color: #fdf2f2;
}

.meeting-card.highlight::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #772432;
}

.meeting-date {
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.meeting-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex: 1;
    margin: 4px 0;
}

.sharing-master {
    font-size: 0.75rem;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: -2px;
    line-height: 1;
    text-align: center;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.sharing-master i {
    font-size: 0.7rem;
    color: #94a3b8;
}

/* Meeting Grid (for sharing master layout) */
.meeting-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 8px;
    align-items: start;
    margin: 4px 0;
    width: 100%;
}

.meeting-grid-left {
    min-width: 0; /* Ensures child text (like meeting-title) wraps instead of overflowing */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 4px;
}

.meeting-grid-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    gap: 8px;
    min-height: 86px; /* Anchor height so wrapped names don't push the grid taller */
}

.meeting-avatar-img {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #cbd5e1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.meeting-avatar-placeholder {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background-color: #f1f5f9;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    border: 1.5px solid #e2e8f0;
}

.meeting-subtitle {
    font-size: 0.68rem;
    color: #64748b;
    margin-top: 2px;
    font-style: italic;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    text-wrap: balance;
}

.meeting-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(226, 232, 240, 0.6);
    min-height: 24px;
}

.meeting-num {
    margin-right: auto; /* Push num to the left, badge stays right */
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    line-height: 1.5; /* Match badge visual height */
}

.meeting-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    height: 18px; /* Fixed height for consistent look */
    background: #e2e8f0;
    color: #475569;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    margin: 0; /* Clear any stray margins */
}

/* Meeting Type Badge Colors */
.meeting-type-badge.type-keynote-speech {
    background-color: #e0f2fe;
    color: #0369a1;
}

.meeting-type-badge.type-speech-marathon {
    background-color: #fef3c7;
    color: #b45309;
}

.meeting-type-badge.type-speech-contest {
    background-color: #fce7f3;
    color: #be185d;
}

.meeting-type-badge.type-panel-discussion {
    background-color: #ede9fe;
    color: #6d28d9;
}

.meeting-type-badge.type-debate {
    background-color: #ffedd5;
    color: #c2410c;
}

.meeting-type-badge.type-pecha-kucha {
    background-color: #f1f5f9;
    color: #475569;
}

.meeting-type-badge.type-gavel-passing {
    background-color: #dcfce7;
    color: #15803d;
}

.meeting-type-badge.type-club-election {
    background-color: #fae8ff;
    color: #a21caf;
}





.calendar-body {
    background: transparent;
}

.calendar-grid-container {
    width: 100%;
    background: transparent;
    border-radius: 12px;
    box-shadow: none;
    overflow: hidden;
    border: none;
}

/* Calendar-page layout for the date-range picker (button + modal styles live in css/components/date_range_picker.css) */
.calendar-page-container .filter-row-premium {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.calendar-page-container .filter-left {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    gap: 10px;
}

.calendar-page-container .filter-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
    min-width: 0;
}

/* Calendar KPI tiles (right end of filter row) — color-block stat strip */
.calendar-kpis {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    padding: 0 4px 4px 0;
    flex: 1 1 auto;
    min-width: 0;
    scroll-padding-left: 0;
}


/* Per-type color blocks */
.kpi-tile.type-keynote-speech    { background-color: #0369a1; }

.kpi-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    min-width: 148px;
    padding: 9px 12px;
    color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    isolation: isolate;
}

/* Dimming/filtering states for KPI tiles */
.filter-row-premium.has-active-filter .kpi-tile:not(.active-filter) {
    opacity: 0.45;
}

.filter-row-premium.has-active-filter .kpi-tile.active-filter {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

/* Subtle diagonal sheen overlay for a designed, textured look */
.kpi-tile::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.08) 100%);
    pointer-events: none;
    z-index: var(--z-bg);
}

.kpi-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
    filter: saturate(1.08) brightness(1.04);
}

.kpi-tile .kpi-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.kpi-tile .kpi-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
}

.kpi-tile .kpi-icon {
    font-size: 0.85rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
    flex: 0 0 auto;
}

.kpi-tile .kpi-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.kpi-tile .kpi-count {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.025em;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
    flex: 0 0 auto;
    text-align: right;
}

.kpi-tile .kpi-bar {
    margin-top: 8px;
    height: 3px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 2px;
    overflow: hidden;
}

.kpi-tile .kpi-bar > span {
    display: block;
    height: 100%;
    background: #ffffff;
    border-radius: 2px;
    transform-origin: left center;
    animation: kpi-bar-grow 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Grand Total — white, clean, fixed in place (lives outside the scroll container).
   NOTE: these rules MUST come after the base .kpi-tile rules so they win the cascade
   for text color (the base rules set color: #ffffff for icon/label/count). */
.kpi-tile-total {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    min-width: 130px;
    max-width: max-content;
    flex: 0 0 auto !important;
}

.kpi-tile-total::before {
    display: none;
}

.kpi-tile-total .kpi-icon {
    color: #004165;
    text-shadow: none;
    font-size: 0.95rem;
}

.kpi-tile-total .kpi-label {
    color: #0f172a !important;
    font-weight: 800;
    letter-spacing: 0.8px;
    opacity: 1;
}

.kpi-tile-total .kpi-count {
    color: #004165 !important;
    text-shadow: none;
    font-size: 1.55rem;
    letter-spacing: -0.03em;
    font-weight: 800;
    opacity: 1;
}

.kpi-tile-total .kpi-bar {
    display: none;
}

.kpi-tile-total:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 14px rgba(15, 23, 42, 0.12),
        0 1px 2px rgba(15, 23, 42, 0.06);
    filter: none;
}

@keyframes kpi-bar-grow {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}


/* Per-type color blocks */
.kpi-tile.type-keynote-speech    { background-color: #0369a1; }
.kpi-tile.type-speech-marathon   { background-color: #b45309; }
.kpi-tile.type-speech-contest    { background-color: #be185d; }
.kpi-tile.type-panel-discussion  { background-color: #6d28d9; }
.kpi-tile.type-debate            { background-color: #c2410c; }
.kpi-tile.type-pecha-kucha       { background-color: #475569; }
.kpi-tile.type-gavel-passing     { background-color: #15803d; }
.kpi-tile.type-club-election     { background-color: #a21caf; }

/* Responsive */
@media (max-width: 1024px) {
    .month-label {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .calendar-grid-header {
        display: none;
    }
    .calendar-row {
        grid-template-columns: 1fr;
        min-height: auto;
        gap: 15px;
        padding: 20px 15px;
        background: #f8fafc;
        margin-bottom: 20px;
        border-radius: 12px;
        border: 1px solid #e2e8f0;
    }
    .month-label {
        font-weight: 800;
        font-size: 1.1rem;
        background: #004165; /* TM Blue */
        color: white;
        border-radius: 8px;
        border: none;
        margin-bottom: 10px;
        padding: 12px;
        position: sticky;
        top: 0;
        z-index: var(--z-sticky);
    }
    .calendar-cell {
        border: none;
        padding: 0;
    }
    .calendar-cell:not(.empty-cell) {
        margin-bottom: 0;
    }
    .calendar-cell.empty-cell,
    .calendar-cell.cell-empty {
        display: none;
    }
    .meeting-card {
        margin-bottom: 10px;
        text-align: left;
    }
    .meeting-card:last-child {
        margin-bottom: 0;
    }
    .meeting-title {
        padding: 8px 0;
    }
    .filters-control.premium {
        padding: 15px;
    }
    .calendar-page-container .filter-row-premium {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 12px;
        align-items: stretch;
    }
    .calendar-page-container .filter-left {
        display: contents;
    }
    .calendar-page-container .filter-right {
        grid-column: 1;
        grid-row: 1;
        width: auto;
        justify-self: start;
        display: flex;
        margin: 0;
    }
    .calendar-page-container .date-range-btn {
        height: 38px;
        box-sizing: border-box;
        padding: 0 12px;
        flex: 0 0 auto;
    }
    .kpi-tile-total {
        grid-column: 2;
        grid-row: 1;
        width: auto;
        margin: 0;
        box-sizing: border-box;
        min-width: 110px;
        padding: 8px 12px;
    }
    .kpi-tile-total .kpi-count {
        font-size: 1.35rem;
    }
    .calendar-kpis {
        grid-column: 1 / span 2;
        grid-row: 2;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 6px;
        scrollbar-width: thin;
        gap: 10px;
    }
    .kpi-tile {
        flex: 0 0 auto;
        padding: 8px 10px;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .kpi-tile:not(.kpi-tile-total) {
        min-width: 68px;
        cursor: pointer;
    }
    .kpi-tile:not(.kpi-tile-total) .kpi-label {
        display: none;
    }
    .kpi-tile:not(.kpi-tile-total).show-label .kpi-label {
        display: inline-block;
        margin-left: 4px;
        animation: kpi-label-fade-in 0.25s ease forwards;
    }
    .kpi-tile:not(.kpi-tile-total).show-label {
        min-width: 145px;
    }
    .kpi-tile .kpi-icon {
        font-size: 0.85rem;
    }
    .kpi-tile .kpi-count {
        font-size: 1.25rem;
    }
    .kpi-tile .kpi-bar {
        margin-top: 6px;
    }
    .calendar-row.month-empty {
        display: none;
    }
}

@keyframes kpi-label-fade-in {
    from { opacity: 0; transform: translateX(-4px); }
    to { opacity: 1; transform: translateX(0); }
}
