/* Базовые стили для страницы тарифов */
/* Основные стили */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Сброс стилей для страницы тарифов */
.tariff-page {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-family: 'Inter', sans-serif;
}

.tariff-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Hero секция */
.hero-section {
    padding: 60px 0;
    text-align: center;
    background: linear-gradient(135deg, #0056b3 0%, #007bff 100%);
    color: white;
    margin-bottom: 60px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='rgba(255,255,255,0.1)' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.6;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    position: relative;
}

.hero-section p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
}

/* Карточки тарифов */
.tariff-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.tariff-card {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tariff-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.tariff-card.popular {
    border: 2px solid #007bff;
}

.tariff-card.popular::before {
    content: "Популярный";
    position: absolute;
    top: 20px;
    right: -35px;
    background: #007bff;
    color: white;
    padding: 5px 40px;
    transform: rotate(45deg);
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 1;
}

.tariff-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #333;
}

.tariff-price {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 25px;
    color: #007bff;
}

.tariff-price span {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.7;
}

.tariff-features {
    margin-bottom: 30px;
}

.tariff-feature {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    line-height: 1.4;
}

.tariff-feature i {
    color: #28a745;
    margin-right: 10px;
    font-size: 1.2rem;
    margin-top: 2px;
}

.tariff-feature.disabled {
    opacity: 0.7;
}

.tariff-feature.disabled i {
    color: #dc3545;
}

.tariff-feature span {
    flex: 1;
}

.tariff-button {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.3s ease;
    width: 100%;
    text-align: center;
}

.tariff-button:hover {
    background: #0056b3;
    color: white;
}

/* Сравнительная таблица */
.comparison-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 60px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.comparison-section h2 {
    color: #333;
    font-weight: 700;
    margin-bottom: 30px;
}

.table-responsive {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    display: table !important;
    table-layout: fixed;
}

.comparison-table th,
.comparison-table td {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    word-wrap: break-word;
}

.comparison-table th:first-child,
.comparison-table td:first-child {
    text-align: left;
    font-weight: 600;
    width: 40%;
}

.comparison-table th {
    font-weight: 600;
    background: #f8f9fa;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

.comparison-table tr:hover {
    background-color: #f8f9fa;
}

.comparison-table i.yes {
    color: #28a745;
    font-size: 1.2rem;
}

.comparison-table i.no {
    color: #dc3545;
    font-size: 1.2rem;
}

/* Дополнительные стили для иконок Bootstrap */
.comparison-table .bi-check-circle-fill {
    color: #28a745 !important;
    font-size: 1.2rem !important;
}

.comparison-table .bi-x-circle-fill {
    color: #dc3545 !important;
    font-size: 1.2rem !important;
}

/* FAQ секция */
.faq-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 30px;
    font-weight: 700;
}

.faq-item {
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

.faq-question {
    font-weight: 600;
    padding: 15px 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-question i {
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.active .faq-answer {
    padding: 0 0 15px 0;
    max-height: 500px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .tariff-cards {
        grid-template-columns: 1fr;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .comparison-section,
    .faq-section {
        padding: 20px;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 10px 5px;
        font-size: 0.9rem;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .tariff-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Дополнительные стили для очень маленьких экранов */
@media (max-width: 480px) {
    .hero-section {
        padding: 30px 0;
    }

    .hero-section h1 {
        font-size: 1.8rem;
    }

    .hero-section p {
        font-size: 0.9rem;
        padding: 0 15px;
    }

    .tariff-card {
        padding: 20px 15px;
    }

    .tariff-name {
        font-size: 1.3rem;
    }

    .tariff-price {
        font-size: 2rem;
    }

    .tariff-price span {
        font-size: 0.9rem;
    }

    .tariff-feature {
        font-size: 0.9rem;
        padding: 8px 0;
    }

    .tariff-button {
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .comparison-section {
        padding: 15px;
        margin: 15px;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 10px;
        font-size: 0.85rem;
    }

    .faq-section {
        padding: 15px;
        margin: 15px;
    }

    .faq-section h2 {
        font-size: 1.5rem;
    }

    .faq-question {
        padding: 12px;
        font-size: 0.9rem;
    }

    .faq-answer {
        font-size: 0.85rem;
    }

    .faq-item.active .faq-answer {
        padding: 12px;
    }
}

/* Стили для ориентации landscape на мобильных устройствах */
@media (max-height: 600px) and (orientation: landscape) {
    .hero-section {
        padding: 20px 0;
    }

    .hero-section h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }

    .hero-section p {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }

    .tariff-cards {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
    }

    .tariff-card {
        padding: 20px;
    }

    .tariff-name {
        margin-bottom: 10px;
    }

    .tariff-price {
        margin-bottom: 20px;
    }

    .tariff-feature {
        margin-bottom: 8px;
    }
}

/* Улучшения для планшетов */
@media (min-width: 768px) and (max-width: 991px) {
    .tariff-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }

    .tariff-card {
        max-width: none;
    }

    .comparison-section,
    .faq-section {
        margin: 30px;
        padding: 30px;
    }
}

/* Стили для устройств с высоким DPI */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-section::before {
        background-size: 50px 50px;
    }
}

/* Стили для поддержки тёмной темы */
@media (prefers-color-scheme: dark) {
    .comparison-table th {
        background: #2c3e50;
        color: #fff;
    }

    .comparison-table td {
        color: #f8f9fa;
    }

    .faq-answer {
        background: #2c3e50;
        color: #f8f9fa;
    }
}

/* Стили для устройств с отключенной анимацией */
@media (prefers-reduced-motion: reduce) {
    .tariff-card,
    .tariff-button,
    .faq-answer {
        transition: none;
    }
}

/* Стили для мобильных устройств разных размеров */

/* Очень маленькие устройства (4-5 дюймов) */
@media screen and (max-width: 320px) {
    .hero-section,
    .tariff-container,
    .comparison-section,
    .faq-section {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 15px !important;
    }

    .hero-section h1 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }

    .tariff-cards {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    .tariff-card {
        padding: 15px !important;
        margin: 0 !important;
    }
}

@media screen and (min-width: 321px) and (max-width: 375px) {
    .hero-section,
    .tariff-container,
    .comparison-section,
    .faq-section {
        padding: 20px !important;
    }

    .tariff-cards {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

@media screen and (min-width: 376px) and (max-width: 425px) {
    .hero-section,
    .tariff-container,
    .comparison-section,
    .faq-section {
        padding: 20px !important;
    }

    .tariff-cards {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

@media screen and (min-width: 426px) and (max-width: 768px) {
    .hero-section,
    .tariff-container,
    .comparison-section,
    .faq-section {
        padding: 25px !important;
    }

    .tariff-cards {
        grid-template-columns: 1fr !important;
        gap: 25px !important;
        max-width: 500px !important;
        margin: 0 auto !important;
    }
}

/* Принудительное применение стилей для мобильных устройств */
@media screen and (max-width: 768px) {
    /* Контейнер страницы */
    .tariff-container {
        padding: 10px;
        margin: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Карточки тарифов */
    .tariff-cards {
        display: flex;
        flex-direction: column;
        gap: 15px;
        padding: 0;
        margin: 0;
        width: 100%;
    }

    .tariff-card {
        width: 100%;
        max-width: 100%;
        margin: 0 0 15px 0;
        padding: 15px;
        box-sizing: border-box;
    }

    /* Сравнительная таблица */
    .comparison-section {
        width: 100%;
        max-width: 100%;
        padding: 15px;
        margin: 20px 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive {
        width: 100%;
        margin: 0;
        padding: 0;
        overflow-x: auto;
    }

    .comparison-table {
        min-width: 100%;
        width: 100%;
        font-size: 13px !important;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 8px !important;
        min-width: 80px; /* Минимальная ширина ячеек */
        white-space: normal;
        word-wrap: break-word;
    }

    .comparison-table th:first-child,
    .comparison-table td:first-child {
        position: sticky;
        left: 0;
        background: white;
        z-index: 1;
        min-width: 120px; /* Минимальная ширина первой колонки */
    }

    /* Оптимизация для очень маленьких экранов */
    @media screen and (max-width: 360px) {
        .tariff-card {
            padding: 10px;
        }

        .comparison-table th,
        .comparison-table td {
            padding: 6px !important;
            font-size: 12px !important;
        }

        .comparison-table th:first-child,
        .comparison-table td:first-child {
            min-width: 100px;
        }
    }

    .faq-section h2 {
        font-size: 1.5rem !important;
    }

    .hero-section h1 {
        font-size: 1.8rem !important;
        padding: 0 15px !important;
    }

    .hero-section p {
        font-size: 1rem !important;
        padding: 0 15px !important;
    }

    /* Hero секция */
    .hero-section {
        padding: 20px 10px;
        margin-bottom: 20px;
        text-align: center;
        margin-top: 60px; /* Добавляем отступ сверху для мобильной версии */
    }

    /* Для устройств с большим хедером */
    @supports (padding: env(safe-area-inset-top)) {
        .hero-section {
            margin-top: calc(60px + env(safe-area-inset-top)); /* Учитываем безопасную зону для устройств с вырезами */
        }
    }
}

/* Стили для устройств с notch и различными вырезами */
@supports (padding: env(safe-area-inset-top)) {
    .hero-section {
        padding-top: calc(env(safe-area-inset-top) + 20px);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .tariff-container {
        padding-left: calc(env(safe-area-inset-left) + 20px);
        padding-right: calc(env(safe-area-inset-right) + 20px);
        padding-bottom: calc(env(safe-area-inset-bottom) + 20px);
    }
}

/* Стили для складных устройств */
@media (screen-spanning: single-fold-vertical) {
    .tariff-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Стили для режима экономии энергии */
@media (prefers-reduced-data: reduce) {
    .hero-section::before {
        display: none;
    }

    .tariff-card {
        box-shadow: none;
        border: 1px solid rgba(0, 0, 0, 0.1);
    }
}

/* Стили для устройств с поддержкой hover */
@media (hover: hover) {
    .tariff-card:hover {
        transform: translateY(-5px);
    }

    .tariff-button:hover {
        background: #0056b3;
    }

    .faq-question:hover {
        color: #007bff;
    }
}

/* Стили для устройств без поддержки hover */
@media (hover: none) {
    .tariff-card:active {
        transform: scale(0.98);
    }

    .tariff-button:active {
        background: #0056b3;
    }
}

/* Стили для ландшафтной ориентации */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .tariff-cards {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 0 10px;
    }

    .tariff-card {
        margin: 0;
    }

    .comparison-section {
        max-width: 90%;
        margin: 20px auto;
    }
}

/* Улучшения для touch-устройств */
@media (hover: none) {
    .tariff-card,
    .tariff-button,
    .faq-question {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

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

    .faq-question:active {
        background-color: rgba(0, 0, 0, 0.05);
    }
}

/* Оптимизация для устройств с высоким DPI */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .tariff-card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .comparison-section,
    .faq-section {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}

/* Оптимизация для экономии батареи */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Дополнительные стили для прокрутки таблицы */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 
 * Стили для модальных окон Bootstrap.
 * Используем стандартные z-index значения Bootstrap.
 */
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    outline: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    display: none;
    z-index: 1050 !important;
}

.modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    z-index: 1040 !important;
}

.modal.show {
    display: block !important;
}

.modal-dialog {
    margin: 1.75rem auto !important;
    max-width: 500px !important;
}

.modal-content {
    box-shadow: 0 5px 15px rgba(0,0,0,.5) !important;
}

/* Кастомизация кнопки "Отмена" в модальном окне */
#upgradePlanModal .modal-footer .btn-secondary {
    color: #000 !important;
    background-color: #f8f9fa; /* Светло-серый фон для лучшего контраста */
    border-color: #dee2e6;
}

#upgradePlanModal .modal-footer .btn-secondary:hover {
    color: #000 !important;
    background-color: #e2e6ea;
    border-color: #dae0e5;
}
