/* PodSmoker - Minimalist styles */

:root {
    --ps-primary: #333;
    --ps-muted: #6c757d;
    --ps-orange: #FF9636;
    --ps-orange-light: #FFB366;
    --ps-orange-dark: #E6842E;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--ps-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Local dev indicator - pink background when running on localhost */
body.ps-localhost {
    background-color: #fde8f4;
}

.navbar-brand {
    font-weight: 600;
}

/* Top nav - orange from hero graphic (#FF9636) */
.ps-navbar-orange {
    background-color: #FF9636 !important;
    border-bottom-color: rgba(0, 0, 0, 0.15) !important;
}
.ps-navbar-orange .nav-link,
.ps-navbar-orange .navbar-brand {
    color: rgba(0, 0, 0, 0.85) !important;
}
/* Align right-side nav items (language, separator, login) on same baseline */
.ps-navbar-orange .navbar-nav.ms-auto {
    align-items: center;
}
.ps-navbar-orange .navbar-nav.ms-auto .nav-item {
    display: flex;
    align-items: center;
}
.ps-navbar-orange .navbar-nav.ms-auto .nav-link {
    display: inline-flex;
    align-items: center;
    line-height: 1.5;
}
.ps-navbar-orange .nav-pipe-separator .nav-link {
    padding-top: 0;
    padding-bottom: 0;
}
/* Pipe separator alignment - desktop only; mobile hides pipes below 992px */
@media (min-width: 992px) {
    .ps-navbar-orange .navbar-nav {
        align-items: center;
    }
    .ps-navbar-orange .nav-pipe-separator {
        display: flex;
        align-items: center;
    }
    .ps-navbar-orange .nav-pipe-separator .nav-link {
        line-height: 1;
        display: inline-flex;
        align-items: center;
    }
}
.ps-navbar-orange .nav-link:hover,
.ps-navbar-orange .navbar-brand:hover {
    color: rgba(0, 0, 0, 1) !important;
}
.ps-navbar-orange .nav-link.disabled {
    color: rgba(0, 0, 0, 0.5) !important;
}
.ps-navbar-orange .ps-mobile-nav-actions {
    margin-left: auto;
}
.ps-navbar-orange #nav-link-notifications {
    position: relative;
    justify-content: center;
    min-width: 2.5rem;
}
.ps-navbar-orange #nav-link-notifications-mobile {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.5rem 0.6rem;
}
.ps-navbar-orange .ps-nav-bell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
}
.ps-navbar-orange .ps-nav-notification-badge {
    position: absolute;
    top: 0.2rem;
    right: 0.15rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    line-height: 1;
}
.ps-navbar-orange .dropdown-toggle::after {
    border-top-color: rgba(0, 0, 0, 0.7);
}
.ps-navbar-orange .navbar-toggler {
    border-color: rgba(0, 0, 0, 0.3);
}
.ps-navbar-orange .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(0, 0, 0, 0.7)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Podcast player buttons - gradient shades from nav orange */
.ps-player-links .ps-player-btn {
    background: linear-gradient(135deg, var(--ps-orange-light) 0%, var(--ps-orange) 50%, var(--ps-orange-dark) 100%);
    border: 1px solid var(--ps-orange-dark);
    color: rgba(0, 0, 0, 0.9);
    font-weight: 500;
}
.ps-player-links .ps-player-btn:hover {
    background: linear-gradient(135deg, var(--ps-orange) 0%, var(--ps-orange-dark) 100%);
    border-color: var(--ps-orange-dark);
    color: rgba(0, 0, 0, 1);
}

/* Nav avatar dropdown */
.nav-avatar-wrapper img {
    object-fit: cover;
}
.nav-avatar-dropdown .dropdown-toggle::after {
    margin-left: 0.35rem;
}

/* Episodes/Users/etc filters - collapsible on mobile, always visible on desktop */
@media (min-width: 992px) {
    #episodes-filters-collapse,
    #users-filters-collapse,
    .search-filter-collapse {
        display: block !important;
    }
}
.episodes-filters-toggle-icon {
    transition: transform 0.2s ease;
}
button[data-bs-toggle="collapse"][aria-expanded="true"] .episodes-filters-toggle-icon {
    transform: rotate(180deg);
}

/* Official description foldable - chevron rotates when expanded */
.official-desc-chevron {
    transition: transform 0.2s ease;
}
button[data-bs-toggle="collapse"][aria-expanded="true"] .official-desc-chevron {
    transform: rotate(90deg);
}

/* Placeholder for graphics */
.placeholder-graphic {
    background: #f0f0f0;
    border: 1px dashed #ccc;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ps-muted);
}

/* Mobile nav: hide pipe separators, left-align Admin/language/avatar */
@media (max-width: 991.98px) {
    .nav-pipe-separator {
        display: none;
    }
    .ps-navbar-orange .navbar-nav.ms-auto {
        margin-inline-start: 0 !important;
        align-items: flex-start;
    }
    .ps-navbar-orange .navbar-toggler {
        margin-left: 0.25rem;
    }
}

/* Responsive */
@media (max-width: 767.98px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .hero-viewport {
        max-height: 110px;
        height: 110px;
    }
    .hero-viewport .hero-image {
        max-height: 110px !important;
    }
    /* Stack definition lists vertically on small screens */
    .dl-responsive dt,
    .dl-responsive dd {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .dl-responsive dt {
        padding-top: 0.5rem;
        border-top: 1px solid #eee;
    }
    .dl-responsive dt:first-child {
        padding-top: 0;
        border-top: none;
    }
    /* Compact arrow line on mobile */
    .episode-list-line-3 {
        line-height: 1;
        margin-top: -0.25rem;
    }
}
@media (min-width: 768px) {
    .w-md-auto {
        width: auto !important;
    }
}
/* Prevent long text from breaking layout */
.table td,
.table th {
    word-wrap: break-word;
}
/* Fluid images in content */
.img-fluid {
    max-width: 100%;
    height: auto;
}

/* Hero image viewport - draggable for admins. Fixed aspect-ratio ensures viewport never collapses so lock stays in place. */
.hero-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 600/158;
    min-height: 120px;
    max-height: 300px;
    overflow: hidden;
}
.hero-viewport .hero-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* Mobile portrait & landscape: same ratio as Hero Images tab (600:158) so drag-saved position matches */
@media (orientation: portrait) and (max-width: 768px) {
    .hero-viewport {
        max-height: none;
    }
}
@media (orientation: landscape) and (max-height: 500px) {
    .hero-viewport {
        max-height: none;
    }
}
.hero-viewport[data-draggable="true"][data-unlocked="true"] {
    cursor: grab;
}
.hero-viewport[data-draggable="true"][data-unlocked="true"].dragging {
    cursor: grabbing;
}
.hero-lock-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 10;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.375rem;
    cursor: pointer;
    color: #333;
}
.hero-lock-btn:hover {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.3);
}
.hero-lock-icon--locked {
    opacity: 0.8;
}
.hero-lock-icon--unlocked {
    opacity: 1;
}
.hero-viewport .hero-image {
    display: block;
}

/* Podcast autocomplete dropdown */
.podcast-autocomplete-dropdown {
    z-index: 1050;
    max-height: 200px;
    overflow-y: auto;
}

/* FromTo - noUiSlider dual-handle range */
.fromto-nouislider {
    padding: 0 0.5rem;
}
.fromto-nouislider .noUi-connect {
    background: var(--bs-primary);
}
.fromto-nouislider .noUi-handle {
    border-color: var(--bs-primary);
    background: var(--bs-primary);
}
.fromto-nouislider .noUi-handle:after,
.fromto-nouislider .noUi-handle:before {
    background: var(--bs-primary);
}
.fromto-nouislider .noUi-tooltip {
    font-size: 0.875rem;
}

/* FromTo visualization on episode detail */
.fromto-visualization {
    min-height: 48px;
    padding-left: 10px;
    padding-right: 10px;
}
.fromto-visualization .fromto-track-full {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
}
.fromto-visualization .fromto-highlight {
    transition: left 0.2s, width 0.2s;
}
.fromto-visualization .fromto-time-start,
.fromto-visualization .fromto-time-end {
    z-index: 2;
    pointer-events: none;
}
.fromto-visualization .fromto-label-bubble {
    line-height: 1.3;
    max-width: 280px;
}

/* Episode list item - prevent img baseline gap that creates extra vertical space */
.episode-list-img {
    display: block;
    vertical-align: bottom;
}

/* Episode rating - grayed-out headphones for ratings below 5 */
.episode-rating-grayed {
    opacity: 0.4;
}

/* Mobile: review categories - ensure visible and touch-friendly (min 44px tap target) */
@media (max-width: 767.98px) {
    .review-categories-mobile {
        scroll-margin-top: 1rem; /* helps scroll-into-view when focusing */
    }
    .review-categories-mobile .review-cat-select,
    .review-categories-mobile .review-cat-input {
        min-height: 44px;
        font-size: 16px; /* prevents iOS zoom on focus */
    }
    .review-categories-mobile .card {
        border-width: 1px;
    }
}

/* Reusable search/filter grid - used by Episodes, Podcasts, etc. */
.search-filter-grid,
.episodes-page-grid {
    display: grid;
    grid-template-columns: min-content repeat(5, auto) 1fr;
    width: 100%;
    min-height: 38px; /* match Bootstrap form-control/form-select height */
}
.search-filter-col,
.episodes-col {
    min-height: 0;
}
.search-filter-keyword,
.episodes-keyword-input {
    width: 10rem;
    max-width: 100%;
}
@media (min-width: 992px) {
    .search-filter-grid,
    .episodes-page-grid {
        align-items: center;
    }
    .search-filter-col,
    .episodes-col {
        display: flex;
        align-items: center;
        padding-left: 2px;
        padding-right: 2px;
    }
    .search-filter-col:first-child,
    .episodes-col:first-child {
        padding-left: 0;
    }
    .search-filter-col:last-child,
    .episodes-col:last-child {
        padding-right: 0;
        padding-left: 10px;
    }
}

@media (max-width: 991.98px) {
    .search-filter-grid,
    .episodes-page-grid {
        grid-template-columns: 1fr;
    }
    .search-filter-col,
    .episodes-col {
        padding-top: 2px;
        padding-bottom: 2px;
    }
    .search-filter-col:first-child,
    .episodes-col:first-child {
        padding-top: 0;
    }
    .search-filter-col:last-child,
    .episodes-col:last-child {
        padding-bottom: 0;
        padding-top: 5px;
    }
    .search-filter-keyword,
    .episodes-keyword-input {
        width: 100%;
    }
}
@media (max-width: 991.98px) and (orientation: landscape) {
    .search-filter-grid,
    .episodes-page-grid {
        align-items: center;
    }
    .search-filter-col,
    .episodes-col {
        display: flex;
        align-items: center;
    }
}

/* Search filter collapse - same as episodes */
.search-filter-toggle-icon,
.episodes-filters-toggle-icon {
    transition: transform 0.2s ease;
}
button[data-bs-toggle="collapse"][aria-expanded="true"] .search-filter-toggle-icon,
button[data-bs-toggle="collapse"][aria-expanded="true"] .episodes-filters-toggle-icon {
    transform: rotate(180deg);
}

/* Reusable pagination nav - visible and touch-friendly on mobile */
.pagination-nav {
    min-height: 44px;
}
.pagination-nav .btn {
    min-height: 38px;
    min-width: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
@media (max-width: 767.98px) {
    .pagination-nav {
        padding-bottom: 1rem !important; /* extra space above footer */
    }
    .pagination-nav-pages {
        min-width: 0; /* allow flex shrink for overflow scroll */
    }
}

/* List list item: force mobile layout (admin below) until lg breakpoint (992px).
   Mobile landscape (~667px) would otherwise show desktop layout due to viewport width. */
@media (max-width: 991.98px) {
    .list-list-item-row > a.flex-grow-1 {
        flex-basis: 100%;
        max-width: 100%;
    }
    .list-item-admin-row {
        padding-top: 0.5rem;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }
}

/* Home page tagline */
.home-tagline {
    font-size: 16px;
    white-space: pre-wrap;
}
@media (min-width: 768px) {
    .home-tagline { font-size: 18px; }
}

.ps-lang-flag {
    display: inline-block;
    width: 1.25rem;
    height: 0.85rem;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    vertical-align: middle;
}

#nav-lang-switch {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
    position: relative;
    top: 2px;
}

@media (max-width: 991.98px) {
    .ps-navbar-orange #nav-lang-switch {
        padding-left: 0;
        min-height: 1.5rem;
        justify-content: flex-start;
        top: 5px;
        left: -3px;
    }
}

.ps-lang-flag--de {
    background: linear-gradient(
        to bottom,
        #000000 0 33.33%,
        #dd0000 33.33% 66.66%,
        #ffce00 66.66% 100%
    );
}

.ps-lang-flag--us {
    background-image:
        linear-gradient(#3c3b6e, #3c3b6e),
        repeating-linear-gradient(
            to bottom,
            #b22234 0 7.69%,
            #ffffff 7.69% 15.38%
        );
    background-size: 40% 53.85%, 100% 100%;
    background-position: top left, 0 0;
    background-repeat: no-repeat;
}

/*
 * Home (mobile): #home-intro-section uses .mb-5; when the intro blurb is collapsed, that leaves a large
 * gap under “Show intro” before the Lists heading. Tighten only in that state.
 * (.mb-5 uses !important in Bootstrap utilities, so override must too.)
 */
@media (max-width: 991.98px) {
    #home-intro-section:has(#home-intro-collapse:not(.show)) {
        margin-bottom: 1rem !important;
    }
}

/* Home section “last updated”: match list/episode row title size (1rem), lighter grey, not bold */
.home-section-heading-wrap .home-section-freshness,
.home-section-heading-wrap .home-section-freshness time {
    font-size: 1rem;
    font-weight: 400;
    color: #8f8f8f;
}

/* Episodes list page: same last-updated typography as home sections */
#episodes-list-freshness-desktop.home-section-freshness,
#episodes-list-freshness-desktop.home-section-freshness time,
#episodes-list-freshness-mobile.home-section-freshness,
#episodes-list-freshness-mobile.home-section-freshness time,
#podcasts-list-freshness-desktop.home-section-freshness,
#podcasts-list-freshness-desktop.home-section-freshness time,
#podcasts-list-freshness-mobile.home-section-freshness,
#podcasts-list-freshness-mobile.home-section-freshness time,
#lists-list-freshness-desktop.home-section-freshness,
#lists-list-freshness-desktop.home-section-freshness time,
#lists-list-freshness-mobile.home-section-freshness,
#lists-list-freshness-mobile.home-section-freshness time {
    font-size: 1rem;
    font-weight: 400;
    color: #8f8f8f;
}

/* Per-episode “last updated”: same classes as metadata row in fragment (.text-muted.small); no extra font rules */

/*
 * Page title row: h1 + “(last updated …)” on lg+.
 * Use flex align-items:center so the small line is vertically centered with the heading’s line box
 * (plain d-lg-flex + align-items-lg-center can look top-heavy next to .h1).
 */
.ps-page-title-freshness-wrap {
    min-width: 0;
    flex-grow: 1;
}

@media (min-width: 992px) {
    .ps-page-title-freshness-wrap {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.5rem;
    }

    /* Optical nudge down — same as home section headings, +10px vs 0.28em-only baseline */
    .ps-page-title-freshness-wrap .home-section-freshness {
        padding-top: calc(0.28em + 10px);
        line-height: 1.25;
    }

    .home-section-heading-wrap .home-section-freshness {
        padding-top: 0.28em;
    }
}

/* Admin Quick Add Smoke: full-page loading overlay while live tests run */
#quick-add-smoke-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(33, 37, 41, 0.55);
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}
#quick-add-smoke-overlay.d-none {
    display: none !important;
}
#quick-add-smoke-overlay.is-visible {
    display: flex !important;
}

/* Cookie / privacy banner (necessary cookies only; see Datenschutz) */
.ps-cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
}
.ps-cookie-banner p {
    color: var(--ps-primary);
}
.ps-cookie-banner a {
    color: var(--ps-orange-dark);
    font-weight: 500;
}
.ps-cookie-banner a:hover {
    color: var(--ps-primary);
}

/* Admin home: drag handles (SortableJS) */
.ps-home-drag-handle {
    cursor: grab;
    touch-action: none;
    /* Above Bootstrap .stretched-link::after (z-index: 1) on the same row */
    position: relative;
    z-index: 2;
}
.ps-home-drag-handle:active {
    cursor: grabbing;
}
