/* Мобильная адаптация страниц маршрутов /route/* */

@media (max-width: 768px) {
    /* Контейнер страницы маршрута */
    .route-page {
        padding: 1rem;
    }

    /* Заголовок маршрута */
    .route-header {
        padding: 1.5rem 1rem;
        margin: 0 -1rem 1.5rem;
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
        border-radius: 0 0 24px 24px;
        color: white;
    }

    .route-title {
        font-size: 1.5rem !important;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }

    .route-subtitle {
        font-size: 0.9rem;
        opacity: 0.9;
    }

    /* Hero секция - оптимизация для мобильных */
    .route-hero {
        min-height: auto !important;
        height: auto !important;
        padding: 80px 1rem 2rem !important;
    }

    .hero-content {
        padding: 1rem !important;
        max-width: 100% !important;
    }

    .hero-content h1 {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
        margin-bottom: 0.75rem !important;
    }

    .hero-subtitle {
        font-size: 0.9rem !important;
        margin-bottom: 1.5rem !important;
    }

    /* Price info block - адаптация для мобильных */
    .price-info-block {
        display: flex !important;
        flex-direction: row !important;
        padding: 0.75rem 0.5rem !important;
        margin: 0 !important;
        gap: 8px !important;
        border-radius: 12px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        justify-content: space-between !important;
    }

    .price-info-item {
        flex: 1 !important;
        padding: 0.5rem 0.25rem !important;
        min-width: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .price-info-label {
        font-size: 0.65rem !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
    }

    .price-info-value {
        font-size: 0.95rem !important;
        text-align: center !important;
        white-space: nowrap !important;
    }

    /* CTA кнопка */
    .cta-button {
        width: 100% !important;
        padding: 14px 20px !important;
        font-size: 0.95rem !important;
        justify-content: center !important;
    }

    /* Info grid под hero - компактнее на мобильных */
    .route-info {
        padding: 1.5rem 1rem !important;
        margin-top: 1.5rem !important;
    }

    .info-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .info-card {
        padding: 1rem !important;
    }

    .info-card h3 {
        font-size: 1.1rem !important;
    }

    .info-card p {
        font-size: 0.8rem !important;
    }

    /* Таблица цен → Адаптивные карточки */
    /* Скрываем thead и переделываем таблицу в карточки */
    .pricing-table thead {
        display: none !important;
    }

    .pricing-table,
    .pricing-table tbody {
        display: block !important;
        width: 100% !important;
    }

    .pricing-table tr {
        display: block !important;
        background: white !important;
        border-radius: 12px !important;
        padding: 1rem !important;
        margin-bottom: 1rem !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
        border: 1px solid #e5e7eb !important;
        position: relative !important;
    }

    .pricing-table td {
        display: block !important;
        text-align: left !important;
        padding: 0.5rem 0 !important;
        border: none !important;
        position: relative !important;
        padding-left: 50% !important;
    }

    /* Добавляем метки перед каждым значением */
    .pricing-table td:before {
        content: attr(data-label);
        position: absolute !important;
        left: 0 !important;
        width: 45% !important;
        font-weight: 600 !important;
        color: #64748b !important;
        font-size: 0.85rem !important;
    }

    /* Первая ячейка (вес) - делаем заголовком */
    .pricing-table td:first-child {
        font-size: 1.2rem !important;
        font-weight: 700 !important;
        color: #0f172a !important;
        padding-left: 0 !important;
        padding-bottom: 0.75rem !important;
        margin-bottom: 0.5rem !important;
        border-bottom: 1px solid #e5e7eb !important;
    }

    .pricing-table td:first-child:before {
        display: none !important;
    }

    /* Кнопка заказа на всю ширину */
    .pricing-table td:last-child {
        padding-left: 0 !important;
        padding-top: 1rem !important;
    }

    .pricing-table td:last-child:before {
        display: none !important;
    }

    .pricing-table button {
        width: 100% !important;
        min-height: 44px !important;
        font-size: 1rem !important;
        padding: 12px 20px !important;
        border-radius: 8px !important;
    }

    /* SEO контент */
    .route-seo-content {
        padding: 1.5rem 1rem;
        background: white;
        border-radius: 16px;
        margin: 1.5rem 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    .route-seo-content h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
        color: #0f172a;
    }

    .route-seo-content h3 {
        font-size: 1.1rem;
        margin-top: 1.5rem;
        margin-bottom: 0.75rem;
        color: #1e293b;
    }

    .route-seo-content p {
        font-size: 1rem;
        line-height: 1.7;
        color: #475569;
        margin-bottom: 1rem;
    }

    .route-seo-content ul,
    .route-seo-content ol {
        padding-left: 1.5rem;
        margin-bottom: 1rem;
    }

    .route-seo-content li {
        margin-bottom: 0.5rem;
        line-height: 1.6;
    }

    /* Карта маршрута */
    .route-map {
        width: 100% !important;
        height: 300px !important;
        border-radius: 16px;
        overflow: hidden;
        margin: 1.5rem 0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    /* Кнопка заказа */
    .route-order-button {
        position: sticky;
        bottom: 16px;
        left: 0;
        right: 0;
        width: calc(100% - 2rem);
        margin: 0 1rem;
        padding: 16px 24px;
        background: linear-gradient(135deg, #2563eb, #1d4ed8);
        color: white;
        border: none;
        border-radius: 12px;
        font-size: 1.1rem;
        font-weight: 600;
        box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
        cursor: pointer;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        z-index: 100;
    }

    .route-order-button:active {
        transform: scale(0.98);
    }

    /* Информационные блоки */
    .route-info-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
        margin: 1.5rem 0;
    }

    .route-info-card {
        background: #f8fafc;
        border-radius: 12px;
        padding: 1rem;
        border-left: 4px solid #2563eb;
    }

    .route-info-card h4 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
        color: #0f172a;
    }

    .route-info-card p {
        font-size: 0.9rem;
        color: #64748b;
        margin: 0;
    }

    /* Похожие маршруты */
    .related-routes {
        margin: 2rem 0;
    }

    .related-routes h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
        padding: 0 1rem;
    }

    .related-routes-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
        padding: 0 1rem !important;
        margin-bottom: 1.5rem !important;
    }

    /* Стили для ссылок-карточек внутри сетки */
    .related-routes-grid a {
        padding: 1rem !important;
        margin-bottom: 0 !important;
        display: block !important;
    }

    /* Стили для заголовка карточки (название маршрута) */
    .related-routes-grid a > div:first-child {
        font-size: 1rem !important;
        margin-bottom: 6px !important;
        font-weight: 600 !important;
        color: #1e293b !important;
    }

    /* Стили для нижнего текста (Рассчитать стоимость →) */
    .related-routes-grid a > div:last-child {
        font-size: 0.85rem !important;
        color: #64748b !important;
    }

    .related-route-card {
        background: white;
        border-radius: 12px;
        padding: 1rem;
        border: 1px solid #e5e7eb;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-decoration: none;
        color: inherit;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .related-route-card:active {
        transform: scale(0.98);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .related-route-name {
        font-weight: 600;
        color: #0f172a;
    }

    .related-route-price {
        font-weight: 700;
        color: #2563eb;
    }

    /* Спойлер для скрытых маршрутов */
    .related-routes-hidden {
        display: none;
    }

    .related-routes-hidden.show {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
        padding: 0 1rem !important;
        margin-top: 0.75rem !important;
    }

    .show-more-routes {
        display: block;
        width: calc(100% - 2rem);
        margin: 1rem auto 0;
        padding: 12px 20px;
        background: white;
        border: 2px solid #e5e7eb;
        border-radius: 12px;
        color: #1e293b;
        font-size: 0.95rem;
        font-weight: 600;
        text-align: center;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .show-more-routes:active {
        transform: scale(0.98);
        background: #f8fafc;
    }

    .show-more-routes svg {
        display: inline-block;
        margin-left: 8px;
        transition: transform 0.3s ease;
    }

    .show-more-routes.active svg {
        transform: rotate(180deg);
    }

    /* Safe area для iPhone X+ */
    @supports (padding: env(safe-area-inset-bottom)) {
        .route-order-button {
            bottom: max(16px, env(safe-area-inset-bottom));
            padding-bottom: max(16px, calc(16px + env(safe-area-inset-bottom)));
        }
    }
}

/* Для очень маленьких экранов */
@media (max-width: 375px) {
    .route-title {
        font-size: 1.3rem !important;
    }

    .price-card {
        padding: 1rem;
    }

    .price-card-value {
        font-size: 1.3rem;
    }
}
