:host {
    display: block;
    height: 100%;
    min-height: 0;
}

.live-epg-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    background: var(--mat-sys-surface);
}

.live-epg-panel__summary-bar {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 8px;
    min-height: 56px;
    padding: 7px 12px 9px 8px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--app-separator);
    background: var(
        --app-widget-header-bg,
        var(--mat-sys-surface-container-high)
    );
    box-sizing: border-box;
}

.live-epg-panel__toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--mat-sys-on-surface-variant);
    app-region: no-drag;

    &:hover {
        color: var(--mat-sys-on-surface);
        background: color-mix(in srgb, currentColor 10%, transparent);
    }
}

.live-epg-panel__summary {
    min-width: 0;
    display: grid;
    align-content: center;
    row-gap: 3px;
}

.live-epg-panel__program-line {
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.live-epg-panel__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.61rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--app-selection-color);
}

.live-epg-panel__title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.94rem;
    line-height: 1.25;
    font-weight: 600;
    color: var(--mat-sys-on-surface);
}

.live-epg-panel__title--muted {
    font-weight: 500;
    color: var(--mat-sys-on-surface-variant);
}

.live-epg-panel__time {
    flex-shrink: 0;
    font-size: 0.78rem;
    line-height: 1;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--mat-sys-on-surface-variant);
}

.live-epg-panel__date-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    app-region: no-drag;

    button {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        color: var(--mat-sys-on-surface-variant);

        &:hover:not([disabled]) {
            color: var(--mat-sys-on-surface);
            background: color-mix(in srgb, currentColor 10%, transparent);
        }
    }
}

.live-epg-panel__selected-date {
    min-width: 150px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    font-size: 0.83rem;
    line-height: 1.2;
    font-weight: 600;
    color: var(--mat-sys-on-surface-variant);
}

.live-epg-panel__date-chip {
    display: none;
    min-width: 0;
    max-width: 150px;
    height: 36px;
    padding-inline: 10px;
    border-radius: 10px;
    color: var(--mat-sys-on-surface-variant);
    background: color-mix(in srgb, currentColor 7%, transparent);
    app-region: no-drag;

    mat-icon {
        flex-shrink: 0;
        width: 18px;
        height: 18px;
        font-size: 18px;
    }

    span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.78rem;
        font-weight: 600;
    }
}

.live-epg-panel__progress {
    position: absolute;
    inset-inline: 8px 12px;
    bottom: 5px;
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--mat-sys-on-surface) 14%, transparent);
}

.live-epg-panel__progress-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--app-selection-color);
    box-shadow: 0 0 8px -2px var(--app-selection-glow);
    transition: width 0.35s ease;
}

.live-epg-panel__body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition:
        opacity 0.16s ease,
        block-size 0.16s ease;
}

.live-epg-panel--collapsed {
    .live-epg-panel__summary-bar {
        border-bottom-color: transparent;
    }

    .live-epg-panel__date-nav {
        display: none;
    }

    .live-epg-panel__summary {
        display: flex;
        align-items: baseline;
        gap: 8px;
    }

    .live-epg-panel__label {
        flex-shrink: 0;
        font-size: 0.7rem;
        letter-spacing: 0.08em;
    }

    .live-epg-panel__program-line {
        gap: 8px;
    }

    .live-epg-panel__body {
        flex-basis: 0;
        block-size: 0;
        min-block-size: 0;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}

@media only screen and (max-width: 720px) {
    .live-epg-panel__date-nav {
        display: none;
    }

    .live-epg-panel__date-chip {
        display: inline-flex;
    }
}

@media only screen and (max-width: 560px) {
    .live-epg-panel__label {
        display: none;
    }

    .live-epg-panel--collapsed .live-epg-panel__label {
        display: none;
    }
}
