/*
Theme Name: Karadarya News
Version: 12.0 - Optimized & Dark Mode Fixed
*/

/* ===== 🎨 НЕГИЗГИ ӨЗГӨРМӨЛӨР ===== */
:root {
    --bg: #f5f5f5;
    --card: #ffffff;
    --text: #222222;
    --text-light: #666666;
    --primary: #1a4d2e;
    --primary-hover: #153d25;
    --border: #e0e0e0;
    --header: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
}

/* ===== ⚙️ НЕГИЗГИ СТИЛДЕР ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    transition: background 0.3s, color 0.3s;
}
a { text-decoration: none; color: inherit; transition: color 0.2s; }
img { max-width: 100%; height: auto; display: block; }

/* ===== 🌙 DARK MODE (Оптималдаштырылган) ===== */
body.dark-mode,
html[data-theme="dark"] {
    background: #121212;
    color: #e0e0e0;
}
body.dark-mode .site-header,
body.dark-mode .site-footer,
body.dark-mode .breaking-news,
body.dark-mode .mobile-bottom-menu {
    background: #1a1a1a;
    border-color: #333;
}
body.dark-mode .news-card,
body.dark-mode .widget,
body.dark-mode .single-post,
body.dark-mode .main-slider {
    background: #1e1e1e;
}
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3, body.dark-mode h4, body.dark-mode h5, body.dark-mode h6,
body.dark-mode p, body.dark-mode span, body.dark-mode label, body.dark-mode li {
    color: #e0e0e0;
}
body.dark-mode a:not(.badge):not(.lang-switcher a):not(.slider-prev):not(.slider-next) {
    color: #bb86fc;
}
body.dark-mode .news-card-meta,
body.dark-mode .site-footer p {
    color: #a0a0a0;
}
body.dark-mode input, body.dark-mode textarea, body.dark-mode select {
    background: #2a2a2a;
    color: #e0e0e0;
    border-color: #444;
}
/* Тил алмаштыргыч */
body.dark-mode .lang-switcher a {
    background: #2a2a2a;
    color: #e0e0e0;
}
body.dark-mode .lang-switcher a.active {
    background: var(--primary);
    color: #fff;
}
/* Бегущий строка шилтемелери */
body.dark-mode .breaking-news marquee a {
    color: #bb86fc !important;
    text-decoration: underline;
}
body.dark-mode .breaking-news marquee a:hover {
    color: #fff;
}
/* Сайдбар жана виджеттер */
body.dark-mode .widget-title {
    border-bottom-color: var(--primary);
}
body.dark-mode .widget li {
    border-bottom-color: #333;
}
body.dark-mode .widget li:last-child {
    border-bottom: none;
}

/* ===== 📌 HEADER ===== */
.site-header {
    background: var(--header);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.site-branding h1 {
    font-size: 1.8rem;
    color: var(--primary);
    font-weight: 800;
}
.site-branding img { max-height: 50px; }
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}
#themeToggle {
    background: none;
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
#themeToggle:hover { background: rgba(0,0,0,0.05); }
.lang-switcher { display: flex; gap: 5px; }
.lang-switcher a {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
    background: #f0f0f0;
    transition: 0.2s;
}
.lang-switcher a:hover { background: #e0e0e0; }
.lang-switcher a.active {
    background: var(--primary);
    color: #fff;
}

/* ===== 🖥 DESKTOP MENU ===== */
.desktop-nav {
    background: #111;
    display: none;
}
.desktop-nav ul {
    max-width: 1200px;
    margin: 0 auto;
    list-style: none;
    display: flex;
    justify-content: center;
}
.desktop-nav a {
    color: #fff;
    padding: 15px 25px;
    display: block;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    transition: 0.2s;
}
.desktop-nav a:hover, .desktop-nav a.active { background: #ff9800; }

/* ===== 📱 MOBILE MENU ===== */
.mobile-bottom-menu {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--header);
    border-top: 1px solid var(--border);
    z-index: 9999;
    display: flex;
    justify-content: space-around;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}
.mobile-bottom-menu a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 5px;
    font-size: 0.75rem;
    color: var(--text-light);
    transition: 0.2s;
}
.mobile-bottom-menu .menu-icon { font-size: 1.5rem; margin-bottom: 3px; }
.mobile-bottom-menu a.active { color: var(--primary); font-weight: bold; }

/* ===== 🔥 BREAKING NEWS ===== */
.breaking-news {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

/* ===== 📐 LAYOUT ===== */
.site-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}
.site-main { margin-bottom: 30px; }
.sidebar { margin-top: 30px; }

/* ===== 📰 NEWS CARDS ===== */
.news-card {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 15px;
    background: var(--card);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.news-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.news-card-thumb {
    width: 100%; height: 100px;
    background: #e0e0e0;
    overflow: hidden;
}
.news-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-card-content { padding: 15px; }
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 8px;
}
.badge-news { background: #e91e63; }
.badge-ads { background: #ff9800; }
.badge-price { background: #d32f2f; margin-left: 8px; }
.news-card-title {
    font-size: 1.1rem; font-weight: 700;
    margin: 5px 0; line-height: 1.3;
    color: var(--text);
}
.news-card-meta {
    font-size: 0.85rem; color: var(--text-light);
    display: flex; gap: 10px; margin-top: 8px;
}

/* ===== 🧩 WIDGETS ===== */
.widget {
    background: var(--card);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.widget-title {
    font-size: 1.1rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary);
}
.widget ul { list-style: none; }
.widget li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.widget li:last-child { border-bottom: none; }
.widget li a:hover { color: var(--primary); }

/* ===== 🦶 FOOTER ===== */
.site-footer {
    background: var(--header);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 25px;
    color: var(--text-light);
}
.site-footer a { color: var(--primary); font-weight: 600; }

/* ===== 🎬 СЛАЙДЕР ===== */
.main-slider {
    position: relative;
    margin-bottom: 2rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: #fff;
}
.slider-main { position: relative; height: 450px; overflow: hidden; }
.slider-wrapper {
    display: flex;
    transition: transform 0.5s ease-in-out;
    height: 100%;
}
.slide { min-width: 100%; position: relative; height: 100%; }
.slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slider-content {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95), transparent);
    padding: 2rem 1.5rem 1.5rem;
    color: #fff;
}
.slider-prev, .slider-next {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(233, 30, 99, 0.95); border: none;
    width: 44px; height: 44px; border-radius: 8px;
    cursor: pointer; font-size: 1.3rem; color: #fff;
    z-index: 50; display: flex; align-items: center; justify-content: center;
    transition: 0.3s; padding: 0; line-height: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.slider-prev:hover, .slider-next:hover { background: #c2185b; transform: translateY(-50%) scale(1.08); }
.slider-prev { left: 15px; }
.slider-next { right: 15px; }

.slider-thumbnails {
    display: grid; grid-template-columns: repeat(5, 1fr);
    gap: 8px; padding: 10px; background: #fff;
}
.thumb-item {
    position: relative; cursor: pointer; overflow: hidden;
    border-radius: 4px; aspect-ratio: 16/9;
    transition: 0.3s; border: 2px solid transparent;
}
.thumb-item img { width: 100%; height: 100%; object-fit: cover; }
.thumb-item:hover { border-color: #e91e63; transform: scale(1.05); }
.thumb-overlay { position: absolute; inset: 0; background: rgba(233,30,99,0); transition: 0.3s; }

/* ===== 🔍 ИЗДӨӨ ФОРМАСЫ ===== */
.widget .search-form, .search-form, #searchform, form[role="search"] {
    display: flex !important; flex-direction: row !important;
    gap: 8px !important; width: 100% !important;
    margin: 0 0 15px 0 !important; align-items: stretch !important; flex-wrap: nowrap !important;
}
.widget .search-form input[type="search"], .widget .search-form input[type="text"],
.search-form input[type="search"], .search-form input[type="text"], #s, .search-field {
    flex: 1 !important; width: 100% !important; min-width: 0 !important;
    padding: 11px 14px !important; border: 1px solid var(--border) !important;
    border-radius: 8px !important; font-size: 0.95rem !important;
    background: var(--card) !important; color: var(--text) !important;
    outline: none !important; height: auto !important; line-height: 1.4 !important;
}
.widget .search-form input[type="submit"], .search-form input[type="submit"], #searchsubmit {
    padding: 0 20px !important; background: var(--primary) !important; color: #fff !important;
    border: none !important; border-radius: 8px !important; cursor: pointer !important;
    font-weight: 600 !important; font-size: 0.95rem !important; white-space: nowrap !important;
    min-height: 44px !important; transition: 0.2s;
}
.widget .search-form input[type="submit"]:hover { background: var(--primary-hover) !important; }

/* ===== 📱 МОБИЛДИК ВЕРСИЯ (≤991px) ===== */
@media screen and (max-width: 991px) {
    .desktop-nav { display: none !important; }
    .mobile-bottom-menu { display: flex !important; }
    body { padding-bottom: 70px !important; }
    .site-container { padding: 0 15px; }
    .sidebar { width: 100% !important; margin-top: 20px; }
    .news-card { grid-template-columns: 120px 1fr !important; }
    .news-card-thumb { height: 100px !important; }
    .header-inner { padding: 10px 15px; }
    .site-branding h1 { font-size: 1.4rem; }
    .slider-main { height: 250px !important; }
    .slider-content { padding: 1rem !important; }
    .slider-content h2 { font-size: 1.1rem !important; }
    .slider-thumbnails { grid-template-columns: repeat(5, 1fr); gap: 5px; padding: 8px; }
    .slider-prev, .slider-next { width: 36px !important; height: 36px !important; font-size: 1.1rem !important; }
    .slider-prev { left: 8px !important; }
    .slider-next { right: 8px !important; }
}

/* ===== 💻 DESKTOP ВЕРСИЯ (≥992px) ===== */
@media screen and (min-width: 992px) {
    .desktop-nav { display: block !important; }
    .mobile-bottom-menu { display: none !important; }
    body { padding-bottom: 0 !important; }
    .site-container { display: flex !important; gap: 30px; }
    .site-main { flex: 1 !important; margin-bottom: 0 !important; }
    .sidebar { display: block !important; width: 350px !important; flex-shrink: 0 !important; margin-top: 0 !important; }
    .news-card { grid-template-columns: 280px 1fr !important; }
    .news-card-thumb { height: 200px !important; }
    .news-card-content { padding: 20px !important; }
    .news-card-title { font-size: 1.4rem !important; }
    .slider-main { height: 450px !important; }
    .slider-content h2 { font-size: 1.6rem !important; }
    .widget { padding: 25px !important; }
}

/* Мобилдик издөө формасы */
.mobile-search-form {
    display: none;
}

@media screen and (max-width: 991px) {
    .mobile-search-form {
        display: block !important;
    }
    
    /* Компьютердеги издөөнү жашыруу (мобилдик версияда) */
    .sidebar .search-widget {
        display: none !important;
    }
}

@media screen and (min-width: 992px) {
    .mobile-search-form {
        display: none !important;
    }
    
    .sidebar .search-widget {
        display: block !important;
    }
}
/* 🌙 DARK MODE — МОБИЛДИК АК АЙМАКТАРДЫ ОҢДОО */

/* 1. Мобилдик издөө формасынын фону */
body.dark-mode .mobile-search-form,
html[data-theme="dark"] .mobile-search-form {
    background: #1e1e1e !important;
    border-bottom-color: #333 !important;
}

/* 2. Слайдердин асты (Thumbnail'дар) */
body.dark-mode .slider-thumbnails,
html[data-theme="dark"] .slider-thumbnails {
    background: #1e1e1e !important;
}

body.dark-mode .thumb-item,
html[data-theme="dark"] .thumb-item {
    border-color: #333 !important;
}

body.dark-mode .thumb-item:hover,
html[data-theme="dark"] .thumb-item:hover {
    border-color: #e91e63 !important;
}

/* 3. Слайдер баскычтарынын фону (эгер ак болсо) */
body.dark-mode .slider-prev,
body.dark-mode .slider-next,
html[data-theme="dark"] .slider-prev,
html[data-theme="dark"] .slider-next {
    background: rgba(233, 30, 99, 0.95) !important;
}

/* 4. "АКЫРКЫ ЖАҢЫЛЫКТАР" / "АКЫРКЫ ЖАРЫЯЛАР" бөлүмдөрүнүн фону */
body.dark-mode .site-main h2,
html[data-theme="dark"] .site-main h2 {
    color: #e0e0e0 !important;
    border-bottom-color: #333 !important;
}

/* 5. Мобилдик карточкалардын фону */
body.dark-mode .news-card,
html[data-theme="dark"] .news-card {
    background: #1e1e1e !important;
}

body.dark-mode .news-card-content,
html[data-theme="dark"] .news-card-content {
    background: #1e1e1e !important;
}

/* 6. Мобилдик менюнун фону */
body.dark-mode .mobile-bottom-menu,
html[data-theme="dark"] .mobile-bottom-menu {
    background: #1a1a1a !important;
    border-top-color: #333 !important;
}

/* 7. Мобилдик версиядагы бардык input'тар */
body.dark-mode .search-form input[type="search"],
body.dark-mode .search-form input[type="text"],
html[data-theme="dark"] .search-form input[type="search"],
html[data-theme="dark"] .search-form input[type="text"] {
    background: #2a2a2a !important;
    color: #e0e0e0 !important;
    border-color: #444 !important;
}

body.dark-mode .search-form input[type="search"]::placeholder,
body.dark-mode .search-form input[type="text"]::placeholder,
html[data-theme="dark"] .search-form input[type="search"]::placeholder,
html[data-theme="dark"] .search-form input[type="text"]::placeholder {
    color: #999 !important;
}

/* 8. Издөө баскычы */
body.dark-mode .search-form input[type="submit"],
html[data-theme="dark"] .search-form input[type="submit"] {
    background: #1a4d2e !important;
    color: #fff !important;
}

/* 9. Жарыя карточкасынын ичиндеги ак аймактар */
body.dark-mode .ad-price,
html[data-theme="dark"] .ad-price {
    background: #3d1f1f !important;
    color: #ff6b6b !important;
}

body.dark-mode .announcement-single,
body.dark-mode .single-post,
html[data-theme="dark"] .announcement-single,
html[data-theme="dark"] .single-post {
    background: #1e1e1e !important;
}

/* 10. Footer (эгер ак болсо) */
body.dark-mode .site-footer,
html[data-theme="dark"] .site-footer {
    background: #1a1a1a !important;
    color: #aaa !important;
}

body.dark-mode .site-footer a,
html[data-theme="dark"] .site-footer a {
    color: #4ecdc4 !important;
}