body {
    font-family: 'Trebuchet MS', sans-serif;
    background-color: #1f1f1f;
    text-align: center;
    font-size: 20px;
    color: white;
}

section {
    border: 2px solid grey;
    margin-top: 92px;
    overflow: auto;
}

.main-page {
    border: 3px solid black;
    background-image: linear-gradient(to bottom right, dimGrey, black);
    float: left;
    width: 45%;
    margin: auto;
    padding: 1%;
    min-height: 128px;
    color: white;
    font-size: bold;
    text-decoration: none;
}

.telegram-bot {
    border: 3px solid black;
    background-image: linear-gradient(to bottom right, dimGrey, black);
    float: left;
    width: 90%;
    margin: auto;
    padding: 1%;
    height: 32px;
    color: white;
    font-size: bold;
    text-decoration: none;
}

.main-page:hover {
    background-image: linear-gradient(to bottom right, #808080, #1f1f1f);
    font-size: 110%;
}

/* TABLE FIXED WIDTH SETUP */
.table {
    display: table;
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    border: 1px solid dimGrey;
    font-family: sans-serif;
}

.thead {
    display: table-header-group;
}

.tbody {
    display: table-row-group;
}

.tr {
    display: table-row;
}

.th, .td {
    display: table-cell;
    border: 1px solid dimGrey;
    padding: 5px 10px;
    text-align: center;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ✅ Явная ширина колонок (подстрой по нужному количеству продуктов) */
.th:nth-child(1), .td:nth-child(1) { width: 15%; } /* Пациент */
.th:nth-child(2), .td:nth-child(2) { width: 15%; } /* Клиника */
.th:nth-last-child(2), .td:nth-last-child(2) { width: 15%; } /* Дата */
.th:last-child, .td:last-child { width: 15%; } /* Принято */

/* 🎯 Продукты — все, что между ними */
.td:nth-child(n+3):nth-last-child(n+3),
.th:nth-child(n+3):nth-last-child(n+3) {
    width: auto;
}

/* СТАТУСЫ */
.tr-closed {
    display: table-row;
    background-color: #002d73;
    color: white;
    text-decoration: none;
}

.tr-closed:hover {
    background: #606d82;
    cursor: pointer;
}

.tr-paid {
    display: table-row;
    background-color: #075700;
    color: white;
    text-decoration: none;
}

.tr-paid:hover {
    background: #608263;
    cursor: pointer;
}

/* КЛИКАБЕЛЬНЫЕ РЯДЫ */
a.tr {
    border: 1px solid dimGrey;
    text-decoration: none;
    color: white;
    display: table-row;
}

a.tr:hover {
    background: dimGrey;
    cursor: pointer;
}

/* Узкая колонка с чекбоксами */
.checkbox-col {
    flex: 0 0 36px !important; /* flex: grow shrink basis */
    max-width: 36px !important;
    min-width: 36px !important;

    text-align: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Центровка чекбокса */
.checkbox-col input[type="checkbox"] {
    transform: scale(1.3);     /* чтобы не выглядел мелким */
    margin: 0;
}

/* МЕНЮ */
.menu {
    background-image: linear-gradient(#808080, #1f1f1f);
    overflow: auto;
    position: fixed;
    top: 0;
    width: 98%;
    margin-right: 4px;
}

.menu a {
    float: left;
    display: block;
    padding: 14px 16px;
    font-size: 14px;
    color: white;
    text-decoration: none;
    text-align: center;
}

.menu a:hover {
    background-color: dimGrey;
    font-size: 16px;
}

.menu button {
    cursor: pointer;
}

nav header {
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    color: black;
}

button {
    font-weight: bold;
    background-color: #fffed4;
    height: 30px;
    width: 75px;
}

input {
    height: 22px;
    font-size: 18px;
}

select {
    height: 22px;
    width: 128px;
    font-size: 18px;
}

/* НИЖНЕЕ МЕНЮ */
.low-menu {
    background-image: linear-gradient(#808080, #1f1f1f);
    overflow: auto;
    position: bottom;
    width: 100%;
}

.low-menu a,
.low-menu div {
    float: right;
    display: block;
    padding: 14px 16px;
    font-size: 14px;
    color: white;
    text-align: center;
    text-decoration: none;
}

.low-menu a:hover {
    background-color: dimGrey;
    border: 1px solid black;
}

.low-menu a button {
    height: 52px;
    width: 100%;
    font-size: 18px;
    cursor: pointer;
}

.low-button {
    height: 52px;
    width: 100%;
    font-size: 18px;
    cursor: pointer;
    font-weight: bold;
    background-color: #fffed4;
}

/* Гамбургер нижнего меню (мобилки) */
.low-burger {
    display: none;
    font-size: 32px;
    cursor: pointer;
    padding: 10px;
}

/* КНОПКИ */
.big-button {
    float: left;
    font-size: 20px;
    min-height: 110px;
    width: 100px;
}

.medium-button {
    font-size: 20px;
    font-weight: bold;
    min-height: 32px;
    width: auto;
    cursor: pointer;
}

.small-button {
    font-size: 15px;
    min-height: 24px;
    width: auto;
    cursor: pointer;
}

.btn-main {
    font-size: 16px;
    padding: 10px 24px;
    border: none;
    background-color: #2196f3;
    color: white;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: background-color 0.3s ease;
}

.btn-main:hover {
    background-color: #0b7dda;
}

.btn-submit {
    font-size: 14px;
    padding: 6px 16px;
    background-color: #4caf50;
    color: white;
    font-weight: bold;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    margin-top: 8px;
}

.btn-submit:hover {
    background-color: #3e8e41;
}

/* WORK FORM */
.work {
    padding: 1%;
    margin: auto;
    border: 2px solid dimGrey;
    width: 80%;
    min-height: 32px;
    float: center;
}

.work:hover {
    border-color: grey;
}

.work input {
    background-color: #1f1f1f;
    color: white;
}

.work input[type=submit] {
    background-color: #fffed4;
    color: black;
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #1f1f1f;
}

::-webkit-scrollbar-thumb {
    background: #555;
}

::-webkit-scrollbar-thumb:hover {
    background: dimGrey;
}

#product-label {
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px;
    cursor: pointer;
}

/* 📸 Галерея фото */
.photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    padding: 10px;
}

/* Контейнер одного фото */
.photo-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 380px; /* фиксированная ширина карточки */
    width: 100%;
}

/* Сами изображения */
.photo-box img {
    width: 100%;
    height: auto;
    max-height: 520px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #777;
}

/* Кнопка "удалить" под фото */
.photo-box form {
    margin-top: 8px;
}

/* ============================
   📸 Modal Photo Viewer
   ============================ */
.photo-modal {
    display: none;              /* скрыто по умолчанию */
    position: fixed;
    z-index: 9999;
    padding-top: 40px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
}

.photo-modal-content {
    display: block;
    margin: auto;
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
}

.photo-close {
    position: absolute;
    top: 12px;
    right: 20px;
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
}

/* Эффект появления */
.photo-modal-content {
    animation: zoomIn 0.2s ease-out;
}

@keyframes zoomIn {
    from { transform: scale(0.7); opacity: 0.2; }
    to   { transform: scale(1);   opacity: 1; }
}

/* ================================
   АДАПТИВНОЕ МЕНЮ + ГАМБУРГЕР
================================ */
.menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-image: linear-gradient(#808080, #1f1f1f);
    padding: 8px 0;
    z-index: 1000;
}

.menu header {
    font-size: 22px;
    color: black;
    font-weight: bold;
    text-align: center;
}

/* ссылки меню (ПК) */
.menu a {
    float: left;
    padding: 14px 16px;
    font-size: 16px;
    color: white;
    text-decoration: none;
}

.menu a:hover {
    background-color: dimGrey;
}

/* кнопка ГАМБУРГЕР (мобилки) */
.burger {
    float: left;
    display: none;
    font-size: 30px;
    color: white;
    cursor: pointer;
    margin-left: 12px;
}

/* ===============================
        М О Б И Л Ь Н О Е
   =============================== */

@media (max-width: 768px) {

    /* показываем гамбургер */
    .burger {
        display: block;
    }

    /* скрываем все ссылки меню пока меню закрыто */
    .menu a {
        display: none;
        float: none;
        text-align: center;
        padding: 12px;
        font-size: 20px;
        border-top: 1px solid #3a3a3a;
    }

    /* меню в мобильном виде — колонкой */
    body.menu-open .menu a {
        display: block;
    }

    /* заголовок уменьшаем чтобы не вылезал */
    .menu header {
        font-size: 18px;
        padding-bottom: 4px;
    }

    .work {
        width: auto;
    }

    .checkbox-col {
        flex: 0 0 28px !important;
        max-width: 28px !important;
        min-width: 28px !important;
    }

    /* Контейнер нижнего меню */
    .low-burger {
        display: block;
    }

    /* выравнивание */
    .low-menu {
        position: fixed;
        bottom: 0;
        right: 0;
        padding: 10px;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
    }

    /* Каждая кнопка */
    .low-menu a,
    .low-menu form {
        display: none;
    }

    /* показываем при активном состоянии */
    body.low-menu-open .low-menu a,
    body.low-menu-open .low-menu form {
        display: block;
        margin-top: 8px;
    }

    /* кнопки */
    .low-menu button,
    .low-menu input[type="submit"] {
        width: 160px;
        font-size: 16px;
        padding: 8px;
    }

    /* Выпадающие формы под кнопками */
    .low-menu div {
        position: relative;
        right: 0;
        width: 180px;
        background: rgba(255,255,255,0.95);
        padding: 10px;
        border-radius: 10px;
        margin-bottom: 10px;
    }

    .low-menu div form {
        width: 100%;
    }

    .medium-button {
        width: 100%;
    }

    /* 📱 Горизонтальная прокрутка таблицы на мобильных */
    .table-wrapper {
        width: 100%;
        margin-bottom: 64px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* плавная прокрутка на iPhone */
    }

    .table-wrapper .table {
        min-width: 800px;     /* или 800px — подбери под фактическую ширину таблицы */
    }

    .photo-gallery {
        gap: 16px;
    }

    .photo-box {
        max-width: 100%;
    }

    .photo-box img {
        width: 100%;
        max-height: none;
        border-radius: 6px;
    }

    .photo-modal-content {
        max-width: 100%;
        max-height: 80%;
    }
}

/* слегка уменьшить размер на ультрамаленьких экранах */
@media (max-width: 420px) {
    .menu header {
        font-size: 16px;
    }
}
