/* ===== Оформление галереи (светлый фон, тёмный текст) ===== */
.gallery-body {
    background-color: #f5d9e8;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(255, 140, 170, 0.5) 8%, transparent 25%),
        radial-gradient(circle at 95% 15%, rgba(240, 120, 200, 0.5) 12%, transparent 28%),
        radial-gradient(circle at 30% 80%, rgba(255, 200, 100, 0.5) 14%, transparent 30%),
        radial-gradient(circle at 70% 60%, rgba(150, 200, 255, 0.5) 18%, transparent 35%),
        radial-gradient(circle at 50% 40%, rgba(255, 120, 140, 0.6) 10%, transparent 20%),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 0px, rgba(255, 255, 255, 0.2) 15px, transparent 15px, transparent 30px);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden; /* предотвращает горизонтальный скролл, если какой-то элемент всё же вылезет */
}

/* Контейнер центрирования */
.gallery-body > center {
    max-width: 1100px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border-radius: 30px;
    padding: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    box-sizing: border-box; /* чтобы padding не увеличивал общую ширину */
}

/* Заголовки (b и ссылки) */
.gallery-body b {
    color: #2c3e50;
    text-shadow: 2px 2px 4px rgba(255,255,255,0.5);
    font-size: 24px;
    display: inline-block;
    margin: 10px 0;
}

.gallery-body a {
    color: #2980b9;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.gallery-body a:hover {
    color: #e74c3c;
    text-decoration: underline;
}

/* Таблицы — карточки */
.gallery-body table {
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    border-collapse: collapse;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
    margin: 15px 0;
    border: none;
    table-layout: fixed; /* фиксированная ширина колонок */
    word-wrap: break-word;
}

.gallery-body table:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.gallery-body td {
    background: transparent;
    border: none;
    padding: 15px;
    color: #2c3e50;
    font-size: 14px;
    vertical-align: top;
    overflow: hidden;
    max-width: 100%;
}

.gallery-body .title {
    background: linear-gradient(135deg, #6ab0b0, #4f9a9a) !important;
    color: #2c3e50 !important;
    font-weight: bold;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 15px 15px 0 0 !important;
    padding: 12px 15px;
}

/* Все изображения в галерее */
.gallery-body img {
    max-width: 100%;
    height: auto;
    display: block; /* убирает лишние отступы */
}

/* Миниатюры в галерее */
.gallery-body td img[src*="data/gallery/trumb/"] {
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: transform 0.3s;
}

.gallery-body td img[src*="data/gallery/trumb/"]:hover {
    transform: scale(1.05);
}

/* Крупное фото при просмотре */
.gallery-body img[src*="data/gallery/image/"] {
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

/* Поля ввода */
.gallery-body input.text,
.gallery-body select.text,
.gallery-body textarea {
    padding: 10px 15px;
    border: 2px solid #bdc3c7;
    border-radius: 30px;
    background: white;
    color: #2c3e50;
    font-size: 14px;
    transition: border 0.3s, box-shadow 0.3s;
    width: auto;
    max-width: 300px;
    box-sizing: border-box;
    margin: 5px 0;
}

.gallery-body input.text:focus,
.gallery-body select.text:focus,
.gallery-body textarea:focus {
    border-color: #3498db;
    box-shadow: 0 0 15px rgba(52,152,219,0.5);
    outline: none;
}

/* Кнопки */
.gallery-body input[type="button"],
.gallery-body input[type="submit"],
.gallery-body button,
.gallery-body .ok {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    margin: 2px;
}

.gallery-body input[type="button"]:hover,
.gallery-body input[type="submit"]:hover,
.gallery-body button:hover,
.gallery-body .ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #2980b9, #3498db);
}

/* Ссылки пагинации (Назад/Дальше) */
.gallery-body a[href*="?inc=gallery&site="] {
    display: inline-block;
    padding: 5px 12px;
    margin: 0 3px;
    background: linear-gradient(135deg, #ff9a9e, #fad0c4);
    color: #2c3e50;
    border-radius: 20px;
    font-weight: bold;
    text-decoration: none;
    transition: background 0.2s;
}

.gallery-body a[href*="?inc=gallery&site="]:hover {
    background: linear-gradient(135deg, #fad0c4, #ff9a9e);
    color: #000;
}

/* Алфавитная навигация (буквы) – увеличенная версия */
.gallery-body a[href*="?inc=gallery&abc="] {
    display: inline-block;
    padding: 5px 12px;
    margin: 2px;
    background: rgba(255,255,255,0.2);
    border-radius: 18px;
    color: #2c3e50;
    font-weight: bold;
    font-size: 20px; /* увеличено с 16px */
    transition: background 0.2s;
    word-wrap: normal; /* не переносить буквы */
}

.gallery-body a[href*="?inc=gallery&abc="]:hover {
    background: rgba(255,255,255,0.4);
    color: #e74c3c;
}

/* Список галерей (ссылки) */
.gallery-body a[href*="?inc=gallery&gallery="] {
    display: inline-block;
    padding: 5px 12px;
    margin: 3px;
    background: rgba(52,152,219,0.2);
    border-radius: 30px;
    color: #2c3e50;
    font-weight: 500;
    transition: background 0.2s;
}

.gallery-body a[href*="?inc=gallery&gallery="]:hover {
    background: rgba(52,152,219,0.4);
    color: #2c3e50;
    text-decoration: none;
}

/* Форма загрузки фото */
.gallery-body form[enctype="multipart/form-data"] {
    background: rgba(255,255,255,0.85);
    border-radius: 20px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    color: #2c3e50;
    box-sizing: border-box;
    max-width: 100%;
}

/* Сообщения об ошибках/успехе */
.gallery-body font[color="red"] {
    color: #e74c3c !important;
    font-weight: bold;
}
.gallery-body font[color="green"] {
    color: #2ecc71 !important;
    font-weight: bold;
}

/* Комментарии (посты) */
.gallery-body table[width="500"] {
    background: rgba(255,255,255,0.85);
    border-radius: 16px;
    margin: 15px auto;
    color: #2c3e50;
    width: 100%; /* подстраивается под родителя */
    max-width: 100%;
}

/* Ссылка "Добавить сообщение" */
.gallery-body a[href="#sendmess"] {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 30px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 15px;
}

.gallery-body a[href="#sendmess"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.3);
}

/* Дополнительные универсальные правила для предотвращения вылезания */
.gallery-body p, .gallery-body div {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    box-sizing: border-box;
}

/* Адаптивность */
@media (max-width: 600px) {
    .gallery-body > center {
        padding: 15px;
    }
    
    .gallery-body td {
        display: block;
        width: 100% !important;
        text-align: center;
    }
    
    .gallery-body .title {
        text-align: center;
    }
    
    .gallery-body input.text,
    .gallery-body select.text,
    .gallery-body textarea {
        max-width: 100%;
    }
}