/* ═══════════════════════════════════════════════════════════
   YouTube Channel Embed — Public Styles
   Matches YouTube's design language with dark/light themes
═══════════════════════════════════════════════════════════ */

/* ── CSS Variables ───────────────────────────────────────────────────────── */
.yce-wrap.yce-theme-dark {
    --yce-bg:          #0f0f0f;
    --yce-bg-2:        #1a1a1a;
    --yce-bg-3:        #272727;
    --yce-border:      #3f3f3f;
    --yce-text:        #f1f1f1;
    --yce-text-2:      #aaaaaa;
    --yce-text-3:      #717171;
    --yce-red:         #ff0000;
    --yce-hover:       rgba(255,255,255,0.1);
    --yce-shadow:      rgba(0,0,0,0.4);
}

.yce-wrap.yce-theme-light {
    --yce-bg:          #ffffff;
    --yce-bg-2:        #f9f9f9;
    --yce-bg-3:        #f0f0f0;
    --yce-border:      #e0e0e0;
    --yce-text:        #0f0f0f;
    --yce-text-2:      #606060;
    --yce-text-3:      #909090;
    --yce-red:         #cc0000;
    --yce-hover:       rgba(0,0,0,0.06);
    --yce-shadow:      rgba(0,0,0,0.12);
}

/* ── Base ────────────────────────────────────────────────────────────────── */
.yce-wrap {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--yce-bg);
    color: var(--yce-text);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.yce-wrap *, .yce-wrap *::before, .yce-wrap *::after {
    box-sizing: border-box;
}

/* ── Channel Header ──────────────────────────────────────────────────────── */
.yce-header {
    background: var(--yce-bg);
}

.yce-banner {
    width: 100%;
    height: 160px;
    background-size: cover;
    background-position: center;
    background-color: var(--yce-bg-3);
}

@media (min-width: 768px) {
    .yce-banner { height: 220px; }
}

.yce-channel-info {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px 24px 16px;
}

.yce-avatar-wrap {
    flex-shrink: 0;
    margin-top: -10px;
}

.yce-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--yce-bg);
    display: block;
    background: var(--yce-bg-3);
}

@media (min-width: 600px) {
    .yce-avatar { width: 100px; height: 100px; }
}

.yce-channel-meta { flex: 1; min-width: 0; }

.yce-channel-name {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--yce-text);
    line-height: 1.2;
}

@media (min-width: 600px) {
    .yce-channel-name { font-size: 28px; }
}

.yce-handle {
    font-size: 14px;
    color: var(--yce-text-2);
    margin-bottom: 10px;
}

.yce-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.yce-stat {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.yce-stat-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--yce-text);
}

.yce-stat-label {
    font-size: 13px;
    color: var(--yce-text-2);
}

.yce-description {
    font-size: 13px;
    color: var(--yce-text-2);
    line-height: 1.5;
    max-width: 600px;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.yce-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--yce-border);
    padding: 0 24px;
    overflow-x: auto;
    scrollbar-width: none;
}

.yce-tabs::-webkit-scrollbar { display: none; }

.yce-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--yce-text-2);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: -1px;
}

.yce-tab:hover {
    color: var(--yce-text);
    background: var(--yce-hover);
}

.yce-tab.active {
    color: var(--yce-text);
    border-bottom-color: var(--yce-text);
}

/* ── Tab Panels ──────────────────────────────────────────────────────────── */
.yce-tab-panel {
    display: none;
    padding: 24px;
    position: relative;
}

.yce-tab-panel.active { display: block; }

/* ── Video Grid ──────────────────────────────────────────────────────────── */
.yce-videos-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 16px;
}

@media (min-width: 500px) {
    .yce-videos-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
    .yce-videos-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1200px) {
    .yce-videos-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Video / Playlist Card ───────────────────────────────────────────────── */
.yce-card-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    background: transparent;
    transition: transform 0.2s;
}

.yce-card-item:hover {
    transform: translateY(-2px);
}

.yce-thumb-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--yce-bg-3);
    border-radius: 8px;
    overflow: hidden;
}

.yce-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.yce-card-item:hover .yce-thumb {
    transform: scale(1.04);
}

.yce-duration {
    position: absolute;
    bottom: 6px;
    right: 8px;
    background: rgba(0,0,0,0.85);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

.yce-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.yce-card-item:hover .yce-play-btn { opacity: 1; }

.yce-playlist-count {
    position: absolute;
    bottom: 6px;
    left: 8px;
    background: rgba(0,0,0,0.85);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.yce-card-body {
    padding: 10px 4px 4px;
}

.yce-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--yce-text);
    margin: 0 0 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.yce-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--yce-text-2);
}

.yce-card-meta svg { opacity: 0.7; flex-shrink: 0; }

.yce-dot { opacity: 0.5; }

.yce-card-desc {
    font-size: 12px;
    color: var(--yce-text-2);
    margin: 4px 0 0;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.yce-pagination {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.yce-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--yce-bg-3);
    color: var(--yce-text);
    border: 1px solid var(--yce-border);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.yce-btn:hover {
    background: var(--yce-hover);
    border-color: var(--yce-text-2);
}

/* ── Search ──────────────────────────────────────────────────────────────── */
.yce-search-bar {
    display: flex;
    gap: 0;
    max-width: 500px;
    margin-bottom: 24px;
}

.yce-search-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--yce-bg-2);
    border: 1px solid var(--yce-border);
    border-right: none;
    border-radius: 6px 0 0 6px;
    color: var(--yce-text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.yce-search-input::placeholder { color: var(--yce-text-3); }
.yce-search-input:focus { border-color: var(--yce-text-2); }

.yce-search-btn {
    padding: 12px 20px;
    background: var(--yce-bg-3);
    border: 1px solid var(--yce-border);
    border-radius: 0 6px 6px 0;
    color: var(--yce-text);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
}

.yce-search-btn:hover { background: var(--yce-hover); }

.yce-search-results { min-height: 100px; }

/* ── Playlist Back Button ─────────────────────────────────────────────────── */
.yce-playlist-back {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.yce-playlist-current-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: var(--yce-text);
}

/* ── Player Modal ────────────────────────────────────────────────────────── */
.yce-player-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(6px);
}

.yce-player-overlay.open { display: flex; }

.yce-player-modal {
    background: #0f0f0f;
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.7);
    position: relative;
    animation: yce-modal-in 0.25s ease-out;
}

@keyframes yce-modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.yce-player-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    background: rgba(0,0,0,0.6);
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.yce-player-close:hover { background: rgba(255,0,0,0.7); }

.yce-player-iframe-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
}

.yce-player-iframe-wrap iframe {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.yce-player-info {
    padding: 16px 20px;
}

.yce-player-title {
    font-size: 16px;
    font-weight: 600;
    color: #f1f1f1;
    margin: 0 0 6px;
    line-height: 1.4;
}

.yce-player-meta {
    font-size: 13px;
    color: #aaa;
}

/* ── Loading ─────────────────────────────────────────────────────────────── */
.yce-loading {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(var(--yce-bg), 0.8);
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.yce-loading.active { display: flex; }

.yce-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--yce-border);
    border-top-color: var(--yce-red);
    border-radius: 50%;
    animation: yce-spin 0.8s linear infinite;
}

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

/* ── Notice ──────────────────────────────────────────────────────────────── */
.yce-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    color: #856404;
}

/* ── Video Card animation on load ───────────────────────────────────────── */
.yce-card-item {
    animation: yce-fade-up 0.4s ease-out both;
}

@keyframes yce-fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
