/* ===========================================================================
 * TIQ Media Hub — Frontend styling (v1.0.4)
 * Playlist-style showcase + responsive grid. Theme-conflict resistant.
 * All sizing/coloring driven by CSS custom properties so shortcode
 * attributes can override (--tmh-bg, --tmh-title-color, etc.)
 * =========================================================================== */

.tmh-yt-showcase,
.tmh-yt-showcase *,
.tmh-yt-grid-wrap,
.tmh-yt-grid-wrap *,
.tmh-yt-lightbox,
.tmh-yt-lightbox * {
    box-sizing: border-box !important;
}
.tmh-yt-showcase ul,
.tmh-yt-grid-wrap ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
.tmh-yt-showcase li,
.tmh-yt-grid-wrap li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
}
.tmh-yt-showcase img,
.tmh-yt-grid-wrap img {
    max-width: 100% !important;
    height: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
}
.tmh-yt-showcase h1, .tmh-yt-showcase h2, .tmh-yt-showcase h3, .tmh-yt-showcase h4,
.tmh-yt-grid-wrap h1, .tmh-yt-grid-wrap h2, .tmh-yt-grid-wrap h3, .tmh-yt-grid-wrap h4 {
    border: 0 !important;
    background: none !important;
    text-shadow: none !important;
    text-transform: none !important;
    font-weight: 600 !important;
}

.tmh-yt-empty {
    padding: 32px;
    text-align: center;
    color: #666;
    background: #f5f5f5;
    border-radius: 8px;
    font-family: system-ui, -apple-system, sans-serif;
}

/* =========================================================
 * [tiq_youtube_showcase] — playlist style
 * ========================================================= */

.tmh-yt-showcase {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
    padding: 24px !important;
    border-radius: var(--tmh-radius, 12px) !important;
    margin: 24px 0 !important;
    color: var(--tmh-title-color, #111) !important;
    background: var(--tmh-bg, #fff) !important;
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    box-shadow: 0 2px 24px rgba(0,0,0,0.04) !important;
}

.tmh-yt-showcase-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr) !important;
    gap: 24px !important;
    width: 100% !important;
}
@media (max-width: 820px) {
    .tmh-yt-showcase { padding: 16px !important; }
    .tmh-yt-showcase-grid { grid-template-columns: 1fr !important; gap: 18px !important; }
}

/* ===== Featured player (left) ===== */

.tmh-yt-feature {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
}

.tmh-yt-player {
    position: relative !important;
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    background: #000 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    cursor: pointer !important;
    box-shadow: 0 8px 28px rgba(0,0,0,0.12) !important;
}
@supports not (aspect-ratio: 16 / 9) {
    .tmh-yt-player { padding-top: 56.25% !important; height: 0 !important; }
}
.tmh-yt-player iframe {
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
}
.tmh-yt-cover {
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform .4s ease !important;
    border-radius: 0 !important;
    max-width: none !important;
}
.tmh-yt-player:hover .tmh-yt-cover { transform: scale(1.04) !important; }

.tmh-yt-play {
    position: absolute !important;
    top: 50% !important; left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 76px !important; height: 76px !important;
    border: 0 !important;
    background: rgba(255,255,255,0.96) !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all .2s !important;
    box-shadow: 0 4px 22px rgba(0,0,0,0.3) !important;
    padding: 0 !important;
}
.tmh-yt-player:hover .tmh-yt-play {
    background: #fff !important;
    transform: translate(-50%, -50%) scale(1.08) !important;
}
.tmh-yt-play-tri {
    width: 0 !important; height: 0 !important;
    border-top: 13px solid transparent !important;
    border-bottom: 13px solid transparent !important;
    border-left: 19px solid #111 !important;
    margin-left: 5px !important;
    display: inline-block !important;
}
.tmh-yt-duration {
    position: absolute !important;
    bottom: 12px !important; right: 12px !important;
    background: rgba(0,0,0,0.85) !important;
    color: #fff !important;
    padding: 4px 10px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    font-family: inherit !important;
}

.tmh-yt-feature-title {
    font-size: var(--tmh-title-size, 22px) !important;
    font-weight: 600 !important;
    margin: 16px 0 4px !important;
    line-height: 1.35 !important;
    color: var(--tmh-title-color, #111) !important;
    letter-spacing: -0.3px !important;
    padding: 0 !important;
}
.tmh-yt-feature-meta {
    font-size: 13px !important;
    color: var(--tmh-meta-color, #666) !important;
    display: flex !important;
    gap: 6px !important;
    margin-top: 2px !important;
}

/* ===== Playlist (right) ===== */

.tmh-yt-playlist-wrap {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    max-height: 520px !important;
}
@media (max-width: 820px) {
    .tmh-yt-playlist-wrap { max-height: 480px !important; }
}

.tmh-yt-playlist-head {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 12px 16px !important;
    background: #fff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    font-size: 12px !important;
    flex-shrink: 0 !important;
}
.tmh-yt-playlist-count {
    font-weight: 600 !important;
    color: var(--tmh-title-color, #111) !important;
}
.tmh-yt-playlist-now {
    color: var(--tmh-meta-color, #666) !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.tmh-yt-playlist {
    overflow-y: auto !important;
    flex: 1 1 auto !important;
    padding: 4px !important;
    scrollbar-width: thin !important;
}
.tmh-yt-playlist::-webkit-scrollbar { width: 8px !important; }
.tmh-yt-playlist::-webkit-scrollbar-thumb { background: #cbd5e1 !important; border-radius: 4px !important; }
.tmh-yt-playlist::-webkit-scrollbar-track { background: transparent !important; }

.tmh-yt-playitem {
    display: grid !important;
    grid-template-columns: 24px 130px minmax(0, 1fr) !important;
    gap: 10px !important;
    align-items: center !important;
    padding: 8px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: background .15s ease !important;
}
.tmh-yt-playitem:hover {
    background: #fff !important;
}
.tmh-yt-playitem.is-active {
    background: #fff !important;
    box-shadow: 0 0 0 1px #e2e8f0, 0 2px 8px rgba(0,0,0,0.04) !important;
}
.tmh-yt-playitem.is-active .tmh-yt-playitem-num {
    color: #dc2626 !important;
    font-weight: 700 !important;
}

.tmh-yt-playitem-num {
    text-align: center !important;
    font-size: 12px !important;
    color: var(--tmh-meta-color, #666) !important;
    font-weight: 500 !important;
    font-family: inherit !important;
}

.tmh-yt-playitem-thumb {
    position: relative !important;
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    background: #000 !important;
    border-radius: 6px !important;
    overflow: hidden !important;
}
@supports not (aspect-ratio: 16 / 9) {
    .tmh-yt-playitem-thumb { padding-top: 56.25% !important; height: 0 !important; }
}
.tmh-yt-playitem-thumb img {
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    max-width: none !important;
}
.tmh-yt-playitem-dur {
    position: absolute !important;
    bottom: 4px !important;
    right: 4px !important;
    background: rgba(0,0,0,0.85) !important;
    color: #fff !important;
    font-size: 10px !important;
    padding: 2px 5px !important;
    border-radius: 3px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    font-family: inherit !important;
}

.tmh-yt-playitem-body {
    min-width: 0 !important;
}
.tmh-yt-playitem-title {
    font-size: var(--tmh-item-size, 15px) !important;
    font-weight: 500 !important;
    color: var(--tmh-title-color, #111) !important;
    line-height: 1.35 !important;
    margin: 0 0 3px !important;
    padding: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    word-wrap: break-word !important;
}
.tmh-yt-playitem-meta {
    font-size: 12px !important;
    color: var(--tmh-meta-color, #666) !important;
    line-height: 1.3 !important;
}

/* =========================================================
 * [tiq_youtube_videos] grid
 * ========================================================= */

.tmh-yt-grid-wrap {
    margin: 24px 0 !important;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
    background: var(--tmh-bg, #fff) !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
}
.tmh-yt-grid {
    display: grid !important;
    grid-template-columns: repeat(var(--tmh-cols, 3), minmax(0, 1fr)) !important;
    gap: 28px 24px !important;
    width: 100% !important;
}
@media (max-width: 960px) {
    .tmh-yt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 24px 18px !important; }
}
@media (max-width: 560px) {
    .tmh-yt-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
}

.tmh-yt-card {
    cursor: pointer !important;
    background: transparent !important;
    transition: transform .2s ease !important;
    min-width: 0 !important;
}
.tmh-yt-card:hover { transform: translateY(-3px) !important; }

.tmh-yt-card-thumb {
    position: relative !important;
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    background: #000 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 14px rgba(0,0,0,0.08) !important;
}
@supports not (aspect-ratio: 16 / 9) {
    .tmh-yt-card-thumb { padding-top: 56.25% !important; height: 0 !important; }
}
.tmh-yt-card-thumb img {
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    transition: transform .4s !important;
    max-width: none !important;
}
.tmh-yt-card:hover .tmh-yt-card-thumb img { transform: scale(1.05) !important; }
.tmh-yt-card:hover .tmh-yt-card-thumb { box-shadow: 0 8px 28px rgba(0,0,0,0.14) !important; }

.tmh-yt-thumb-play {
    position: absolute !important;
    top: 50% !important; left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 44px !important; height: 44px !important;
    background: rgba(255,255,255,0.95) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform .2s !important;
}
.tmh-yt-card:hover .tmh-yt-thumb-play { transform: translate(-50%, -50%) scale(1.1) !important; }
.tmh-yt-thumb-play::before {
    content: '' !important;
    width: 0 !important; height: 0 !important;
    border-top: 7px solid transparent !important;
    border-bottom: 7px solid transparent !important;
    border-left: 12px solid #111 !important;
    margin-left: 3px !important;
    display: inline-block !important;
}

.tmh-yt-card-title {
    font-size: var(--tmh-grid-size, 18px) !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    color: var(--tmh-title-color, #111) !important;
    margin: 14px 0 0 !important;
    padding: 0 !important;
    letter-spacing: -0.3px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

/* =========================================================
 * Lightbox
 * ========================================================= */

.tmh-yt-lightbox {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    z-index: 99999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
}
.tmh-yt-lightbox[hidden] { display: none !important; }
.tmh-yt-lightbox-backdrop {
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    background: rgba(0,0,0,0.9) !important;
    cursor: pointer !important;
}
.tmh-yt-lightbox-inner {
    position: relative !important;
    width: 100% !important;
    max-width: 1100px !important;
}
.tmh-yt-lightbox-close {
    position: absolute !important;
    top: -42px !important;
    right: 0 !important;
    width: 36px !important; height: 36px !important;
    background: transparent !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    border-radius: 50% !important;
    color: #fff !important;
    cursor: pointer !important;
    font-size: 24px !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}
.tmh-yt-lightbox-close:hover { background: rgba(255,255,255,0.1) !important; }
.tmh-yt-lightbox-frame {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    background: #000 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    position: relative !important;
}
@supports not (aspect-ratio: 16 / 9) {
    .tmh-yt-lightbox-frame { padding-top: 56.25% !important; height: 0 !important; }
}
.tmh-yt-lightbox-frame iframe {
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    position: absolute !important;
    inset: 0 !important;
}

body.tmh-yt-modal-open { overflow: hidden !important; }
