/* Diagonal pattern background */
.pattern-bg {
    background-color: #0f172a;
    /*background-image: repeating-linear-gradient(*/
    /*    45deg,*/
    /*    transparent,*/
    /*    transparent 5px,*/
    /*    rgba(255, 255, 255, 0.03) 10px,*/
    /*    rgba(255, 255, 255, 0.03) 20px*/
    /*);*/
}

/* Hide scrollbar for webkit browsers */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.icon-18{
    width: 70px !important;
    height: 70px !important;
}

.icon-10{
    width: 40px !important;
    height: 40px !important;
}

.cover-frame {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #334155;
}
.cover-frame > svg {
    width: 50%;
    height: 50%;
    color: #94a3b8;
}
.cover-frame > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #334155;
}

[hidden] { display: none !important; }
button:disabled { cursor: wait; opacity: .55; }
[data-refresh-region="episode-player"] button:disabled,
[data-refresh-region="episode-player"] input:disabled { cursor: not-allowed; opacity: .55; }
.ui-modal-panel { max-height: calc(100dvh - 3rem); overflow-y: auto; }
.ui-drawer-overlay { justify-content: flex-end; align-items: stretch; }
.ui-drawer {
    width: min(100%, 28rem); height: 100%; overflow-y: auto;
    animation: ui-drawer-enter .25s ease-out;
}
.ui-drawer-layout { display: flex; flex-direction: column; height: 100%; }
.ui-drawer-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.ui-drawer-actions { flex: none; }
.episode-download-bar { width: 100%; height: .5rem; accent-color: #60a5fa; }
@keyframes ui-drawer-enter { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes ui-drawer-exit { from { transform: translateX(0); } to { transform: translateX(100%); } }
.ui-drawer-overlay.is-closing .ui-drawer { animation: ui-drawer-exit .125s ease-in forwards; }
.ui-drawer-overlay.is-closing, .detail-edit-overlay.is-closing { pointer-events: none; }
.ui-notification-stack {
    position: fixed; right: 1.3rem; bottom: 2rem; z-index: 80;
    display: flex; flex-direction: column-reverse; gap: .75rem;
    width: min(24rem, calc(100vw - 2rem)); pointer-events: none;
}
.ui-drawer-overlay:not([hidden]) ~ #notification-stack .ui-feedback-pending { display: none; }
.ui-notification {
    display: flex; align-items: flex-start; gap: .75rem; pointer-events: auto;
    padding: .75rem 1rem; border: 1px solid; border-radius: .5rem;
    font-size: .875rem; white-space: pre-line; overflow-wrap: anywhere;
    box-shadow: 0 .5rem 1.5rem rgb(15 23 42 / .45);
    animation: ui-notification-enter .18s ease-out;
}
.ui-notification-content { display: flex; align-items: center; flex: 1; flex-wrap: wrap; gap: .6rem; min-width: 0; }
.ui-notification-message { min-width: 0; }
.ui-notification-close { flex: 0 0 auto; color: currentColor; font-size: 1.25rem; line-height: 1; opacity: .8; }
.ui-notification-close:hover, .ui-notification-close:focus-visible { opacity: 1; }
.ui-feedback-error { color: #fecaca; background: #7f1d1d; border-color: #ef4444; }
.ui-feedback-success { color: #bbf7d0; background: #14532d; border-color: #22c55e; }
.ui-feedback-pending { color: #ddd6fe; background: #581c87; border-color: #a855f7; }
.ui-feedback-link { color: inherit; text-decoration: underline; font-weight: 600; }
.ui-spinner {
    display: inline-block; width: 1rem; height: 1rem; flex-shrink: 0;
    border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; animation: ui-spin .8s linear infinite;
}
.episode-submit-button { display: inline-flex; align-items: center; gap: .5rem; }
.episode-submit-icon { display: flex; flex: none; }
.episode-submit-spinner { display: none; }
.htmx-request .episode-submit-spinner, [data-busy="true"] .episode-submit-spinner { display: inline-block; visibility: visible; opacity: 1; }
.htmx-request .episode-submit-icon, [data-busy="true"] .episode-submit-icon { display: none; }
.episode-player-slider { --player-progress: 0%; --player-color: #16a34a; appearance: none; height: .5rem; background: transparent; cursor: pointer; accent-color: var(--player-color); }
.episode-player-slider--downloading { --player-color: #60a5fa; }
.episode-player-slider::-webkit-slider-runnable-track { height: .375rem; border-radius: .25rem; background: linear-gradient(to right, var(--player-color) var(--player-progress), #475569 var(--player-progress)); }
.episode-player-slider::-moz-range-track { height: .375rem; border-radius: .25rem; background: linear-gradient(to right, var(--player-color) var(--player-progress), #475569 var(--player-progress)); }
.episode-player-slider::-webkit-slider-thumb { appearance: none; margin-top: -.25rem; width: .875rem; height: .875rem; border-radius: 50%; background: var(--player-color); }
.episode-player-slider::-moz-range-thumb { width: .875rem; height: .875rem; border: 0; border-radius: 50%; background: var(--player-color); }
[data-refresh-region="episode-player"] .episode-player-slider:disabled { opacity: 1; }
.ui-progress { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; min-width: 0; font-size: .75rem; color: #93c5fd; }
.ui-progress [data-progress-label] { min-width: 0; overflow-wrap: anywhere; }
.ui-progress-track { flex: 1 1 6rem; min-width: 4rem; height: .25rem; border-radius: .25rem; background: #334155; overflow: hidden; }
.ui-progress-bar { height: 100%; background: #60a5fa; transition: width .3s ease; }
.app-shell {
    height: 100vh;
    height: 100dvh;
}
.app-column, .app-breadcrumbs { min-width: 0; }
.breadcrumb-section { display: inline-flex; align-items: center; gap: .5rem; }
.breadcrumb-icon { display: none; }
.mobile-swipe-delete, .mobile-episode-meta { display: none; }
.podcast-list-mobile-add { display: none; }
.page-navigation-feedback { display: none; }
.mobile-navigation { display: none; }
.detail-edit-overlay { display: flex; }
.detail-edit-content { display: contents; }
.rss-confirm-dialog { max-width: min(28rem, calc(100% - 2rem)); }
.rss-confirm-dialog::backdrop { background: rgb(0 0 0 / .5); }
.detail-edit-close, .mobile-detail-actions, .mobile-episode-description { display: none; }
.episode-metadata-edit { display: none; }
.episode-main-content, .podcast-main-content { display: contents; }

@media (max-width: 767px) {
    body.app-page { background-color: #1e293b; }
    body.app-page:has(> .app-shell) { min-height: 0; overflow: hidden; }
    .app-shell { --app-header-height: 3.5rem; }
    .app-shell .app-column { padding-top: var(--app-header-height); }
    .app-shell .detail-edit-overlay { display: none; }
    .app-shell .detail-edit-overlay.is-open {
        display: flex; position: fixed; inset: 0; z-index: 50; height: 100%;
        flex-direction: row; justify-content: flex-end; background: rgb(0 0 0 / .5);
    }
    .detail-edit-overlay > div {
        width: min(100%, 28rem); height: 100%; overflow: hidden;
        padding-block: calc(1.5rem + env(safe-area-inset-top)) 1.5rem;
        padding-inline: calc(1.5rem + env(safe-area-inset-left)) calc(1.5rem + env(safe-area-inset-right));
        border-radius: 0; animation: ui-drawer-enter .25s ease-out;
    }
    .ui-drawer {
        padding-top: env(safe-area-inset-top);
        padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
    }
    .detail-edit-overlay.is-closing > div { animation: ui-drawer-exit .125s ease-in forwards; }
    .detail-edit-heading { display: flex; justify-content: space-between; align-items: flex-start; }
    .detail-edit-overlay .detail-edit-content { display: block; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
    .detail-edit-overlay .detail-edit-actions { flex: none; padding-bottom: max(0px, env(safe-area-inset-bottom)); }
    .detail-edit-overlay .detail-edit-actions { justify-content: flex-end; }
    .app-shell .detail-edit-close { display: inline-flex; align-items: center; justify-content: center; }
    .detail-edit-overlay [data-desktop-detail-action], .desktop-podcast-add { display: none !important; }
    .mobile-detail-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #334155; }
    .episode-download-actions:not(:has(button:not([hidden]))) { display: none; }
    .mobile-detail-actions button { display: inline-flex; align-items: center; justify-content: center; min-width: 2.75rem; min-height: 2.75rem; border-radius: .5rem; background: #334155; font-size: 1.15rem; }
    .mobile-detail-actions button:focus-visible { outline: 2px solid #94a3b8; outline-offset: 2px; }
    .mobile-episode-description { display: block; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #334155; }
    [data-refresh-region="episode-metadata"] { position: relative; padding-right: 4rem; min-height: 3rem; }
    .episode-metadata-edit {
        display: flex; position: absolute; right: 0; bottom: 0; align-items: center; justify-content: center;
        width: 2.75rem; height: 2.75rem; border-radius: .5rem; background: #334155; font-size: 1.15rem;
    }
    .episode-metadata-edit:focus-visible { outline: 2px solid #94a3b8; outline-offset: 2px; }
    .app-shell .episode-summary-card, .app-shell .podcast-summary-card {
        overflow: visible; border: 0; background: transparent;
    }
    .detail-summary-background { display: none; }
    .app-shell .detail-summary-content { padding: 0; }
    .episode-main-content, .podcast-main-content {
        display: block; padding: 1.25rem; border: 1px solid #334155;
        border-radius: .5rem; background: #1e293b;
    }
    .podcast-main-content { order: 0; }
    .podcast-summary-card .mobile-detail-actions { order: 1; }
    .podcast-detail-metadata { order: 2; }
    .podcast-main-content .line-clamp-3 { -webkit-line-clamp: unset; overflow: visible; }
    .app-shell .podcast-summary-card { overflow: hidden; border: 1px solid #334155; background: #1e293b; }
    .podcast-summary-card .detail-summary-background { display: block; }
    .app-shell .podcast-summary-card .detail-summary-content { padding: 1.5rem; }
    .podcast-summary-card .podcast-main-content { display: contents; }
    .podcast-summary-card .podcast-detail-metadata { order: 0; }
    .podcast-summary-card .mobile-detail-actions { order: 1; flex-wrap: nowrap; }
    .podcast-summary-card .mobile-detail-actions .mobile-add-episode {
        flex: 1 1 auto; gap: .5rem; background: #16a34a; color: white;
        padding: .5rem; font-size: 1rem; font-weight: 600; white-space: nowrap;
    }
    .podcast-summary-card .mobile-detail-actions .mobile-add-episode:hover { background: #15803d; }
    .app-shell .app-sidebar { display: none; }
    .app-shell .app-header {
        position: fixed;
        inset: 0 0 auto;
        z-index: 20;
        height: var(--app-header-height);
        padding: .375rem 1rem;
        background: #1e293b;
    }
    .app-shell .app-header-actions { flex: none; gap: .25rem; margin-left: .5rem; }
    .app-header-actions [data-refresh-region="app-statistics"],
    .app-header-divider, .app-user-name { display: none; }
    .app-breadcrumbs { overflow: hidden; }
    .app-breadcrumbs nav { min-width: 0; white-space: nowrap; overflow: hidden; }
    .app-breadcrumbs nav > svg { flex: none; }
    .app-breadcrumbs nav > a, .app-breadcrumbs nav > span {
        min-width: 0; overflow: hidden; text-overflow: ellipsis;
    }
    .app-breadcrumbs .breadcrumb-section { flex: none; overflow: visible; }
    .app-breadcrumbs .breadcrumb-icon { display: inline-flex; }
    .app-breadcrumbs .breadcrumb-label {
        position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
        overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
    }
    .app-shell .app-main { min-height: 0; overscroll-behavior-y: contain; }
    .app-shell .app-main-content { padding: 1rem; overflow-wrap: anywhere; }
    .mobile-navigation {
        display: flex; flex: none; justify-content: space-around;
        background: #1e293b; border-top: 1px solid #334155;
        padding: .25rem .25rem max(.25rem, env(safe-area-inset-bottom));
    }
    .mobile-navigation a {
        display: flex; flex: 1 1 0; min-width: 0; min-height: 3rem;
        align-items: center; justify-content: center; flex-direction: column;
        gap: .125rem; border-radius: .5rem; color: #cbd5e1;
        font-size: .6875rem; line-height: 1rem; text-decoration: none;
    }
    .mobile-navigation a[aria-current="page"] { background: #334155; color: #fff; }
    .mobile-navigation a:focus-visible { outline: 2px solid #94a3b8; outline-offset: -2px; }
    .mobile-navigation a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .page-navigation-feedback {
        position: fixed; inset: 0; z-index: 100;
        display: grid; place-items: center; pointer-events: none;
        color: #f8fafc; background: rgb(15 23 42 / .45);
        -webkit-backdrop-filter: blur(3px);
        backdrop-filter: blur(3px);
        animation: page-navigation-enter .15s ease-out;
    }
    .page-navigation-feedback .ui-spinner { width: 1.75rem; height: 1.75rem; }
    .app-shell .episode-card-content, .app-shell .podcast-card-content, .app-shell .overview-podcast-content { flex-direction: column; gap: .75rem; }
    .app-shell .episode-card-controls { align-items: flex-start; width: 100%; gap: .5rem; }
    .episode-card-controls > .flex { flex-wrap: wrap; }
    .episode-card-controls button, .podcast-card-content button, .overview-podcast-content button {
        min-width: 2.75rem; min-height: 2.75rem;
    }
    /* Let the controls occupy the trailing edge without squeezing the text. */
    .app-shell .episode-card-content,
    .app-shell .podcast-card-content,
    .app-shell .overview-podcast-content { flex-direction: row; gap: 0; }
    .app-shell .card-actions-overlay {
        position: relative; z-index: 1; flex: 0 0 3.25rem; width: 3.25rem;
        margin-left: -3.25rem; align-self: stretch; align-items: center;
        justify-content: center; gap: .375rem;
        background: linear-gradient(to right, transparent, #1e293b 35%);
    }
    .app-shell .episode-card-controls > .flex { flex-direction: column; gap: .375rem; }
    .episode-card-content h3, .podcast-card-content h3, .overview-podcast-content h3 { padding-right: 3.25rem; }
    .card-description {
        -webkit-mask-image: linear-gradient(to right, #000 60%, transparent 100%);
        mask-image: linear-gradient(to right, #000 60%, transparent 100%);
    }
    .app-shell .podcast-card-metadata, .episode-card-metadata > :not(.episode-card-duration) { display: none; }
    .episode-card-status { margin-top: .375rem; padding-right: 3.25rem; }
    .app-shell .overview-podcast-content { min-height: 70px; }
    .app-shell .podcast-card-content { min-height: 70px; }
    .app-shell .overview-podcast-content .card-actions-overlay button,
    .app-shell .podcast-card-content .podcast-list-mobile-add {
        display: flex; align-items: center; justify-content: center;
    }
    .app-shell .podcast-card-content .podcast-list-desktop-delete { display: none; }
    .app-shell .overview-podcast-content .card-description,
    .app-shell .podcast-card-content .card-description {
        -webkit-mask-image: linear-gradient(to right, #000 45%, transparent 85%);
        mask-image: linear-gradient(to right, #000 45%, transparent 85%);
    }
    [data-swipe-episode] { position: relative; touch-action: pan-y; }
    [data-swipe-episode] .episode-card-swipe-content {
        position: relative; background: #1e293b; transition: transform .2s ease;
    }
    [data-swipe-episode].swipe-open .episode-card-swipe-content { transform: translateX(-4.5rem); }
    [data-swipe-episode] .mobile-swipe-delete {
        display: flex; position: absolute; right: 0; top: 0; bottom: 0; width: 4.5rem;
        align-items: center; justify-content: center; background: #dc2626; color: white;
        visibility: hidden; pointer-events: none;
    }
    [data-swipe-episode].swipe-open .mobile-swipe-delete { visibility: visible; pointer-events: auto; }
    [data-swipe-episode] .mobile-episode-meta {
        display: flex; align-items: center; gap: .3rem;
        margin-top: .25rem; font-size: .75rem; color: #94a3b8; white-space: nowrap;
    }
    [data-swipe-episode] .mobile-status-published, [data-swipe-episode] .mobile-status-error { display: none; }
    [data-swipe-episode][data-status="PUBLISHED"] .mobile-status-published { display: inline; color: #4ade80; }
    [data-swipe-episode][data-status="ERROR"] .mobile-status-error { display: inline; color: #f87171; }
    [data-swipe-episode] .card-description, [data-swipe-episode] .episode-card-metadata,
    [data-swipe-episode] .episode-card-status,
    [data-swipe-episode] [data-action="edit-episode"],
    [data-swipe-episode] [data-action="cancel-episode"],
    [data-swipe-episode] .episode-card-controls [data-action="delete-episode"] { display: none !important; }
    [data-swipe-episode] .episode-card-content h3 {
        font-size: 1rem; line-height: 1.25; font-weight: 400; padding-right: 0; overflow: hidden; display: -webkit-box;
        -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    }
    [data-swipe-episode]:has(.episode-card-controls [data-action="download-episode"]:not([hidden])) .episode-card-content h3 {
        -webkit-mask-image: linear-gradient(to right, #000 60%, transparent 100%);
        mask-image: linear-gradient(to right, #000 60%, transparent 100%);
    }
    .app-shell [data-swipe-episode] .episode-card-controls { flex: 0 0 3.25rem; width: 3.25rem; }
    [data-swipe-episode] .episode-card-controls [data-action="download-episode"] { display: flex; align-items: center; justify-content: center; }
    [data-swipe-episode] .episode-card-controls:not(:has([data-action="download-episode"]:not([hidden]))) { display: none; }
    .ui-notification-stack {
        bottom: max(calc(4rem + env(safe-area-inset-bottom)), calc(var(--modal-footer-height, 0px) + .75rem));
        right: calc(1rem + env(safe-area-inset-right));
        width: min(24rem, calc(100vw - 2rem - env(safe-area-inset-left) - env(safe-area-inset-right)));
    }
    .ui-drawer .ui-drawer-actions { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
}

@media (max-width: 360px) {
    .app-shell .app-notifications-button { display: none; }
    .app-shell .app-main-content { padding: .75rem; }
    [data-episode-card] .icon-18, [data-podcast-card] .icon-18 { width: 56px !important; height: 56px !important; }
    .app-shell .overview-podcast-content { min-height: 56px; }
    .app-shell .podcast-card-content { min-height: 56px; }
}
@keyframes ui-spin { to { transform: rotate(360deg); } }
@keyframes ui-notification-enter { from { opacity: 0; transform: translateY(1rem); } }
@keyframes page-navigation-enter { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .ui-spinner, .ui-notification, .ui-drawer,
    .ui-drawer-overlay.is-closing .ui-drawer, .detail-edit-overlay > div,
    .detail-edit-overlay.is-closing > div, .page-navigation-feedback { animation: none; }
    .ui-progress-bar { transition: none; }
    .episode-card-swipe-content { transition: none; }
}
