/* --- ГЛОБАЛЬНЫЕ НАСТРОЙКИ --- */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&display=swap');
:root {
    --font-main: 'Manrope', sans-serif;
    --color-bg-light: #F9FAFB;
    --color-bg-white: #FFFFFF;
    --color-text-primary: #111827;
    --color-text-secondary: #6B7280;
    --color-text-tertiary: #9CA3AF;
    --color-border: #E5E7EB;
    --color-accent: #F97316;
    --color-accent-hover: #EA580C;
    --color-accent-light: #FFF7ED;
    --color-verified: #10B981;
    --color-positive: #10B981;
    --color-negative: #EF4444;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --border-radius: 12px;
}

/* === ТЕМНАЯ ТЕМА === */
body.dark-theme {
    --color-bg-light: #0D1117;
    --color-bg-white: #161B22;
    --color-text-primary: #E6EDF3;
    --color-text-secondary: #8B949E;
    --color-text-tertiary: #484F58;
    --color-border: #E5E7EB;
    --color-accent: #F97316;
    --color-accent-hover: #EA580C;
    --color-accent-light: #FFF7ED;
    --color-verified: #30A46C;
    --shadow-soft: 0 4px 6px -1px rgba(0,0,0,0.2), 0 2px 4px -1px rgba(0,0,0,0.15);
    --shadow-strong: 0 10px 15px -3px rgba(0,0,0,0.3), 0 4px 6px -2px rgba(0,0,0,0.25);
}

html {
    font-family: var(--font-main);
    background-color: var(--color-bg-light);
    color: var(--color-text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}
body { background-color: var(--color-bg-light); }

/* --- ОСНОВНАЯ СТРУКТУРА ДАШБОРДА --- */
.dashboard-layout { display: flex; min-height: 100vh; }


/* --- САЙДБАР --- */
.dashboard-sidebar {
    width: 260px; background-color: var(--color-bg-white); border-right: 1px solid var(--color-border);
    display: flex; flex-direction: column; padding: 25px; flex-shrink: 0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.sidebar-logo { display: flex; align-items: center; gap: 8px; font-size: 1.8rem; font-weight: 800; text-decoration: none; color: var(--color-text-primary); margin-bottom: 40px; }
.logo-dot { display: inline-block; width: 0.5em; height: 0.5em; background-color: #F97316; border-radius: 50%; }
.sidebar-nav { flex-grow: 1; }
.nav-item { display: flex; align-items: center; padding: 12px 15px; margin-bottom: 8px; border-radius: 8px; text-decoration: none; color: var(--color-text-secondary); font-weight: 600; transition: all 0.2s ease; cursor: pointer; }
.nav-item i { width: 30px; font-size: 1.1rem; }
.nav-item:hover { background-color: var(--color-accent-light); color: var(--color-accent); }
.nav-item.active { background-color: var(--color-accent); color: white; }
.badge { margin-left: auto; background-color: var(--color-negative); color: white; font-size: 0.75rem; border-radius: 20px; padding: 2px 8px; }

/* --- ОСНОВНОЙ КОНТЕНТ --- */
.dashboard-content { flex-grow: 1; padding: 40px; overflow-y: auto; }
.content-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 40px; }
.content-header h1 { font-size: 2rem; margin: 0; }
.content-header p { color: var(--color-text-secondary); margin-top: 5px; }
.btn-add-listing { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; background-color: #F97316; color: white; text-decoration: none; border-radius: 8px; font-weight: 700; transition: background-color 0.2s; }
.btn-add-listing:hover { background-color: #EA580C; }

/* --- СТАТИСТИКА --- */
.stats-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 25px; margin-bottom: 40px; }
.stat-card { background-color: var(--color-bg-white); border-radius: var(--border-radius); padding: 25px; border: 1px solid var(--color-border); display: flex; align-items: center; gap: 20px; transition: all 0.2s ease; }
.stat-card__icon { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.stat-card__icon.views { background-color: #E0F2FE; color: #0EA5E9; }
.stat-card__icon.clicks { background-color: #FEF3C7; color: #F59E0B; }
.stat-card__icon.favorites { background-color: #FEE2E2; color: #EF4444; }
.stat-card__icon.contacts { background-color: var(--color-accent-light); color: var(--color-accent); }
.stat-card__info { display: flex; flex-direction: column; }
.stat-card__title { color: var(--color-text-secondary); font-size: 0.9rem; }
.stat-card__value { font-size: 1.8rem; font-weight: 800; }
.stat-card__trend { font-weight: 600; font-size: 0.8rem; }
.stat-card__trend.positive { color: var(--color-positive); }
.stat-card__trend.negative { color: var(--color-negative); }

.chart-container { background-color: var(--color-bg-white); border-radius: var(--border-radius); padding: 25px; border: 1px solid var(--color-border); transition: all 0.2s ease; }
.chart-container h3 { margin-top: 0; margin-bottom: 25px; font-size: 1.25rem; }
.chart-wrapper { position: relative; max-height: 400px; }

/* --- ОБЪЯВЛЕНИЯ --- */
.listings-section { margin-top: 40px; }
.listings-section h2 { font-size: 1.5rem; margin-bottom: 20px; }
.listing-item { display: flex; align-items: center; background-color: var(--color-bg-white); border: 1px solid var(--color-border); border-radius: var(--border-radius); padding: 20px; margin-bottom: 15px; gap: 20px; transition: all 0.2s ease; }
.listing-info { flex-grow: 1; }
.listing-status { display: inline-block; padding: 4px 10px; font-size: 0.8rem; font-weight: 700; border-radius: 20px; margin-bottom: 10px; }
.listing-status.status--active { background-color: #D1FAE5; color: #065F46; }
.listing-status.status--paused { background-color: #FEF3C7; color: #92400E; }
.listing-title { font-size: 1.1rem; margin: 0; }
.listing-category { font-size: 0.9rem; color: var(--color-text-secondary); }
.listing-stats { display: flex; gap: 20px; color: var(--color-text-secondary); }
.listing-stats span { display: flex; align-items: center; gap: 5px; }
.listing-actions { display: flex; gap: 10px; }
.action-btn { background: none; border: 1px solid var(--color-border); width: 40px; height: 40px; border-radius: 50%; cursor: pointer; color: var(--color-text-secondary); transition: all 0.2s ease; }
.action-btn:hover { background-color: var(--color-bg-light); color: var(--color-text-primary); }
.action-btn.action-btn--danger:hover { background-color: #FEE2E2; color: var(--color-negative); border-color: #FEE2E2; }

.mobile-filter-btn, .bottom-bar { display: none; }

.btn-apply, .btn-chat, .category-button, .category-tile, .view-switcher button, .bottom-bar-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
/* --- МОБИЛЬНЫЕ КОМПОНЕНТЫ --- */
.mobile-header, .bottom-bar { display: none; }
html.dark-theme .bottom-bar { background-color: rgba(31, 41, 55, 0.85); }
.header-logo { display: flex; align-items: center; gap: 8px; font-size: 1.8rem; font-weight: 800; text-decoration: none; color: var(--color-text-primary); flex-shrink: 0; }
.logo-dot {
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    background-color: var(--color-accent);
    border-radius: 50%;
    transform: translateY(0.1em);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

}
.logo-dot {
    box-shadow: 0 0 10px 0 var(--color-accent);
}
/*
 *  --- СТИЛИ ПЕРЕКЛЮЧАТЕЛЯ ТЕМЫ ---
 */
.theme-toggle-btn svg, .theme-switch svg {
    width: 22px; height: 22px; stroke: var(--color-accent);
    transition: transform 0.3s ease, color 0.3s ease;
}
.theme-toggle-btn:hover svg { transform: scale(1.1) rotate(15deg); }

.sun-icon { display: block; }
.moon-icon { display: none; }
html.dark-theme .sun-icon { display: none; }
html.dark-theme .moon-icon { display: block; }

.theme-toggle-btn {
    background: none; border: none; padding: 5px; cursor: pointer; color: var(--color-text-secondary);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.theme-toggle-btn:hover { color: var(--color-accent); background-color: var(--color-bg-light); }

.theme-toggle-mobile-wrapper {
    border-top: 1px solid var(--color-border); padding-top: 25px; margin-top: 25px;
    transition: border-color 0.3s ease;
}


.theme-switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.theme-switch .switch-label-text { font-weight: 600; }
.theme-switch input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }

.switch-slider {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 52px; height: 28px; background-color: var(--color-border);
    border-radius: 14px; transition: background-color 0.3s ease;
}
.switch-slider::before {
    content: ''; position: absolute; left: 3px; width: 22px; height: 22px;
    background-color: white; border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); z-index: 1;
}
.theme-switch input:checked + .switch-slider { background-color: var(--color-accent); }
.theme-switch input:checked + .switch-slider::before { transform: translateX(24px); }

.switch-slider .sun-icon, .switch-slider .moon-icon {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; pointer-events: none; z-index: 0;
}
.switch-slider .sun-icon { right: 7px; color: #FBBF24; }
.switch-slider .moon-icon { left: 7px; color: #a6c5f7; }

/* --- АДАПТИВНОСТЬ --- */
@media (max-width: 1200px) { .stats-overview { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 992px) {
    .desktop-only { display: none !important; }
    .dashboard-layout { display: block; }
    .dashboard-content { padding: 80px 15px 85px; }
    .mobile-header {
        display: flex; justify-content: space-between; align-items: center; position: fixed;
        top: 0; left: 0; width: 100%; height: 60px; padding: 0 15px; box-sizing: border-box;
        background-color: rgba(255,255,255,0.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--color-border); z-index: 1000; transition: all 0.3s ease;
    }
    .mobile-header__actions { display: flex; align-items: center; gap: 15px; }
    .mobile-header__actions a svg { width: 22px; height: 22px; color: var(--color-text-secondary); }
    .mobile-header__title { font-size: 1.3rem; margin: 0; }
    .mobile-header__actions { display: flex; align-items: center; gap: 15px; }
    .mobile-header__actions a, .mobile-header__actions .theme-toggle-btn { color: var(--color-text-primary); font-size: 1.3rem; }
    .mobile-header__avatar { width: 32px; height: 32px; border-radius: 50%; }
    .content-header { flex-direction: column; gap: 15px; align-items: flex-start; margin-bottom: 30px; }
    .content-header h1 { font-size: 1.5rem; }
    .btn-add-listing { width: 100%; justify-content: center; padding: 15px; }
    .stats-overview { grid-template-columns: repeat(2, 1fr); gap: 15px; }
    .stat-card { padding: 15px; gap: 15px; }
    .stat-card__value { font-size: 1.5rem; }
    .chart-wrapper { max-height: 250px; }
    .listings-section h2 { font-size: 1.3rem; }
    .listing-item { flex-direction: column; align-items: flex-start; gap: 15px; }
    .listing-actions { width: 100%; border-top: 1px solid var(--color-border); padding-top: 15px; justify-content: space-around; }
    .bottom-bar {
        display: flex; position: fixed; bottom: 0; left: 0; width: 100%; height: 65px;
        background-color: var(--color-bg-white); border-top: 1px solid var(--color-border);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 1001; justify-content: space-around;
        align-items: center; padding-bottom: 10px; transition: all 0.3s ease;
    }
    .bottom-bar, .category-grid-mobile { display: flex; }
    .bottom-bar-item { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--color-text-secondary); font-size: 0.7rem; font-weight: 600; gap: 4px; }
    .bottom-bar-item i { font-size: 1.4rem; }
    .bottom-bar-item.active { color: var(--color-accent); }
    .bottom-bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--color-text-tertiary); font-size: 0.7rem; font-weight: 500; gap: 4px; }
    .bottom-bar-item svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.52; }
    .bottom-bar-item.active { color: var(--color-accent); }
    .bottom-bar-item.active svg { stroke-width: 2; }
}
@media (max-width: 400px) { .stats-overview { grid-template-columns: 1fr; } }

/*
 *  --- ТЕМНАЯ ТЕМА ---
 */
html.dark-theme {
    --color-bg-light: #111827;
    --color-bg-white: #1F2937;
    --color-text-primary: #F9FAFB;
    --color-text-secondary: #9CA3AF;
    --color-border: #374151;
    --color-accent-light: rgba(94, 80, 243, 0.15);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.25);
}
html.dark-theme .listing-status.status--active { background-color: #064E3B; color: #A7F3D0; }
html.dark-theme .listing-status.status--paused { background-color: #78350F; color: #FDE68A; }
html.dark-theme .action-btn.action-btn--danger:hover { background-color: rgba(239, 68, 68, 0.1); border-color: transparent; }
html.dark-theme .mobile-header { background-color: rgba(31, 41, 55, 0.85); }