/* ============================================================
   СвояТропа - ОСНОВНЫЕ СТИЛИ (оптимизировано)
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2E7D32;
    --primary-dark: #1B5E20;
    --primary-light: #66BB6A;
    --secondary: #FF8F00;
    --dark: #1B2A1F;
    --gray-dark: #4A5D4E;
    --gray: #78909C;
    --gray-light: #E8F5E9;
    --light: #F1F8E9;
    --white: #FFFFFF;
    --danger: #E53935;
    --success: #43A047;
    --warning: #FB8C00;
    --shadow: 0 8px 24px rgba(27, 42, 31, 0.12);
    --shadow-lg: 0 16px 40px rgba(46, 125, 50, 0.15);
    --border-radius: 20px;
    --border-radius-sm: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: var(--light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ========== ШАПКА ========== */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid var(--primary);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.05);
}

.nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-link {
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 0;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary);
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--dark);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--dark);
    padding: 6px 12px;
    border-radius: 25px;
    transition: var(--transition);
}

.user-profile-link:hover {
    background: var(--light);
}

.user-avatar-display {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.user-name-display {
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========== АКТИВНЫЕ ССЫЛКИ В МЕНЮ ========== */
.nav-link.active {
    color: #2E7D32;
    font-weight: bold;
    border-bottom: 2px solid #2E7D32;
}

/* Альтернативный вариант - через класс body */
.page-home .nav-link[href="/"],
.page-routes .nav-link[href="/routes"],
.page-gallery .nav-link[href="/gallery"],
.page-forum .nav-link[href="/forum"],
.page-create-route .nav-link[href="/create-route"],
.page-profile .user-profile-link,
.page-admin .nav-link[href="/admin"] {
    color: #2E7D32;
    font-weight: bold;
    border-bottom: 2px solid #2E7D32;
}

/* Для ссылки профиля в user-menu */
.user-profile-link.active {
    color: #2E7D32;
    font-weight: bold;
}

.user-profile-link.active .user-name-display {
    color: #2E7D32;
}

/* ========== КНОПКИ ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-small {
    padding: 6px 16px;
    font-size: 0.85rem;
}

.btn-large {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c62828;
}

/* ========== ГЕРОЙ-БЛОК ========== */
.hero {
    position: relative;
    width: 100%;
    min-height: 500px;
    max-height: 600px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-video-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.5) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
    padding: 40px 20px;
    animation: fadeInUp 1s ease-out;
    width: 100%;
    max-width: 900px;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 20px;
    text-shadow: 3px 3px 12px rgba(0, 0, 0, 0.6);
    line-height: 1.2;
}

.hero-title span {
    display: block;
    font-size: 1.2rem;
    font-weight: normal;
    color: var(--secondary);
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}

.hero-subtitle {
    font-size: 1.15rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.5);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.hero-subtitle strong {
    color: var(--secondary);
}

.hero-stats {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-top: 20px;
}

.stat-item {
    text-align: center;
    animation: fadeInUp 1s ease-out 0.5s both;
}

.stat-icon {
    font-size: 2rem;
    color: var(--secondary);
    margin-bottom: 10px;
    display: block;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--secondary);
    display: block;
}

.stat-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.9);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== ССЫЛКА "РАСШИРЕННЫЙ ФИЛЬТР" ========== */
.filter-header .more-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.filter-header .more-link i {
    transition: transform 0.2s ease;
}

.filter-header .more-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.filter-header .more-link:hover i {
    transform: translateX(4px);
}

/* ========== ФИЛЬТРЫ ========== */
.filters {
    background: white;
    padding: 30px 0;
    border-bottom: 1px solid #eee;
}

.filter-header {
    text-align: center;
    margin-bottom: 25px;
}

.filter-header h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    color: var(--dark);
}

.filter-header p {
    color: var(--gray);
}

/* ========== ПОПУЛЯРНЫЕ РЕГИОНЫ/ГОРОДА ========== */
.popular-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 20px;
}

.popular-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.popular-title i {
    color: #FFC107;
}

.region-badge {
    background: #E8F5E9;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #2E7D32;
}

.popular-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.popular-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: white;
    border: 1px solid #E8F5E9;
    border-radius: 30px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: all 0.3s;
}

.popular-tag:hover {
    background: #2E7D32;
    color: white;
    border-color: #2E7D32;
    transform: translateY(-2px);
}

.popular-tag .count {
    background: #E8F5E9;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    color: #2E7D32;
}

.popular-tag:hover .count {
    background: white;
    color: #2E7D32;
}

/* ========== АКТИВНЫЕ ПОПУЛЯРНЫЕ ТЕГИ ========== */
.popular-tag.active {
    background: #2E7D32;
    color: white;
    border-color: #2E7D32;
}

.popular-tag.active i {
    color: white;
}

.popular-tag.active .count {
    background: white;
    color: #2E7D32;
}

/* ========== КАТАЛОГ МАРШРУТОВ ========== */
.catalog {
    padding: 40px 0;
}

.routes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.route-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.route-card:hover {
    transform: translateY(-5px);
}

.card-img {
    height: 180px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    position: relative;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
}

.card-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    font-size: 0.8rem;
    color: white;
}

.card-region {
    position: absolute;
    left: 15px;
    bottom: 15px;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--primary);
}

/* Кнопка избранного */
.favorite-icon {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.favorite-icon:hover {
    transform: scale(1.1);
}

.favorite-icon i {
    color: #999;
    transition: color 0.2s;
}

.favorite-icon i.fas {
    color: #e53935;
}

/* Кнопка избранного на карточке маршрута */
.route-card .favorite-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.route-card .favorite-icon i {
    font-size: 1rem;
}

.card-content {
    padding: 20px;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.author-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.author-rating {
    margin-left: auto;
    color: var(--secondary);
    font-size: 0.8rem;
}

.card-title {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.card-desc {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 12px;
    line-height: 1.4;
}

.card-meta {
    display: flex;
    gap: 15px;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 15px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.card-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

/* ========== КАК ЭТО РАБОТАЕТ ========== */
.how-it-works {
    background: #f5f5f5;
    padding: 60px 0;
    margin: 40px 0;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--dark);
}

.section-subtitle {
    text-align: center;
    color: #666;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.step-card {
    text-align: center;
    padding: 30px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.step-card:hover {
    transform: translateY(-5px);
}

.step-icon {
    font-size: 3rem;
    color: #2E7D32;
    margin-bottom: 15px;
}

.step-card h3 {
    margin-bottom: 10px;
    color: var(--dark);
}

.step-card p {
    color: var(--gray);
}

/* ========== ГАЛЕРЕЯ ========== */
.gallery-section {
    padding: 60px 0;
    background: var(--light);
}

.gallery-header {
    text-align: center;
    margin-bottom: 30px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.gallery-item {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.gallery-item:hover {
    transform: translateY(-5px);
}

.gallery-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.gallery-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gallery-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.author-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2E7D32;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
}

.gallery-rating {
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 11px;
    color: #FFC107;
}

.gallery-rating i {
    font-size: 11px;
}

.load-more-wrapper {
    text-align: center;
    margin-top: 40px;
}

/* ========== ПРОФИЛЬ ========== */
.profile-page {
    padding: 30px 0;
}

.profile-header {
    background: linear-gradient(135deg, #2E7D32, #1B5E20);
    border-radius: 24px;
    padding: 40px;
    color: white;
    margin-bottom: 30px;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid white;
    object-fit: cover;
}

.profile-avatar-wrapper {
    position: relative;
}

.btn-change-avatar {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-change-avatar:hover {
    background: #2E7D32;
    transform: scale(1.05);
}

.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #2E7D32;
}

.profile-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #E8F5E9;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
}

.tab-btn.active {
    border-bottom: 3px solid #2E7D32;
    color: #2E7D32;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.route-item,
.purchased-item,
.favorite-item {
    background: white;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.form-group {
    margin-bottom: 20px;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #E8F5E9;
    border-radius: 12px;
    font-size: 1rem;
}

.badge {
    background: #E8F5E9;
    color: #2E7D32;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: inline-block;
}

.status-pending {
    color: orange;
}

.status-approved {
    color: green;
}

.success-message {
    background: #E8F5E9;
    color: #2E7D32;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 15px;
}

.error-message {
    background: #FFEBEE;
    color: #C62828;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 15px;
}

/* ========== ПОДВАЛ ========== */
.footer {
    background: var(--dark);
    color: white;
    padding: 40px 0 20px;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

.footer-col h4 {
    margin-bottom: 15px;
    color: var(--primary-light);
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 8px;
    opacity: 0.8;
}

.footer-col a {
    color: white;
    text-decoration: none;
}

.footer-col a:hover {
    color: var(--primary-light);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ========== АДАПТАЦИЯ ========== */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .nav {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .nav.active {
        display: flex;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-stats {
        gap: 20px;
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .routes-grid {
        grid-template-columns: 1fr;
    }

    .steps-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 20px;
    }

    .profile-info {
        flex-direction: column;
        text-align: center;
    }

    .profile-tabs {
        justify-content: center;
    }

    .route-item,
    .purchased-item,
    .favorite-item {
        flex-direction: column;
        text-align: center;
    }

    .gallery-rating i {
        font-size: 9px;
    }

    .search-form {
        flex-direction: column;
    }

    .dropdown-container {
        flex-direction: column;
        align-items: center;
    }

    .custom-dropdown {
        width: 100%;
        max-width: 300px;
    }
}

/* ========== ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ ========== */
.catalog-anchor {
    scroll-margin-top: 80px;
}

html {
    scroll-behavior: smooth;
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

.empty-state {
    text-align: center;
    padding: 60px;
    background: white;
    border-radius: 16px;
}

.empty-state i {
    font-size: 4rem;
    color: #ccc;
    margin-bottom: 15px;
}