/* ========================================
   FM Radio Plugin — Frontend Styles
   Kösedağ Yazılım
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --fmr-bg: #f0f4f8;
    --fmr-card-bg: #ffffff;
    --fmr-border: #e2e8f0;
    --fmr-title: #1a202c;
    --fmr-desc: #718096;
    --fmr-accent: #4f6ef7;
    --fmr-accent-h: #3a55d9;
    --fmr-track-h: #f7f9fc;
    --fmr-player-bg: #1a202c;
    --fmr-player-fg: #ffffff;
    --fmr-radius: 12px;
    --fmr-shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .05);
    --fmr-shadow-h: 0 8px 24px rgba(0, 0, 0, .12);
    --fmr-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Wrap ── */
.fmradio-wrap {
    font-family: var(--fmr-font);
    color: var(--fmr-title);
    box-sizing: border-box;
    padding-bottom: 220px;
    /* player için alan */
    max-width: 1200px;
    margin: 0 auto;
}

/* Progress Capsules (Image 1) */
.fmradio-progress-capsules {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 10px 4px 20px;
    margin-bottom: 20px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--fmr-accent) transparent;
}

.fmradio-progress-capsules::-webkit-scrollbar {
    height: 6px;
    display: block;
}

.fmradio-progress-capsules::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.fmradio-progress-capsules::-webkit-scrollbar-thumb {
    background: var(--fmr-accent);
    border-radius: 10px;
}

.fmradio-capsule {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--fmr-border);
    border-radius: 16px;
    padding: 8px 16px 8px 8px;
    min-width: 140px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.fmradio-capsule:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(79, 110, 247, 0.1);
    border-color: var(--fmr-accent);
}

.fmradio-capsule.active {
    background: #ebf4ff;
    border-color: var(--fmr-accent);
    box-shadow: 0 4px 12px rgba(79, 110, 247, 0.15);
}

.fmradio-capsule.active .fmradio-capsule-count {
    color: var(--fmr-accent);
}

.fmradio-capsule-thumb {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    background: #f0f4f8;
    margin-right: 12px;
    border: 1px solid #fff;
    flex-shrink: 0;
}

.fmradio-capsule-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fmradio-capsule-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0; /* allows text to truncate */
}

.fmradio-capsule-title {
    font-size: 11px;
    font-weight: 700;
    color: #2c5282;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fmradio-capsule-stats {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 2px;
}

.fmradio-capsule-count,
.fmradio-capsule-pct {
    font-size: 10px;
    color: #4a5568;
}

.fmradio-wrap *,
.fmradio-wrap *::before,
.fmradio-wrap *::after {
    box-sizing: inherit;
}

.fmradio-empty {
    padding: 20px;
    color: var(--fmr-desc);
    font-family: var(--fmr-font);
}

/* ── Filter Row ── */
.fmradio-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 15px;
}

.fmradio-filter-wrapper {
    position: relative;
    min-width: 200px;
    z-index: 999;
}

.fmradio-custom-select {
    position: relative;
    user-select: none;
    cursor: pointer;
}

.fmradio-select-trigger {
    background: #fff;
    border: 1px solid var(--fmr-border);
    padding: 10px 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.fmradio-select-trigger:hover {
    border-color: var(--fmr-accent);
    box-shadow: 0 4px 12px rgba(79, 110, 247, 0.1);
}

.fmradio-custom-select.is-open .fmradio-select-trigger {
    border-color: var(--fmr-accent);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.fmradio-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--fmr-border);
    border-top: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
}

.fmradio-custom-select.is-open .fmradio-select-options {
    display: block;
}

.fmradio-option {
    padding: 10px 16px;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.fmradio-option:hover {
    background: #f7fafc;
    color: var(--fmr-accent);
}

.fmradio-option.active {
    background: #ebf4ff;
    color: var(--fmr-accent);
    font-weight: 700;
}

/* ── Section Title ── */
.fmradio-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fmr-title);
    margin: 0;
    padding: 0;
}

/* ── Grid ── */
.fmradio-grid {
    display: grid;
    gap: 14px;
    align-items: start;
    margin-bottom: 65px;
    /* Kartların boyunun senkronize olmasını engeller (Image 4 fix) */
}

.fmradio-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.fmradio-grid-1 {
    grid-template-columns: 1fr;
}

/* ── Card ── */
.fmradio-card {
    background: var(--fmr-card-bg);
    border: 1px solid var(--fmr-border);
    border-radius: var(--fmr-radius);
    overflow: hidden;
    box-shadow: var(--fmr-shadow);
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fmradio-card:hover {
    box-shadow: var(--fmr-shadow-h);
}

.fmradio-card.is-open {
    border-color: var(--fmr-accent);
}

/* ── Card Header ── */
.fmradio-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.fmradio-card-radyo .fmradio-card-header {
    cursor: default;
}

/* ── Thumbnail ── */
.fmradio-thumb-wrap {
    position: relative;
    flex-shrink: 0;
}

.fmradio-thumb {
    width: 110px;
    height: 110px;
    border-radius: 12px;
    object-fit: cover;
    display: block;
}

.fmradio-thumb-placeholder {
    width: 110px;
    height: 110px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f6ef7 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.fmradio-live-badge {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: .05em;
    padding: 1px 6px;
    border-radius: 99px;
    white-space: nowrap;
}

/* ── Card Info ── */
.fmradio-card-info {
    flex: 1;
    min-width: 0;
}

.fmradio-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--fmr-title);
    line-height: 1.3;
    margin-bottom: 6px;
}

.fmradio-card-desc {
    font-size: 0.85rem;
    color: var(--fmr-desc);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Chevron ── */
.fmradio-chevron {
    flex-shrink: 0;
    color: var(--fmr-desc);
    margin-top: 4px;
    transition: transform .3s ease;
}

.fmradio-card.is-open .fmradio-chevron {
    transform: rotate(180deg);
    color: var(--fmr-accent);
}

/* ── Radyo card actions (share icons) ── */
.fmradio-card-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.fmradio-share-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--fmr-track-h);
    cursor: pointer;
    transition: background .2s;
    text-decoration: none;
}

.fmradio-share-icon:hover {
    background: var(--fmr-border);
}

/* ── Accordion body ── */
.fmradio-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .4s cubic-bezier(.4, 0, .2, 1);
}

.fmradio-card.is-open .fmradio-accordion-body {
    max-height: 560px;
}

/* Expanded View Header Meta (Image 3) */
.fmradio-expanded-header {
    background: #fff;
    padding: 12px 14px;
    border-bottom: 1px solid var(--fmr-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.fmradio-meta-row {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--fmr-desc);
}

.fmradio-meta-item strong {
    color: var(--fmr-title);
}

/* Toolbar Position (Image 2 & 4) */
.fmradio-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fmradio-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #4f6ef7;
    /* İkon rengi */
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.fmradio-tool-btn svg {
    display: block;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.fmradio-tool-btn:hover,
.fmradio-tool-btn:focus {
    background: #f7fafc;
    border-color: #90a2f5;
    color: #90a2f5;
    transform: scale(1.05);
}

.fmradio-tool-btn.active {
    background: #728af8;
    color: #fff;
    border-color: #728af8;
}

/* ── Share popup ── */
.fmradio-share-popup {
    position: absolute;
    top: 42px;
    left: 14px;
    background: #fff;
    border: 1px solid var(--fmr-border);
    border-radius: 10px;
    box-shadow: var(--fmr-shadow-h);
    z-index: 200;
    padding: 6px 0;
    min-width: 160px;
}

.fmradio-share-popup a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: .85rem;
    color: var(--fmr-title);
    text-decoration: none;
    transition: background .15s;
}

.fmradio-share-popup a:hover {
    background: var(--fmr-track-h);
}

/* ── Info popup ── */
.fmradio-info-popup {
    padding: 10px 14px;
    background: #f0f7ff;
    border-top: 1px solid #bee3f8;
    font-size: .85rem;
    color: #2b6cb0;
    line-height: 1.55;
}

/* ── Track list ── */
.fmradio-track-list {
    max-height: 340px;
    overflow-y: scroll;
    border-top: 1px solid var(--fmr-border);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
    -webkit-overflow-scrolling: touch;
}

.fmradio-track-list::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    display: block !important;
}

.fmradio-track-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}

.fmradio-track-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.fmradio-track-list::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ── Track item ── */
.fmradio-track-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    cursor: pointer;
    transition: background .2s;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "name dur" "meta meta";
    gap: 4px;
}

.fmradio-track-item:hover,
.fmradio-track-item.active,
.fmradio-track-item.is-playing {
    background: rgba(var(--fmr-accent-rgb, 79, 110, 247), .12);
    border-left: 3px solid var(--fmr-accent);
    box-shadow: inset 4px 0 0 -1px var(--fmr-accent);
}

.fmradio-track-item.is-playing .fmradio-track-name {
    color: var(--fmr-accent);
}

.fmradio-track-name {
    grid-area: name;
    font-weight: 600;
    color: var(--fmr-title);
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fmradio-track-duration {
    grid-area: dur;
    color: #718096;
    font-size: .85rem;
    text-align: right;
}

.fmradio-track-meta-row {
    grid-area: meta;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
}

.fmradio-track-episode,
.fmradio-track-date {
    font-size: 11px;
    color: var(--fmr-desc);
    display: inline-block;
}

.fmradio-track-duration {
    grid-column: 2;
    grid-row: 1;
    font-size: .8rem;
    color: var(--fmr-desc);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fmradio-track-episode {
    grid-column: 1;
    grid-row: 2;
    font-size: .78rem;
    color: var(--fmr-desc);
}

.fmradio-track-date {
    grid-column: 2;
    grid-row: 2;
    font-size: .78rem;
    color: var(--fmr-desc);
    white-space: nowrap;
}

/* ── Loading spinner ── */
.fmradio-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.fmradio-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--fmr-border);
    border-top-color: var(--fmr-accent);
    border-radius: 50%;
    animation: fmrSpin .7s linear infinite;
}

@keyframes fmrSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Sort active ── */
.fmradio-sort-btn.sort-active {
    color: var(--fmr-accent);
}

/* ───────────────────────────────────────
   PLAYER (sticky footer)
─────────────────────────────────────── */
.fmradio-player {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 99999;
    background: var(--fmr-player-bg);
    color: var(--fmr-player-fg);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, .3);
    font-family: var(--fmr-font);
    transition: transform 0.3s ease, opacity 0.3s ease;
    padding-bottom: calc(env(safe-area-inset-bottom, 0) + 15px);
}

.fmradio-player-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 12px 20px;
}

/* ── Player rows ── */
.fmradio-player-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fmradio-player-row1 {
    padding-bottom: 6px;
}

.fmradio-player-row2 {
    gap: 8px;
    margin-bottom: 12px;
}

.fmradio-player-row3 {
    justify-content: center;
    gap: 4px;
    padding-top: 6px;
}

/* ── Thumb ── */
.fmradio-player-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #2d3748;
}

/* ── Meta ── */
.fmradio-player-meta {
    flex: 1;
    min-width: 0;
}

.fmradio-player-channel {
    font-size: .75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fmradio-player-track {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Player buttons ── */
.fmradio-p-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--fmr-player-fg);
    cursor: pointer;
    border-radius: 8px;
    padding: 8px;
    transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.fmradio-p-btn:hover {
    background: rgba(255, 255, 255, .12);
}

.fmradio-play-pause {
    width: 48px;
    height: 48px;
    background: var(--fmr-accent) !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 12px rgba(79, 110, 247, 0.3);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.fmradio-play-pause:hover {
    background: var(--fmr-accent-h) !important;
    transform: scale(1.1);
}

.fmradio-play-pause:active {
    transform: scale(0.95);
}

.fmradio-speed-btn {
    font-size: .78rem;
    font-weight: 700;
    min-width: 34px;
    padding: 4px 2px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 6px;
}

.fmradio-p-btn.shuffle-on {
    color: var(--fmr-accent);
}

/* ── Volume Slider ── */
.fmradio-volume-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.fmradio-volume-slider-pop {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    padding: 10px 6px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
    display: none;
    z-index: 1000;
    margin-bottom: 5px;
}

/* .fmradio-volume-wrap:hover .fmradio-volume-slider-pop {
    display: block;
} */

#fmradio-volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 6px;
    height: 100px;
    background: rgba(255, 255, 255, .2);
    writing-mode: bt-lr;
    /* Vertical slider */
    -webkit-appearance: slider-vertical;
    outline: none;
    cursor: pointer;
    border-radius: 4px;
}

#fmradio-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--fmr-accent);
    border: 2px solid #fff;
    border-radius: 50%;
}

/* ── Progress bar ── */
.fmradio-progress-wrap {
    flex: 1;
    position: relative;
    height: 4px;
    cursor: pointer;
}

.fmradio-progress {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, .2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    z-index: 2;
    outline: none;
    margin: 0;
}

.fmradio-progress::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    margin-top: -5px;
    box-shadow: 0 0 4px rgba(0, 0, 0, .3);
}

.fmradio-progress::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
}

.fmradio-progress::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: transparent;
}

.fmradio-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 4px;
    background: var(--fmr-accent);
    border-radius: 2px;
    pointer-events: none;
    z-index: 1;
}

.fmradio-time {
    font-size: .72rem;
    color: rgba(255, 255, 255, .6);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    min-width: 30px;
}

#fmradio-duration {
    text-align: right;
}

/* ── Player right buttons ── */
.fmradio-player-btns-right {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

/* ───────────────────────────────────────
   RESPONSIVE — Mobile
─────────────────────────────────────── */
@media (max-width: 640px) {
    .fmradio-grid-2 {
        grid-template-columns: 1fr;
    }

    .fmradio-thumb {
        width: 90px;
        height: 90px;
    }

    .fmradio-thumb-placeholder {
        width: 90px;
        height: 90px;
    }

    .fmradio-card-title {
        font-size: .9rem;
    }

    .fmradio-card-desc {
        font-size: .8rem;
    }

    .fmradio-section-title {
        font-size: 1.2rem;
    }

    /* Player mobil düzen */
    .fmradio-player-inner {
        padding: 6px 10px;
    }

    .fmradio-player-row3 {
        gap: 2px;
    }

    .fmradio-play-pause {
        width: 40px;
        height: 40px;
    }

    .fmradio-p-btn {
        padding: 5px;
    }

    .fmradio-player-thumb {
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 400px) {
    .fmradio-card-header {
        gap: 8px;
        padding: 10px;
    }

    .fmradio-thumb {
        width: 60px;
        height: 60px;
    }

    .fmradio-thumb-placeholder {
        width: 60px;
        height: 60px;
    }

    .fmradio-track-item {
        padding: 8px 10px;
    }
}

/* User Requested Global Button Scopes */
button:hover, html input[type="button"]:hover, input[type="reset"]:hover, input[type="submit"]:hover, a.button:hover, button:focus, html input[type="button"]:focus, input[type="reset"]:focus, input[type="submit"]:focus, a.button:focus, a.wp-block-button__link:not(.has-background):active, a.wp-block-button__link:not(.has-background):focus, a.wp-block-button__link:not(.has-background):hover {
    color: #ffffff;
    background-color: #bfcafc;
}