/* ============================================
   MOBILE OPTIMIZATION CSS
   Designed for WebUI News Site
   ============================================ */

/* ========== GLOBAL — tüm ekran boyutları ========== */
html,
body {
    overflow-x: hidden;
    width: 100%;
}

/* ========== BASE MOBILE STYLES ========== */
@media (max-width: 991px) {
    /* Touch Targets — sadece buton ve nav linkleri, genel <a> DEĞİL */
    .btn,
    .nav-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Mobile Typography */
    body {
        font-size: 16px;
        line-height: 1.6;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    h1 { font-size: 1.75rem !important; }
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.25rem !important; }
    h4 { font-size: 1.125rem !important; }

    * {
        -webkit-tap-highlight-color: rgba(129, 76, 158, 0.2);
    }
}

/* ========== HEADER & NAVIGATION ========== */
@media (max-width: 991px) {
    /* Topbar (d-none d-lg-block) — Bootstrap kuralına dokunma, gizli kalsın */

    /* Logo - Centered on Mobile */
    .navbar-brand h1 {
        font-size: 1.75rem !important;
        margin: 8px 0;
    }

    /* Hamburger Menu */
    .navbar-toggler {
        border: 2px solid #814C9E;
        padding: 8px 12px;
        border-radius: 8px;
    }

    .navbar-toggler-icon {
        width: 24px;
        height: 24px;
    }

    /* Mobile Menu */
    .navbar-collapse {
        background: #1E2024;
        margin-top: 10px;
        border-radius: 8px;
        padding: 10px 15px;
    }

    .navbar-nav .nav-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin: 0;
    }

    .navbar-nav .nav-link {
        padding: 12px 10px;
        font-size: 15px;
        width: 100%;
        justify-content: flex-start;
    }

    /* Arama kutusu — mobilde hamburger menüsünde görünsün */
    .input-group.ml-auto {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 10px 0 5px 0 !important;
    }

    .input-group .form-control {
        border-radius: 8px 0 0 8px;
        height: 44px;
        font-size: 15px;
    }

    .input-group-text {
        border-radius: 0 8px 8px 0;
        padding: 0 16px;
    }
}

/* ========== SON DAKİKA TICKER ========== */
@media (max-width: 991px) {
    .breaking-news {
        height: 52px;
    }

    /* Ticker item — genel `a` kuralından etkilenmesin */
    .ticker-item {
        display: inline-flex !important;
        align-items: center !important;
        min-height: unset !important;
        min-width: unset !important;
        padding: 0 1.5rem !important;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* Ticker hızı tablet */
    .ticker-track {
        animation-duration: 6s !important;
    }

    /* Badge yanındaki geçiş daha az keskin — metin kaybolmasın */
    .ticker-wrap {
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 95%, transparent 100%);
        mask-image: linear-gradient(to right, transparent 0%, black 10%, black 95%, transparent 100%);
        padding-left: 15px;
    }
}

/* ========== HABER KARTLARI ========== */
@media (max-width: 991px) {
    .col-lg-6 {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }

    .col-lg-8,
    .col-lg-4 {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* news-meta — badge + tarih alt alta kırılabilsin */
    .news-meta {
        flex-wrap: wrap;
        gap: 0.5rem !important;
    }

    .news-card-img { height: 200px; }

    .news-card-body { padding: 1rem; }

    .news-title { font-size: 1.1rem !important; }

    /* news-footer içindeki linkler normal davransın */
    .news-footer a,
    .news-card a.news-title,
    .news-card a.news-badge {
        display: inline !important;
        min-height: unset !important;
        min-width: unset !important;
        padding: 0 !important;
    }

    .news-badge {
        display: inline-block !important;
        padding: 0.3rem 0.7rem !important;
    }
}

/* ========== SIDEBAR — EN ÇOK OKUNANLAR ========== */
@media (max-width: 991px) {
    .col-lg-4 { margin-top: 20px; }

    /* popular-item-meta — badge + tarih alt alta kırılabilsin */
    .popular-item-meta {
        flex-wrap: wrap;
        gap: 0.4rem !important;
    }

    .popular-item-img {
        width: 80px !important;
        height: 80px !important;
        min-width: 80px;
    }

    /* Sidebar içindeki linkler normal davransın */
    .popular-item-title,
    .popular-item-badge,
    .popular-card a {
        display: inline !important;
        min-height: unset !important;
        min-width: unset !important;
        padding: 0 !important;
    }

    .popular-item-badge {
        display: inline-block !important;
        padding: 0.25rem 0.5rem !important;
    }

    .list-group-item {
        padding: 12px 15px;
        font-size: 15px;
    }
}

/* ========== FOOTER ========== */
@media (max-width: 991px) {
    /* Ana footer container */
    .container-fluid.pt-5 {
        padding-top: 1.5rem !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        text-align: center;
    }

    /* Sütunlar ortalansın */
    .container-fluid.pt-5 .col-lg-3,
    .container-fluid.pt-5 .col-md-6 {
        text-align: center;
    }

    /* Sosyal medya ikonları — genel `a` kuralından korun */
    .container-fluid.pt-5 a,
    .container-fluid.py-3 a {
        display: inline-flex !important;
        min-height: unset !important;
        min-width: unset !important;
        padding: 0 !important;
        align-items: center;
    }

    /* Sosyal ikon butonları */
    .container-fluid.pt-5 .d-flex.mt-3 a {
        width: 36px !important;
        height: 36px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50%;
    }

    /* Sosyal ikon satırı ortalansın */
    .container-fluid.pt-5 .d-flex.mt-3 {
        justify-content: center;
    }

    /* Hızlı Erişim / Kategoriler linkleri */
    .container-fluid.pt-5 .d-flex.flex-column a {
        display: block !important;
        padding: 4px 0 !important;
        min-height: unset !important;
        font-size: 0.875rem;
    }

    /* Copyright bar */
    .container-fluid.py-3 {
        padding: 12px 15px !important;
    }
}

/* ========== EXPANDING PANELS (Slider) ========== */
@media (max-width: 768px) {
    .expanding-container {
        flex-direction: column;
        overflow: hidden;
    }

    .expanding-panel {
        flex: none !important;
        height: 200px;
        margin: 4px 0;
    }

    .expanding-panel .panel-content {
        opacity: 1;
        transform: translateY(0);
    }

    .panel-title { font-size: 1rem; }
}

/* ========== OVERFLOW KORUMALARI ========== */
@media (max-width: 991px) {
    /* Section header — dar ekranda kırılabilsin */
    .section-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Genel badge */
    .badge {
        font-size: 0.72rem;
        padding: 4px 8px !important;
        white-space: nowrap;
    }

    small { font-size: 0.875rem; }

    .rounded-circle {
        width: 32px !important;
        height: 32px !important;
    }
}

/* ========== TABLET (768px - 991px) ========== */
@media (min-width: 768px) and (max-width: 991px) {
    .col-lg-6 {
        width: 50%;
        max-width: 50%;
        flex: 0 0 50%;
    }
}

/* ========== KÜÇÜK MOBİL (≤576px) ========== */
@media (max-width: 576px) {
    body { font-size: 14px; }

    .navbar-brand h1 { font-size: 1.5rem !important; }

    .news-card-img { height: 180px; }

    .btn { padding: 10px 14px; font-size: 14px; }
}

/* ========== PERFORMANS ========== */
@media (max-width: 991px) {
    img[data-src] {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: loading 1.5s infinite;
    }

    @keyframes loading {
        0%   { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }

    * { -webkit-overflow-scrolling: touch; }
}

/* ========== ERİŞİLEBİLİRLİK ========== */
@media (max-width: 991px) {
    a:focus,
    button:focus,
    input:focus,
    textarea:focus {
        outline: 3px solid #814C9E;
        outline-offset: 2px;
    }
}

/* ========== DOKUNMA ========== */
@media (max-width: 991px) {
    a,
    button {
        -webkit-tap-highlight-color: rgba(129, 76, 158, 0.3);
        touch-action: manipulation;
    }

    .btn,
    .badge,
    .nav-link {
        -webkit-user-select: none;
        user-select: none;
    }

    .navbar-collapse,
    .modal {
        -webkit-overflow-scrolling: touch;
    }
}

/* ========== LANDSCAPE ========== */
@media (max-width: 991px) and (orientation: landscape) {
    .expanding-panel { height: 220px !important; }
}

/* ========== YÜKLEME SPİNNER ========== */
.mobile-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    display: none;
}

.mobile-loading.active { display: block; }

.spinner {
    border: 4px solid rgba(129, 76, 158, 0.1);
    border-left-color: #814C9E;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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