/* === Сброс и базовые стили === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

a {
    color: var(--primary);
    text-decoration: none;
}

/* === Навигация === */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-logo {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

.nav-links {
    display: flex;
    gap: 16px;
    flex: 1;
}

.nav-links a {
    color: var(--text-light);
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-links a:hover {
    background: var(--bg);
    color: var(--primary);
}

/* === Основной контент === */
.main-content {
    min-height: calc(100vh - 140px);
    padding: 24px 0;
}

/* === Герой-секция === */
.hero {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius);
    margin-bottom: 40px;
}

.hero h1 {
    font-size: 2rem;
    margin-bottom: 12px;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 24px;
}

.hero-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* === Кнопки === */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

/* === Статистика === */
.stats-section {
    margin-bottom: 40px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* === Категории === */
.categories-section {
    margin-bottom: 40px;
}

.categories-section h2 {
    margin-bottom: 16px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.category-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: all 0.2s;
    color: var(--text);
}

.category-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.category-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.category-card h3 {
    margin-bottom: 8px;
}

.category-card p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* === Карточки === */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.card-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.card-photo {
    height: 180px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-photo {
    color: var(--text-light);
    font-size: 0.9rem;
}

.card-info {
    padding: 16px;
}

.card-category {
    display: inline-block;
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.card-info h3 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.card-district {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* === Фильтры === */
.filters-bar {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--text-light);
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
}

/* === Карта === */
.catalog-map {
    height: 300px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

/* === Пагинация === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:hover:not(.active) {
    background: var(--bg);
}

/* === Детальная карточка === */
.card-detail-page {
    max-width: 800px;
    margin: 0 auto;
}

.photo-carousel {
    position: relative;
    height: 400px;
    background: var(--bg);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.carousel-inner {
    display: flex;
    height: 100%;
    transition: transform 0.3s;
}

.carousel-inner img {
    min-width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 1.2rem;
    border-radius: 4px;
}

.carousel-btn.prev { left: 8px; }
.carousel-btn.next { right: 8px; }

.carousel-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.carousel-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
}

.carousel-dots .dot.active {
    background: white;
}

.card-detail-info {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.card-category-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    font-size: 0.8rem;
    padding: 4px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.card-meta {
    display: flex;
    gap: 16px;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.card-description {
    margin-bottom: 16px;
    white-space: pre-wrap;
}

.card-reward {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.card-contacts {
    background: var(--bg);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.card-actions {
    display: flex;
    gap: 12px;
}

/* === Формы === */
.response-form,
.comment-form {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-actions {
    display: flex;
    gap: 12px;
}

/* === Комментарии === */
.comments-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.comment-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-author {
    font-weight: 600;
    margin-bottom: 4px;
}

.comment-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* === Профиль === */
.profile-page {
    max-width: 800px;
    margin: 0 auto;
}

.profile-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.profile-card {
    display: flex;
    gap: 24px;
    align-items: start;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.profile-info {
    flex: 1;
}

/* === Помощники === */
.helpers-page {
    max-width: 800px;
    margin: 0 auto;
}

.helpers-intro {
    margin-bottom: 24px;
    color: var(--text-light);
}

.helpers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.helper-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    gap: 16px;
}

.helper-avatar {
    width: 50px;
    height: 50px;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.helper-info h3 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.helper-category,
.helper-district {
    font-size: 0.85rem;
    color: var(--text-light);
}

.helper-desc {
    font-size: 0.9rem;
    margin-top: 8px;
}

.become-helper-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
}

/* === Админ-панель === */
.admin-page {
    max-width: 1000px;
    margin: 0 auto;
}

.admin-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.admin-nav-link {
    padding: 8px 16px;
    border-radius: 6px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.admin-nav-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.admin-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.moderation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.moderation-info h3 {
    margin-bottom: 4px;
}

.moderation-info p {
    font-size: 0.85rem;
    color: var(--text-light);
}

.moderation-actions {
    display: flex;
    gap: 8px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: white;
}

.role-admin { background: var(--danger); }
.role-moderator { background: var(--warning); }
.role-helper { background: var(--success); }
.role-user { background: var(--secondary); }

/* === Утилиты === */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.error {
    text-align: center;
    padding: 40px;
    color: var(--danger);
}

/* === Адаптив === */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.5rem;
    }

    .nav-links {
        display: none;
    }

    .filters-bar {
        flex-direction: column;
    }

    .profile-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .photo-carousel {
        height: 250px;
    }

    .card-actions {
        flex-direction: column;
    }
}
