/* ========== styles1.css ========== */
/* Адаптивная таблица с превращением столбцов в строки на мобильных устройствах */
/* Подходит для таблиц с 4 и 5 столбцами */

/* ----- БАЗОВЫЕ СТИЛИ ----- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #f0f4f9;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    line-height: 1.45;
    padding: 2rem 1.5rem;
    color: #1a2c3e;
}

/* Контейнер демо */
.demo-container {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2.8rem;
}

/* Карточка таблицы */
.table-card {
    background: #ffffff;
    border-radius: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
    overflow: hidden;
    transition: all 0.2s;
}

.table-header {
    padding: 1.2rem 1.5rem;
    background: #fafcff;
    border-bottom: 1px solid #e4e9f0;
}

.table-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #0f2b3d;
}

.table-header p {
    font-size: 0.9rem;
    color: #4a627a;
    margin-top: 0.3rem;
}

/* ----- СТИЛИ ДЛЯ ТАБЛИЦЫ (ДЕСКТОП ВЕРСИЯ) ----- */
.responsive-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.95rem;
}

.responsive-table th,
.responsive-table td {
    padding: 1rem 1.2rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e9edf2;
}

.responsive-table th {
    background-color: #f1f6fa;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #1e4a6e;
    border-bottom: 2px solid #dce5ec;
}

.responsive-table tbody tr:nth-child(even) {
    background-color: #fbfdfe;
}

.responsive-table tbody tr:hover {
    background-color: #f0f7ff;
    transition: background 0.2s;
}

/* Стилизация данных (бейджи, цены) */
.badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #e6f0fa;
    color: #155f8b;
}

.price {
    font-weight: 600;
    color: #1f6e43;
}

.rating {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: #fff2e0;
    padding: 0.2rem 0.6rem;
    border-radius: 2rem;
    font-size: 0.8rem;
}

/* ----- АДАПТИВ: ПРИ УМЕНЬШЕНИИ ЭКРАНА ТАБЛИЦА ПРЕВРАЩАЕТСЯ В СТРОЧКИ (КАРТОЧКИ) ----- */
@media (max-width: 700px) {
    /* Принудительно превращаем таблицу в блочную структуру */
    .responsive-table,
    .responsive-table thead,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table th,
    .responsive-table td {
        display: block;
    }

    /* Скрываем заголовки таблицы, так как данные будут дублироваться с метками */
    .responsive-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        border: 0;
    }

    /* Каждая строка — отдельный блок-карточка */
    .responsive-table tr {
        margin-bottom: 1.2rem;
        border: 1px solid #e2e8f0;
        border-radius: 1rem;
        background: white;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
        overflow: hidden;
    }

    /* Ячейки ведут себя как flex-строки с меткой */
    .responsive-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 1rem;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #edf2f7;
        text-align: left;
        font-size: 0.9rem;
    }

    .responsive-table td:last-child {
        border-bottom: none;
    }

    /* Псевдоэлемент, который подставляет текст заголовка из data-label */
    .responsive-table td::before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        flex: 1;
        font-size: 0.8rem;
        color: #2c5a7a;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    /* Содержимое ячейки выравниваем слева */
    .responsive-table td > * {
        text-align: left;
    }

    /* Для красивых внутренних элементов */
    .badge, .rating {
        white-space: nowrap;
    }
}

/* Дополнительная настройка для очень маленьких экранов */
@media (max-width: 480px) {
    body {
        padding: 1rem;
    }
    .responsive-table td {
        padding: 0.6rem 0.9rem;
        font-size: 0.85rem;
    }
    .responsive-table td::before {
        font-size: 0.75rem;
    }
    .price {
        font-size: 0.9rem;
    }
}

/* Стиль информационной подсказки (необязательный, используется в демо) */
.info-note {
    background: #e6f0f5;
    border-radius: 1rem;
    padding: 0.8rem 1.2rem;
    margin-top: 0.3rem;
    text-align: center;
    font-size: 0.8rem;
    color: #265c7a;
}
.info-note strong {
    font-weight: 600;
}