/*
 * Единый стиль приложения (как в «Карточке гостя»).
 * Подключается в parts/common.ftlh для всех страниц.
 */

/* ── Карточка ── */
.gn-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #E5E3DC;
    padding: 1.75rem 2rem;
    margin-bottom: 1.25rem;
}

.gn-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 1.25rem;
}

.gn-divider { height: 1px; background: #EEECE6; margin: 1.5rem 0; }

/* ── Поля ── */
.gn-field { display: flex; flex-direction: column; gap: 5px; }

.gn-field label {
    font-size: 11px;
    font-weight: 500;
    color: #888;
}

.gn-field input[type="text"],
.gn-field input[type="date"],
.gn-field select,
.gn-field textarea {
    background: #F7F6F2;
    border: 1px solid #E5E3DC;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
    font-family: inherit;
    height: 38px;
}

.gn-field input:focus,
.gn-field select:focus,
.gn-field textarea:focus {
    border-color: #534AB7;
    background: #fff;
}

.gn-field textarea { height: 60px; resize: vertical; }

/* Строка фильтров: поля и кнопки в одну линию */
.gn-filter-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.gn-filter-row .gn-field { width: 180px; }

/* ── Кнопки ── */
.gn-btn {
    display: inline-block;
    border-radius: 10px;
    padding: 10px 22px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    border: none;
}

.gn-btn:active { transform: scale(0.98); }
.gn-btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.gn-btn-primary { background: #534AB7; color: #fff; }
.gn-btn-primary:hover { background: #4740A0; color: #fff; }
.gn-btn-secondary { background: #F7F6F2; color: #444; border: 1px solid #E5E3DC; }
.gn-btn-secondary:hover { background: #EEECEA; color: #444; }
.gn-btn-danger { background: #fff; color: #c0392b; border: 1px solid #F0C0BC; }
.gn-btn-danger:hover { background: #FEF0EF; }
.gn-btn-info { background: #E6F1FB; color: #185FA5; border: none; }
.gn-btn-info:hover { background: #D0E6F7; color: #185FA5; }

.gn-row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ── Метки ── */
.gn-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.gn-cat-tag {
    display: inline-block;
    padding: 3px 10px;
    background: #F0EEF9;
    color: #534AB7;
    border-radius: 20px;
    font-size: 12px;
}

.gn-table .gn-cat-tag { white-space: nowrap; }

.gn-tag-muted   { background: #F7F6F2; color: #888; }
.gn-tag-danger  { background: #FEF0EF; color: #c0392b; }
.gn-tag-warning { background: #FFF4D6; color: #9A6700; }

/* ── Таблица ── */
.gn-table-wrap {
    border: 1px solid #E5E3DC;
    border-radius: 12px;
    overflow: auto;
}

.gn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
    color: #1a1a1a;
}

.gn-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #F7F6F2;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #999;
    text-align: left;
    padding: 10px 10px;
    border-bottom: 1px solid #2c2c2b;
    vertical-align: bottom;
}

.gn-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #434242;
    vertical-align: middle;
}

.gn-table tbody tr:last-child td { border-bottom: none; }
/* Подсветка на строке, а не на ячейках: цветные ячейки (.good/.bad/.color-N) сохраняют свой фон */
.gn-table tbody tr:hover { background: #FAFAF8; }
.gn-table a:not([class]) { color: #534AB7; text-decoration: none; }
.gn-table a:not([class]):hover { text-decoration: underline; }

.gn-table tfoot td,
.gn-table tr.gn-total td {
    background: #F7F6F2;
    font-weight: 600;
    border-top: 1px solid #E5E3DC;
}

.gn-table th.sorted-asc::after  { content: " ▲"; }
.gn-table th.sorted-desc::after { content: " ▼"; }
.gn-table th[onclick] { cursor: pointer; }

/* Таблица с сеткой — для объединённых ячеек (rowspan) */
.gn-table-grid th,
.gn-table-grid td { border-right: 1px solid #EEECE6; }
.gn-table-grid th:last-child,
.gn-table-grid td:last-child { border-right: none; }
.gn-table-grid tbody tr:last-child td { border-bottom: 1px solid #EEECE6; }
.gn-table-grid tbody tr:hover { background: transparent; }

.gn-table input[type="text"] {
    border: 1px solid #E5E3DC;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    background: #fff;
}

/* ── Радиокнопки ── */
.gn-radio-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 4px;
    min-height: 38px;
}

.gn-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #444;
    cursor: pointer;
    margin: 0;
}

.gn-radio-label input[type="radio"],
.gn-radio-label input[type="checkbox"] {
    accent-color: #534AB7;
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* select2 внутри полей */
.gn-field .select2-container .select2-selection--single {
    height: 38px;
    background: #F7F6F2;
    border: 1px solid #E5E3DC;
    border-radius: 8px;
}
.gn-field .select2-container .select2-selection__rendered { line-height: 36px; font-size: 13px; }
.gn-field .select2-container .select2-selection__arrow { height: 36px; }

/* Сетка карточек для отчётов из нескольких небольших таблиц */
.gn-report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr));
    gap: 1.25rem;
    align-items: start;
}
.gn-report-grid > .gn-card { margin-bottom: 0; }

.gn-muted { color: #999; }

/* ── Заголовок страницы ── */
.gn-page-title {
    font-size: 18px;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0 0 1rem;
}

.gn-subtitle {
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0 0 0.75rem;
}

/* ── Поиск над таблицей ── */
.gn-search {
    background: #F7F6F2;
    border: 1px solid #E5E3DC;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    font-family: inherit;
    height: 38px;
    width: 100%;
    max-width: 320px;
    outline: none;
    margin-bottom: 1rem;
}

.gn-search:focus { border-color: #534AB7; background: #fff; }

/* Высота таблицы по окну, заголовок закреплён */
.gn-table-wrap.gn-fit { max-height: calc(100vh - 260px); }

.gn-empty {
    padding: 2.5rem 1rem;
    text-align: center;
    font-size: 13px;
    color: #999;
}

@media print {
    .gn-card { border: none; padding: 0; }
    .gn-table-wrap { border: none; max-height: none !important; overflow: visible; }
    .gn-table th { position: static; }
    .gn-search { display: none; }
}

/* ── Ширина: контент на всю ширину экрана на всех страницах ── */
.content-wrapper { width: 100%; max-width: none; }
.content-wrapper .container { max-width: none; }

/* ── Мобильные устройства ── */
@media (max-width: 680px) {
    .gn-report-grid { grid-template-columns: 1fr; }
    .gn-card { padding: 1rem; border-radius: 12px; margin-bottom: 0.75rem; }

    .content-wrapper > .container-fluid { padding-left: 8px; padding-right: 8px; }

    .gn-page-title { font-size: 16px; }

    /* Фильтры в столбик: поля и кнопки на всю ширину */
    .gn-filter-row { flex-direction: column; align-items: stretch; }
    .gn-filter-row .gn-field { width: 100% !important; }
    .gn-filter-row .gn-btn { width: 100%; text-align: center; }

    .gn-search { max-width: none; }

    /* На телефоне таблица растёт вместе со страницей, прокрутка по горизонтали */
    .gn-table-wrap.gn-fit { max-height: 75vh; }
    .gn-table th, .gn-table td { padding: 8px 10px; }
}
