/* ==================== ئاساسىي ==================== */
:root {
    --bg: #f5f6f8;
    --bg-card: #ffffff;
    --text: #1f2937;
    --text-light: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --primary: #1a1a2e;
    --primary-light: #0f3460;
    --accent: #e94560;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 1px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
    --radius: 10px;
    --radius-sm: 6px;
}

[data-theme="dark"] {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --text: #e5e7eb;
    --text-light: #9ca3af;
    --text-muted: #6b7280;
    --border: #2d3040;
    --border-light: #252836;
    --shadow: 0 1px 4px rgba(0,0,0,0.2);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'UKIJ Ekran', 'Segoe UI', Tahoma, sans-serif; background: var(--bg); color: var(--text); line-height: 1.7; min-height: 100vh; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ==================== كۇنۇپكىلار ==================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--border-light); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ==================== باشلىنىش ==================== */
.header { background: var(--bg-card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1100px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; height: 56px; gap: 20px; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: bold; color: var(--accent); }
.logo-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.nav-links { display: flex; gap: 4px; }
.nav-link { padding: 6px 14px; border-radius: 6px; font-size: 13px; color: var(--text-light); transition: all 0.2s; }
.nav-link:hover, .nav-link.active { background: var(--primary); color: #fff; }
.header-actions { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.user-menu { display: flex; align-items: center; gap: 8px; }
.user-name { font-size: 13px; color: var(--text-light); }
.theme-toggle { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-card); cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.theme-icon { line-height: 1; }

/* ==================== ئاساسىي ==================== */
.main-content { padding: 20px 0 40px; }

/* باننېر */
.banner-section { position: relative; margin-bottom: 20px; border-radius: var(--radius); overflow: hidden; }
.banner-slider { position: relative; height: 220px; }
.banner-slide { position: absolute; inset: 0; opacity: 0; transition: opacity 0.5s; }
.banner-slide.active { opacity: 1; }
.banner-slide img { width: 100%; height: 100%; object-fit: cover; }
.banner-dots { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.5); cursor: pointer; transition: all 0.2s; }
.dot.active { background: #fff; width: 22px; border-radius: 4px; }

/* ستاتىستىكا */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-item { background: var(--bg-card); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat-num { display: block; font-size: 24px; font-weight: bold; color: var(--accent); }
.stat-lbl { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* تۈرلەر */
.categories-wrap { margin-bottom: 16px; }
.categories-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.categories-scroll::-webkit-scrollbar { height: 0; }
.cat-chip { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 16px; border-radius: var(--radius); background: var(--bg-card); border: 2px solid var(--border); min-width: 80px; text-align: center; font-size: 12px; color: var(--text); transition: all 0.2s; flex-shrink: 0; }
.cat-chip:hover { border-color: var(--primary-light); }
.cat-chip.active { border-color: var(--primary-light); background: #eef2ff; color: var(--primary-light); font-weight: bold; }
[data-theme="dark"] .cat-chip.active { background: #1e2040; }
.cat-icon { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #667EEA, #764BA2); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; font-weight: bold; }
.cat-img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

/* سۈزگۈچ */
.filter-bar-wrap { margin-bottom: 20px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filt-select { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; background: var(--bg-card); color: var(--text); }
.search-wrap { display: flex; gap: 6px; flex: 1; min-width: 180px; }
.search-inp { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; background: var(--bg-card); color: var(--text); }

/* ئېلان كارتىسى */
.posts-header { margin-bottom: 14px; }
.posts-header h3 { font-size: 16px; color: var(--text-light); }
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.post-card { background: var(--bg-card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: all 0.2s; display: block; }
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.post-img-wrap { position: relative; height: 180px; overflow: hidden; }
.post-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.img-count { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.6); color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.post-info { padding: 14px; }
.post-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.tag-district { background: #eef2ff; color: #4f46e5; }
.tag-price { background: #fef3c7; color: #92400e; font-weight: bold; }
[data-theme="dark"] .tag-district { background: #1e2040; color: #818cf8; }
[data-theme="dark"] .tag-price { background: #3d2e00; color: #fbbf24; }
.post-text { font-size: 14px; line-height: 1.6; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text); }
.post-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-muted); padding-top: 8px; border-top: 1px solid var(--border-light); }
.post-phone { direction: ltr; }

/* بەت ئالماشتۇرۇش */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 24px; }
.page-link { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--bg-card); border: 1px solid var(--border); font-size: 13px; color: var(--text); transition: all 0.2s; }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* بوش */
.empty-box { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--border-light); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: bold; margin: 0 auto 12px; }

/* ئاستى */
.footer { background: var(--bg-card); border-top: 1px solid var(--border); padding: 30px 0 16px; margin-top: 30px; }
.footer-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 20px; }
.footer-col h4 { font-size: 14px; margin-bottom: 8px; }
.footer-col p { font-size: 12px; color: var(--text-light); line-height: 1.8; }
.footer-copy { text-align: center; padding-top: 12px; border-top: 1px solid var(--border-light); font-size: 11px; color: var(--text-muted); }

/* ==================== تەپسىلات بېتى ==================== */
.detail-page { max-width: 800px; margin: 0 auto; }
.detail-back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-light); font-size: 13px; margin-bottom: 14px; }
.detail-images-wrap { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 16px; }
.detail-images-wrap img { width: 220px; height: 160px; object-fit: cover; border-radius: 8px; cursor: pointer; flex-shrink: 0; }
.detail-card { background: var(--bg-card); border-radius: var(--radius); padding: 22px; margin-bottom: 14px; box-shadow: var(--shadow); }
.detail-price { font-size: 26px; font-weight: bold; color: var(--danger); margin-bottom: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.detail-item { background: var(--border-light); padding: 12px; border-radius: 8px; }
.detail-label { font-size: 11px; color: var(--text-light); margin-bottom: 3px; }
.detail-value { font-size: 14px; font-weight: 600; }
.detail-value.phone { direction: ltr; }
.detail-content { font-size: 15px; line-height: 2; white-space: pre-wrap; }
.detail-actions { display: flex; gap: 10px; margin-top: 16px; }
.detail-actions .btn { flex: 1; text-align: center; }

/* ==================== كىرىش/تىزىملىتىش ==================== */
.login-page { max-width: 420px; margin: 60px auto; }
.login-card { background: var(--bg-card); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow-lg); }
.login-card h2 { text-align: center; font-size: 22px; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--text-light); font-size: 13px; margin-bottom: 24px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.form-group input { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; background: var(--bg-card); color: var(--text); }
.form-group input:focus { outline: none; border-color: var(--primary-light); }
.form-actions { margin-top: 20px; }
.form-actions .btn { width: 100%; }

/* ==================== ئېلان يوللاش ==================== */
.post-page { max-width: 700px; margin: 0 auto; }
.post-page h2 { font-size: 22px; margin-bottom: 20px; }
.post-form-card { background: var(--bg-card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-group select, .form-group textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; background: var(--bg-card); color: var(--text); }
.form-group textarea { resize: vertical; min-height: 100px; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }

/* ==================== رەئاكتىپ ==================== */
@media (max-width: 768px) {
    .header-inner { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
    .nav-links { order: 3; width: 100%; overflow-x: auto; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .posts-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .banner-slider { height: 150px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-wrap { min-width: auto; }
}

@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
    .banner-slider { height: 120px; }
}