/*
Theme Name: Video Surfarama
Description: Modern Video Theme
Version: 7.0
*/

/* TEMEL */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Arial, sans-serif; background: #f4f4f4; color: #333; }
a { text-decoration: none; color: #0066cc; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

/* HEADER */
header[role=banner] { background: #000; padding: 15px 0; border-bottom: 3px solid #0066cc; }
#container { max-width: 1200px; margin: 0 auto; padding: 0 15px; }
#site-title a { color: #fff; font-size: 28px; font-weight: bold; text-transform: uppercase; }
nav ul { display: flex; padding: 0; margin: 10px 0 0 0; }
nav ul li a { color: #fff; padding: 10px 15px; display: block; }
nav ul li a:hover { background: #0066cc; }

/* LAYOUT */
#content { display: flex; gap: 25px; max-width: 1200px; margin: 20px auto; padding: 0 15px; align-items: flex-start; }
.fluff-main-content { flex: 1; min-width: 0; }
.fluff-sidebar { width: 300px; flex-shrink: 0; }

/* 3'LÜ GRID YAPISI (Masaüstü 3, Tablet 2, Mobil 1) */
#grid-wrap { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 20px; 
    width: 100%; 
}

/* KART TASARIMI (Dengeli ve Kusursuz) */
.grid-box { 
    background: #fff; 
    border: 1px solid #e0e0e0; 
    border-radius: 8px; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    height: 100%; /* Kartların boyunu eşitler */
    transition: 0.3s;
}
.grid-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-color: #0066cc;
}

/* Görsel Alanı (16:9 Oranı) */
.video-thumb { 
    position: relative; 
    width: 100%; 
    padding-top: 56.25%; 
    background: #000; 
    flex-shrink: 0;
}
.video-thumb img { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

/* Kart İçeriği */
.video-content { 
    padding: 15px; 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; /* İçeriğin aşağı doğru esnemesini sağlar */
}

/* Başlık */
.entry-title { 
    font-size: 15px; 
    margin: 0 0 10px 0; 
    font-weight: 600; 
    line-height: 1.4; 
}
.entry-title a { color: #111; }
.entry-title a:hover { color: #0066cc; }

/* Açıklama (100 Karakter Sınırı İçin 3 Satır) */
.video-excerpt { 
    font-size: 13px; 
    color: #666; 
    margin-bottom: 15px; 
    line-height: 1.5; 
    /* 3 satırdan sonrasını keser (yaklaşık 100 karakter) */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1; /* Alt kısımdaki etiketleri en alta iter */
}

/* Kategori, Kanal, Yıldız Bilgileri */
.video-meta-modern {
    margin-top: auto; /* Etiketleri her zaman en alta yapıştırır */
    font-size: 12px;
    color: #444;
    border-top: 1px solid #f0f0f0;
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.video-meta-modern strong {
    color: #0066cc;
    font-weight: bold;
}

/* SIDEBAR */
.fluff-widget { background: #fff; border: 1px solid #e0e0e0; margin-bottom: 20px; border-radius: 8px; overflow: hidden; }
.fluff-widget-header { background: #111; color: #fff; padding: 14px 18px; font-weight: bold; cursor: pointer; display: flex; justify-content: space-between;}
.fluff-widget-body { padding: 15px; display: none; }
.fluff-widget-body li { padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.fluff-widget-body a { color: #444; }
.fluff-widget-body a:hover { color: #0066cc; }

/* SAYFALAMA */
.pagination { margin: 30px 0; text-align: center; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;}
.pagination a, .pagination span { padding: 8px 15px; background: #fff; border: 1px solid #ddd; border-radius: 4px; color: #333; font-weight: bold; text-decoration: none;}
.pagination .current, .pagination a:hover { background: #0066cc; border-color: #0066cc; color: #fff; }

/* RESPONSIVE (Tablet ve Mobil) */
@media (max-width: 1024px) {
    #content { flex-direction: column; }
    .fluff-sidebar { width: 100%; }
    #grid-wrap { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    #grid-wrap { grid-template-columns: 1fr; }
}
// TÜM RESİMLER İÇİN OTOMATİK ALT TAG
add_filter('wp_get_attachment_image_attributes', 'fluff_force_img_alt', 999);
function fluff_force_img_alt($attr) {
    if (empty($attr['alt'])) {
        $attr['alt'] = get_the_title();
    }
    return $attr;
}

// TÜM LİNKLER İÇİN OTOMATİK TITLE TAG
add_filter('the_content', 'fluff_force_link_title');
add_filter('post_thumbnail_html', 'fluff_force_link_title');
function fluff_force_link_title($content) {
    if (is_admin() || empty($content)) return $content;
    $title = esc_attr(get_the_title());
    // Eğer linkte title yoksa, yazının başlığını title olarak ekle
    $content = preg_replace('/<a(.*?)(?!title=)>/is', '<a$1 title="'.$title.'">', $content);
    return $content;
}
/* =========================================================
   VİDEO OYNATICI TAM EKRAN VE RESPONSIVE DÜZELTMESİ
   ========================================================= */

/* Siyah çerçeve alanı */
.video-player-wrap {
    position: relative !important;
    width: 100% !important;
    padding-top: 56.25% !important; /* 16:9 Oranı */
    background: #000 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    margin-bottom: 20px !important;
}

/* İçindeki tüm video, iframe ve embed'leri zorla tam boyut yap */
.video-player-wrap iframe, 
.video-player-wrap video, 
.video-player-wrap embed, 
.video-player-wrap object {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
}

/* Video kodunun içindeki div'lerin de tam boyut olmasını sağla (JWPlayer vb. için) */
.video-player-wrap > div {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* Mobilde videonun biraz daha iyi görünmesi için */
@media (max-width: 768px) {
    .video-player-wrap {
        border-radius: 0 !important; /* Mobilde kenarları düz yapalım */
        margin-left: -15px !important; /* Ekran kenarlarına tam otursun */
        margin-right: -15px !important;
        width: calc(100% + 30px) !important; /* Ekran genişliği kadar yap */
    }
}
/* =========================================================
   AMP VERSİYONU İÇİN ÖZEL STİLLER (style.css içinden çekilir)
   ========================================================= */

/* AMP Temel Ayarlar */
.amp-page { 
    background: #f4f4f4 !important; 
    color: #333 !important; 
    font-family: 'Open Sans', Arial, sans-serif; 
    line-height: 1.6; 
    width: 100%;
    overflow-x: hidden; /* Yatay kaymayı engelle */
}

/* AMP Header */
.amp-header { 
    background: #000 !important; 
    padding: 15px 0; 
    border-bottom: 3px solid #0066cc !important; 
    text-align: center; 
    width: 100%;
}
.amp-logo { 
    font-size: 26px; 
    font-weight: 800; 
    color: #fff !important; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    text-decoration: none; 
}

/* AMP Konteyner */
.amp-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 15px; 
    width: 100%;
}

/* AMP Grid (Mobilde 1, Tablet/Masaüstünde 2'li) */
.amp-grid { 
    display: grid !important; 
    grid-template-columns: 1fr !important; 
    gap: 15px !important; 
    width: 100% !important;
}
@media (min-width: 600px) {
    .amp-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* AMP Kart Tasarımı */
.amp-card { 
    background: #fff !important; 
    border: 1px solid #ddd !important; 
    border-radius: 8px !important; 
    overflow: hidden !important; 
    display: flex !important; 
    flex-direction: column !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
    width: 100% !important;
    text-decoration: none !important;
}
.amp-card a { display: flex !important; flex-direction: column !important; height: 100% !important; color: #333 !important; }

/* AMP Görsel Çerçevesi (16:9 Oranı Garantili) */
.amp-card-thumb { 
    position: relative !important; 
    width: 100% !important; 
    padding-top: 56.25% !important; 
    background: #000 !important; 
    overflow: hidden !important;
}
.amp-card-thumb amp-img { 
    position: absolute !important; 
    top: 0 !important; 
    left: 0 !important; 
    width: 100% !important; 
    height: 100% !important; 
    object-fit: cover !important;
}

/* AMP Kart İçeriği */
.amp-card-content { padding: 15px !important; display: flex !important; flex-direction: column !important; flex-grow: 1 !important; }
.amp-card-cat { color: #0066cc !important; font-size: 11px !important; font-weight: 800 !important; text-transform: uppercase !important; margin-bottom: 6px !important; letter-spacing: 0.5px !important; }
.amp-card-title { font-size: 15px !important; font-weight: 700 !important; line-height: 1.4 !important; color: #111 !important; margin-bottom: 8px !important; display: -webkit-box !important; -webkit-line-clamp: 2 !important; -webkit-box-orient: vertical !important; overflow: hidden !important; }
.amp-card-excerpt { font-size: 13px !important; color: #666 !important; line-height: 1.5 !important; margin-bottom: 12px !important; display: -webkit-box !important; -webkit-line-clamp: 3 !important; -webkit-box-orient: vertical !important; overflow: hidden !important; }
.amp-card-meta { margin-top: auto !important; border-top: 1px solid #f0f0f0 !important; padding-top: 10px !important; font-size: 12px !important; color: #444 !important; }
.amp-card-meta strong { color: #0066cc !important; }

/* AMP Tekil Video Sayfası */
.amp-single-title { font-size: 22px !important; font-weight: 700 !important; color: #111 !important; margin-bottom: 15px !important; line-height: 1.3 !important; }
.amp-video-box { position: relative !important; width: 100% !important; padding-top: 56.25% !important; background: #000 !important; border-radius: 8px !important; overflow: hidden !important; margin-bottom: 20px !important; }
.amp-video-box amp-iframe { position: absolute !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; border: 0 !important; }
.amp-single-excerpt { font-size: 14px !important; color: #444 !important; line-height: 1.6 !important; margin-bottom: 20px !important; }
.amp-single-meta { background: #fff !important; padding: 15px !important; border-left: 4px solid #0066cc !important; border-radius: 6px !important; font-size: 14px !important; margin-bottom: 30px !important; box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important; }
.amp-single-meta div { margin-bottom: 8px !important; }

/* AMP Footer */
.amp-footer { padding: 20px !important; background: #000 !important; color: #888 !important; text-align: center !important; border-top: 3px solid #0066cc !important; margin-top: 30px !important; width: 100%; }
.amp-footer a { color: #fff !important; font-weight: bold !important; }

/* AMP Akordiyon Menüler */
.amp-page amp-accordion { margin-top: 20px !important; margin-bottom: 30px !important; width: 100%; }
.amp-page amp-accordion section { margin-bottom: 10px !important; border-radius: 8px !important; overflow: hidden !important; border: 1px solid #ddd !important; background: #fff !important; }
.amp-page amp-accordion h4 { background: #111 !important; color: #fff !important; padding: 14px 18px !important; margin: 0 !important; font-size: 14px !important; font-weight: 600 !important; display: block !important; }
.amp-page amp-accordion div { background: #fff !important; padding: 15px !important; }
.amp-page amp-accordion ul { margin: 0 !important; padding: 0 !important; list-style: none !important; }
.amp-page amp-accordion li { padding: 10px 0 !important; border-bottom: 1px solid #f0f0f0 !important; }
.amp-page amp-accordion li:last-child { border-bottom: none !important; }
.amp-page amp-accordion a { color: #444 !important; font-size: 14px !important; display: block !important; }