/* EnaCast Public Styles */

/* Container — opt into wide layout in block themes */
.enacast-container {
    position: relative;
    margin: 1em 0;
    max-width: var(--wp--style--global--wide-size, 1200px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.enacast-container.enacast-loading .enacast-content {
    opacity: 0.5;
    pointer-events: none;
}

.enacast-container.enacast-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #ddd;
    border-top-color: #333;
    border-radius: 50%;
    animation: enacast-spin 0.6s linear infinite;
    z-index: 10;
}

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

/* Grid */
.enacast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5em;
    margin: 1em 0;
}

/* Card */
.enacast-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s;
}

.enacast-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.enacast-card-pinned {
    border-color: #f0c040;
    border-width: 2px;
}

.enacast-card-image {
    overflow: hidden;
}

.enacast-card-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.enacast-card-image:hover img {
    transform: scale(1.05);
}

/* Program & podcast cards: smaller minmax for more columns with square logos */
.enacast-programs-grid,
.enacast-podcasts-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* Program & podcast cards: square images to show full logos */
.enacast-program-card .enacast-card-image img,
.enacast-podcast-card .enacast-card-image img {
    aspect-ratio: 1;
    height: auto;
}

/* No-image placeholder */
.enacast-card-placeholder {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    transition: background 0.3s ease;
}

.enacast-card-placeholder span {
    font-size: 3em;
    font-weight: 700;
    color: #adb5bd;
    line-height: 1;
}

.enacast-card-image:hover .enacast-card-placeholder {
    background: #dee2e6;
}

/* Badges row between image and body */
.enacast-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3em;
    padding: 0.5em 1em 0;
}

.enacast-card-body {
    padding: 1em;
}

.enacast-card-title {
    font-size: 1.1em;
    margin: 0 0 0.5em;
    line-height: 1.3;
}

.enacast-card-title a {
    text-decoration: none;
    color: inherit;
}

.enacast-card-title a:hover {
    text-decoration: underline;
}

.enacast-card-subtitle {
    font-size: 0.95em;
    color: #555;
    margin: 0 0 0.5em;
}

.enacast-card-description {
    font-size: 0.9em;
    color: #666;
    margin: 0 0 0.5em;
    line-height: 1.5;
}

.enacast-card-meta {
    font-size: 0.85em;
    color: #888;
    margin: 0.25em 0;
}

.enacast-card-meta a {
    color: #666;
    text-decoration: none;
}

.enacast-card-meta a:hover {
    text-decoration: underline;
}

.enacast-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5em;
    margin-top: 0.5em;
}

/* Badges */
.enacast-badge {
    display: inline-block;
    font-size: 0.75em;
    font-weight: 600;
    padding: 0.2em 0.6em;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.enacast-badge-onair {
    background: #d4edda;
    color: #155724;
}

.enacast-badge-featured {
    background: #fff3cd;
    color: #856404;
}

.enacast-badge-pinned {
    background: #fff3cd;
    color: #856404;
}

.enacast-badge-repeat {
    background: #e2e3e5;
    color: #383d41;
}

/* Tags */
.enacast-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3em;
}

.enacast-tag {
    font-size: 0.8em;
    background: #f0f0f0;
    color: #555;
    padding: 0.15em 0.5em;
    border-radius: 3px;
}

/* Filters */
.enacast-filters {
    margin-bottom: 1em;
}

.enacast-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    align-items: center;
}

.enacast-filter-search,
.enacast-filter-text,
.enacast-filter-select,
.enacast-filter-number {
    padding: 0.5em 0.75em;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
}

.enacast-filter-number {
    width: 80px;
}

.enacast-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    font-size: 0.9em;
    cursor: pointer;
}

/* Searchable select */
.enacast-searchable-select {
    position: relative;
    display: inline-block;
}

.enacast-searchable-select-input {
    padding: 0.5em 0.75em;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
    min-width: 180px;
}

.enacast-searchable-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.enacast-searchable-select-dropdown.enacast-searchable-select-open {
    display: block;
}

.enacast-searchable-select-option {
    padding: 0.4em 0.75em;
    cursor: pointer;
    font-size: 0.9em;
}

.enacast-searchable-select-option:hover {
    background: #f0f0f0;
}

.enacast-filter-submit {
    padding: 0.5em 1em;
    border: 1px solid #333;
    border-radius: 4px;
    background: #333;
    color: #fff;
    font-size: 0.9em;
    cursor: pointer;
}

.enacast-filter-submit:hover {
    background: #555;
}

/* Pagination */
.enacast-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1em;
    margin: 1.5em 0;
    font-size: 0.9em;
}

.enacast-pagination-link {
    text-decoration: none;
    color: #333;
    padding: 0.4em 0.8em;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.enacast-pagination-link:hover {
    background: #f5f5f5;
}

.enacast-pagination-info {
    color: #666;
}

/* No results / error */
.enacast-no-results,
.enacast-error {
    padding: 2em;
    text-align: center;
    color: #666;
    font-size: 0.95em;
}

.enacast-error {
    color: #c00;
}

/* Program single */
.enacast-program-single {
    max-width: 800px;
}

.enacast-program-cover img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1em;
}

.enacast-program-header {
    display: flex;
    gap: 1em;
    align-items: flex-start;
    margin-bottom: 1em;
}

.enacast-program-logo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.enacast-program-title {
    margin: 0 0 0.25em;
}

.enacast-program-host {
    color: #555;
    margin: 0.25em 0;
}

.enacast-program-meta {
    color: #888;
    font-size: 0.9em;
}

.enacast-program-description {
    margin: 1em 0;
    line-height: 1.6;
}

.enacast-program-schedule ul {
    list-style: none;
    padding: 0;
}

.enacast-program-schedule li {
    padding: 0.3em 0;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

/* Subscribe buttons */
.enacast-subscribe {
    margin: 1.5em 0;
}

.enacast-subscribe h3 {
    margin: 0 0 0.75em;
}

.enacast-subscribe-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}

.enacast-subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.45em 0.9em;
    border: 1px solid #d0d0d0;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 500;
    text-decoration: none;
    color: #333;
    background: #fff;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.enacast-subscribe-btn:hover {
    background: #f5f5f5;
    border-color: #aaa;
    text-decoration: none;
    color: #333;
}

.enacast-subscribe-btn svg {
    flex-shrink: 0;
}

.enacast-subscribe-rss {
    border-color: #ee802f;
    color: #ee802f;
}

.enacast-subscribe-rss:hover {
    background: #fff5ee;
    color: #ee802f;
}

.enacast-subscribe-apple {
    border-color: #9933cc;
    color: #9933cc;
}

.enacast-subscribe-apple:hover {
    background: #f9f0ff;
    color: #9933cc;
}

.enacast-subscribe-overcast {
    border-color: #fc7e0f;
    color: #fc7e0f;
}

.enacast-subscribe-overcast:hover {
    background: #fff5ee;
    color: #fc7e0f;
}

.enacast-subscribe-pocketcasts {
    border-color: #f43e37;
    color: #f43e37;
}

.enacast-subscribe-pocketcasts:hover {
    background: #fff0ef;
    color: #f43e37;
}

.enacast-subscribe-castro {
    border-color: #00b265;
    color: #00b265;
}

.enacast-subscribe-castro:hover {
    background: #f0fdf6;
    color: #00b265;
}

/* Podcast single */
.enacast-podcast-single {
    max-width: 800px;
}

.enacast-podcast-header {
    display: flex;
    gap: 1em;
    align-items: flex-start;
    margin-bottom: 1em;
}

.enacast-podcast-logo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.enacast-podcast-title {
    margin: 0 0 0.25em;
}

.enacast-podcast-program a {
    color: #555;
    text-decoration: none;
}

.enacast-podcast-program a:hover {
    text-decoration: underline;
}

.enacast-podcast-date {
    display: block;
    color: #888;
    font-size: 0.9em;
    margin: 0.25em 0;
}

.enacast-podcast-duration {
    color: #888;
    font-size: 0.9em;
}

.enacast-podcast-summary {
    margin: 1em 0;
    line-height: 1.6;
}

/* Audio player */
.enacast-player {
    margin: 1em 0;
}

.enacast-audio {
    width: 100%;
}

/* Markers */
.enacast-podcast-markers {
    margin: 1.5em 0;
}

.enacast-markers-list {
    list-style: none;
    padding: 0;
}

.enacast-marker {
    display: flex;
    align-items: baseline;
    gap: 0.75em;
    padding: 0.5em 0;
    border-bottom: 1px solid #f0f0f0;
}

.enacast-marker-time {
    background: #f0f0f0;
    border: none;
    padding: 0.2em 0.5em;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.enacast-marker-time:hover {
    background: #e0e0e0;
}

.enacast-marker-name {
    font-weight: 600;
}

.enacast-marker-desc {
    color: #666;
    font-size: 0.9em;
}

/* Schedule */
.enacast-schedule {
    margin: 1em 0;
}

.enacast-schedule-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1em;
}

.enacast-schedule-nav a {
    text-decoration: none;
    color: #333;
    padding: 0.4em 0.8em;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.enacast-schedule-nav a:hover {
    background: #f5f5f5;
}

.enacast-schedule-current {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.enacast-schedule-daterange {
    font-weight: 600;
    font-size: 1.05em;
}

.enacast-schedule-weeknum {
    font-size: 0.8em;
    color: #888;
}

.enacast-schedule-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(140px, 1fr));
    gap: 0;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    overflow-x: auto;
}

.enacast-schedule-day {
    min-height: 100px;
    border-right: 1px solid #e0e0e0;
}

.enacast-schedule-day:nth-child(even) {
    background: #fafafa;
}

.enacast-schedule-day:last-child {
    border-right: none;
}

.enacast-schedule-day-name {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35em;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    margin: 0;
    padding: 0.6em;
    background: #333;
    color: #fff;
}

.enacast-schedule-day-date {
    font-weight: 400;
    opacity: 0.7;
}

.enacast-schedule .enacast-schedule-day-full {
    display: none;
}

.enacast-schedule-entries {
    list-style: none;
    padding: 0;
    margin: 0;
}

.enacast-schedule-entry {
    display: flex;
    gap: 0.5em;
    align-items: flex-start;
    padding: 0.5em;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
    transition: background 0.15s;
}

.enacast-schedule-entry:hover {
    background: rgba(0, 0, 0, 0.03);
}

.enacast-schedule-entry:last-child {
    border-bottom: none;
}

.enacast-schedule-repeat {
    opacity: 0.7;
}

.enacast-schedule-logo {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.enacast-schedule-entry-info {
    display: flex;
    flex-direction: column;
    gap: 0.1em;
    min-width: 0;
}

.enacast-schedule-time {
    font-weight: 600;
    white-space: nowrap;
}

.enacast-schedule-program a {
    text-decoration: none;
    color: inherit;
}

.enacast-schedule-program a:hover {
    text-decoration: underline;
}

.enacast-badge-repeat {
    font-size: 0.7em;
}

.enacast-schedule-empty {
    color: #aaa;
    text-align: center;
    padding: 1em 0.5em;
    font-size: 0.85em;
}

@media (max-width: 768px) {
    .enacast-schedule-grid {
        grid-template-columns: 1fr;
    }

    .enacast-schedule-day {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .enacast-schedule-day:last-child {
        border-bottom: none;
    }

    .enacast-schedule .enacast-schedule-day-abbr {
        display: none;
    }

    .enacast-schedule .enacast-schedule-day-full {
        display: inline;
    }
}

/* Now Playing */
.enacast-now-playing {
    margin: 1em 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.enacast-now-playing-hero img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
}

.enacast-now-playing-current {
    padding: 1.5em;
}

.enacast-now-playing-program {
    display: flex;
    gap: 1.25em;
    align-items: flex-start;
}

.enacast-now-playing-logo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.enacast-now-playing-logo-sm {
    width: 60px;
    height: 60px;
}

.enacast-now-playing-info {
    display: flex;
    flex-direction: column;
    gap: 0.3em;
    min-width: 0;
}

.enacast-now-playing-live {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    background: #dc2626;
    color: #fff;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2em 0.7em;
    border-radius: 999px;
    width: fit-content;
}

.enacast-live-dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: enacast-pulse 1.5s ease-in-out infinite;
}

@keyframes enacast-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.enacast-now-playing-name {
    font-weight: 600;
    font-size: 1.5em;
    margin: 0.1em 0;
    line-height: 1.3;
}

.enacast-now-playing-name a {
    text-decoration: none;
    color: inherit;
}

.enacast-now-playing-name a:hover {
    text-decoration: underline;
}

h2.enacast-now-playing-name {
    font-size: 1.5em;
    margin: 0.1em 0;
}

.enacast-now-playing-name-sm {
    font-size: 1.1em;
}

.enacast-now-playing-time {
    color: #888;
    font-size: 0.9em;
}

.enacast-now-playing-description {
    color: #555;
    font-size: 0.95em;
    line-height: 1.6;
    margin: 0.5em 0 0;
}

.enacast-now-playing-label {
    font-size: 0.85em;
    text-transform: uppercase;
    color: #888;
    margin: 0 0 0.75em;
    letter-spacing: 0.03em;
}

.enacast-now-playing-next {
    padding: 1.25em 1.5em;
    background: #f8f8f8;
    border-top: 1px solid #e0e0e0;
}

.enacast-now-playing-schedule-link {
    display: inline-block;
    font-size: 0.95em;
    font-weight: 500;
    color: #333;
    text-decoration: none;
}

.enacast-now-playing-schedule-link:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .enacast-now-playing-hero img {
        max-height: 200px;
    }

    .enacast-now-playing-current .enacast-now-playing-program {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .enacast-now-playing-logo {
        width: 80px;
        height: 80px;
    }

    h2.enacast-now-playing-name {
        font-size: 1.25em;
    }
}

/* Article single */
.enacast-news-article {
    max-width: 800px;
}

.enacast-article-hero img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1em;
}

.enacast-article-title {
    margin: 0 0 0.25em;
}

.enacast-article-subtitle {
    font-size: 1.1em;
    color: #555;
    margin: 0 0 0.5em;
}

.enacast-article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75em;
    margin-bottom: 1.5em;
    color: #888;
    font-size: 0.9em;
}

.enacast-article-body {
    line-height: 1.7;
}

.enacast-article-body img {
    max-width: 100%;
    height: auto;
}

/* Page content */
.enacast-page-content {
    max-width: 800px;
}

.enacast-page-title {
    margin: 0 0 1em;
}

.enacast-page-body {
    line-height: 1.7;
}

.enacast-page-body img {
    max-width: 100%;
    height: auto;
}

/* Agenda */
.enacast-agenda-dates {
    font-size: 0.85em;
    color: #555;
    margin: 0.5em 0;
}

.enacast-agenda-link {
    display: inline-block;
    margin-top: 0.5em;
    font-size: 0.9em;
}

/* News card: truncate long headlines */
.enacast-news-card .enacast-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Breadcrumb */
.enacast-breadcrumb {
    font-size: 0.9em;
    color: #888;
    margin-bottom: 1em;
}

.enacast-breadcrumb a {
    color: #555;
    text-decoration: none;
}

.enacast-breadcrumb a:hover {
    text-decoration: underline;
}

.enacast-breadcrumb-sep {
    margin: 0 0.4em;
    color: #aaa;
}

.enacast-breadcrumb-current {
    color: #333;
}

/* Back link */
.enacast-back-link {
    margin-bottom: 1em;
}

.enacast-back-link a {
    font-size: 0.9em;
    color: #555;
    text-decoration: none;
}

.enacast-back-link a:hover {
    text-decoration: underline;
}

/* See all link */
.enacast-see-all {
    margin-top: 1em;
}

.enacast-see-all a {
    font-weight: 500;
    text-decoration: none;
    color: #333;
}

.enacast-see-all a:hover {
    text-decoration: underline;
}
