/*
 * WP YouTube Kanal Videolar - Frontend Stilleri
 * 
 * Tüm sınıflar ytkv- öneki ile namespace'lenmiştir.
 * Tema ve diğer pluginlerle CSS karışmasını önler.
 *
 * @package WP_YouTube_Kanal_Videolar
 * @version 1.0.0
 */

/* ========================================
   1. Wrapper
   ======================================== */

.ytkv-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

.ytkv-wrapper *,
.ytkv-wrapper *::before,
.ytkv-wrapper *::after {
    box-sizing: border-box;
}

/* ========================================
   2. Grid Container
   ======================================== */

.ytkv-grid {
    display: grid;
    grid-template-columns: repeat(var(--ytkv-cols-desktop, 4), 1fr);
    gap: 16px;
    margin: 0;
    padding: 0;
}

/* ========================================
   3. Grid Item
   ======================================== */

.ytkv-grid-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--ytkv-grid-radius, 12px);
    aspect-ratio: 16 / 9;
    list-style: none;
    margin: 0;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.ytkv-grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* ========================================
   4. Grid Link
   ======================================== */

.ytkv-grid-link {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    text-decoration: none;
    outline: none;
}

.ytkv-grid-link:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
    border-radius: var(--ytkv-grid-radius, 12px);
}

/* ========================================
   5. Thumbnail Container
   ======================================== */

.ytkv-thumb-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.ytkv-thumb-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #1a1a1a;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.ytkv-grid-item:hover .ytkv-thumb-bg {
    transform: scale(1.08);
}

.ytkv-grid-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.85) 0%,
            rgba(0, 0, 0, 0.4) 50%,
            transparent 70%);
    pointer-events: none;
}

/* ========================================
   6. Overlay (Video Üzerindeki Katman)
   ======================================== */

.ytkv-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 14px 14px;
    background: rgba(0, 0, 0, 0.7);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* Gradient overlay: üst kısım saydam, alt kısım belirtilen renk */
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.85) 0%,
            rgba(0, 0, 0, 0.6) 50%,
            transparent 100%);
}

/* Kullanıcı ayarlarından gelen overlay rengi inline style ile uygulanır.
   CSS'deki gradient varsayılandır, inline style override eder. */

/* ========================================
   7. Video Title
   ======================================== */

.ytkv-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    word-wrap: break-word;
    hyphens: auto;
    transition: all 0.3s ease;
}

.ytkv-grid-item:hover .ytkv-title {
    -webkit-line-clamp: 3;
}

/* ========================================
   8. Tarih Bilgisi
   ======================================== */

.ytkv-date {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ytkv-grid-item:hover .ytkv-date {
    opacity: 0.8;
}

/* ========================================
   9. Buton Wrapper
   ======================================== */

.ytkv-button-wrapper {
    text-align: center;
    margin-top: 28px;
    padding: 0;
}

/* ========================================
   10. Buton Stilleri
   ======================================== */

.ytkv-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.4;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ytkv-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.ytkv-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ytkv-button:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.ytkv-button-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
    line-height: 1;
}

.ytkv-button:hover .ytkv-button-icon {
    transform: translateX(4px);
}

/* ========================================
   11. Responsive: Tablet
   ======================================== */

@media (max-width: 1024px) {
    .ytkv-grid {
        grid-template-columns: repeat(var(--ytkv-cols-tablet, 3), 1fr);
        gap: 14px;
    }

    .ytkv-title {
        font-size: 13px;
    }

    .ytkv-button {
        padding: 12px 28px;
        font-size: 15px;
    }
}

@media (max-width: 782px) {
    .ytkv-grid {
        gap: 12px;
    }
}

/* ========================================
   12. Responsive: Mobil
   ======================================== */

@media (max-width: 480px) {
    .ytkv-grid {
        grid-template-columns: repeat(var(--ytkv-cols-mobile, 1), 1fr);
        gap: 12px;
    }

    .ytkv-overlay {
        padding: 30px 10px 10px;
    }

    .ytkv-title {
        font-size: 12px;
        -webkit-line-clamp: 2;
    }

    .ytkv-grid-item:hover .ytkv-title {
        -webkit-line-clamp: 2;
    }

    .ytkv-date {
        font-size: 10px;
        padding: 3px 6px;
        top: 8px;
        right: 8px;
    }

    .ytkv-button-wrapper {
        margin-top: 20px;
    }

    .ytkv-button {
        padding: 12px 24px;
        font-size: 14px;
        width: 100%;
        justify-content: center;
    }

    .ytkv-grid-item {
        aspect-ratio: 16 / 9;
    }

    .ytkv-grid-item:hover {
        transform: none;
        box-shadow: none;
    }

    .ytkv-grid-item:hover .ytkv-thumb-bg {
        transform: none;
    }

    .ytkv-button:hover {
        transform: none;
    }
}

/* ========================================
   13. Loading & Empty State
   ======================================== */

.ytkv-loading {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
    font-size: 14px;
}

.ytkv-empty {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
    font-size: 14px;
}

/* ========================================
   14. Lightbox Modal
   ======================================== */

.ytkv-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s linear 0.3s, opacity 0.3s ease;
}

.ytkv-modal[aria-hidden="false"] {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

.ytkv-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.ytkv-modal-content {
    position: relative;
    width: 90%;
    max-width: 960px;
    max-height: 90vh;
    z-index: 1;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.ytkv-modal[aria-hidden="false"] .ytkv-modal-content {
    transform: scale(1);
}

.ytkv-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    z-index: 2;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.ytkv-modal-close:hover {
    opacity: 1;
}

.ytkv-modal-close svg {
    display: block;
}.ytkv-modal-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* fallback: eski tarayıcılar */
    aspect-ratio: 16 / 9;   /* modern tarayıcılar */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.ytkv-modal-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.ytkv-plyr-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.ytkv-modal-title {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    margin-top: 12px;
    text-align: center;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Body modal açıkken scroll'u engelle */
body.ytkv-modal-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .ytkv-modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .ytkv-modal-close {
        top: -36px;
    }

    .ytkv-modal-title {
        font-size: 13px;
        margin-top: 10px;
    }
}

/* ========================================
   16. Accessibility: Reduced Motion
   ======================================== */

@media (prefers-reduced-motion: reduce) {

    .ytkv-grid-item,
    .ytkv-thumb-bg,
    .ytkv-overlay,
    .ytkv-title,
    .ytkv-button,
    .ytkv-button-icon,
    .ytkv-date {
        transition: none !important;
        transform: none !important;
    }
}