/* ============================================================
   ADMIN: стили админ-панели
   ============================================================ */

/* ---------- Общее ---------- */
body.admin-body {
    background: var(--bg-cream);
    min-height: 100vh;
}

body.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-cream);
    background-image:
        radial-gradient(circle at 20% 30%, rgba(193, 39, 45, 0.05), transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(212, 165, 116, 0.07), transparent 40%);
}

/* ---------- Каркас ---------- */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* ---------- Сайдбар ---------- */
.admin-sidebar {
    background: #2a2320;
    color: rgba(255, 255, 255, 0.82);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 22px;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 20px;
}
.admin-sidebar__logo {
    width: 36px; height: 36px;
    flex-shrink: 0;
}
.admin-sidebar__brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.admin-sidebar__brand-text b {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
}
.admin-sidebar__brand-text small {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1.4px;
    text-transform: uppercase;
    margin-top: 2px;
}

.admin-sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--t-fast);
    text-decoration: none;
}
.admin-nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}
.admin-nav-item.is-active {
    background: var(--brand-red);
    color: #fff;
}

.admin-sidebar__foot {
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
}
.admin-user__avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--brand-red);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.admin-user__info {
    min-width: 0;
}
.admin-user__name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-user__role {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.admin-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.65);
    font-size: 13px;
    text-decoration: none;
    transition: all var(--t-fast);
}
.admin-logout:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

/* ---------- Основная область ---------- */
.admin-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 32px;
    background: var(--card-white);
    border-bottom: 1px solid var(--border-soft);
    position: sticky;
    top: 0;
    z-index: 10;
}
.admin-topbar__title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.admin-topbar__actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.admin-content {
    padding: 28px 32px 60px;
}

.admin-flash {
    padding: 16px 32px 0;
}

/* ---------- Форма входа ---------- */
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
}
.login-card__head {
    text-align: center;
    margin-bottom: 28px;
}
.login-card__logo {
    width: 56px; height: 56px;
    margin: 0 auto 14px;
}
.login-card__title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.login-card__subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}
.login-form__remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 22px;
    cursor: pointer;
    user-select: none;
}
.login-form__submit {
    width: 100%;
    padding: 13px 20px;
    font-size: 14px;
}

/* ---------- Фильтры ---------- */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-bar__search {
    position: relative;
    flex: 1;
    min-width: 240px;
    display: flex;
    align-items: center;
    background: var(--card-white);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 0 14px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.filter-bar__search:focus-within {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px var(--brand-red-soft);
}
.filter-bar__search .icon {
    color: var(--text-light);
    flex-shrink: 0;
}
.filter-bar__input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 11px 10px;
    font-size: 14px;
}
.filter-bar__clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--bg-warm);
    color: var(--text-muted);
}
.filter-bar__clear:hover {
    background: var(--brand-red-soft);
    color: var(--brand-red);
}
.filter-bar__select {
    padding: 11px 14px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--card-white);
    font-size: 14px;
    cursor: pointer;
    min-width: 140px;
    transition: border-color var(--t-fast);
}
.filter-bar__select:focus {
    outline: none;
    border-color: var(--brand-red);
}

.list-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.list-meta b {
    color: var(--text-main);
}

/* ---------- Таблица ---------- */
.table-wrap {
    background: var(--card-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid var(--border-soft);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.admin-table thead {
    background: var(--bg-warm);
}
.admin-table th {
    text-align: left;
    padding: 14px 16px;
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}
.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
.admin-table tbody tr {
    transition: background var(--t-fast);
}
.admin-table tbody tr:hover {
    background: #fdfaf5;
}
.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-warm);
    border: 2px solid var(--border-soft);
}

.cell-name {
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.35;
}
.cell-sub {
    font-size: 11.5px;
    color: var(--text-light);
    font-family: 'SFMono-Regular', Consolas, monospace;
    margin-top: 3px;
}
.cell-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    color: var(--accent-blue);
    margin-top: 4px;
}
.cell-link:hover {
    color: var(--brand-red);
}

/* ---------- Переключатели видимости ---------- */
.vis-toggles {
    display: inline-flex;
    gap: 4px;
    justify-content: center;
}
.vis-toggle {
    cursor: pointer;
    user-select: none;
}
.vis-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.vis-toggle__box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 5px 8px;
    border-radius: var(--radius-pill);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: 1px solid var(--border-strong);
    background: var(--bg-cream);
    color: var(--text-light);
    transition: all var(--t-fast);
}
.vis-toggle input:checked + .vis-toggle__box--ext {
    background: #e8eef5;
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}
.vis-toggle input:checked + .vis-toggle__box--int {
    background: var(--brand-red-soft);
    border-color: var(--brand-red);
    color: var(--brand-red);
}

/* ---------- Кнопки-иконки ---------- */
.row-actions {
    display: inline-flex;
    gap: 4px;
    justify-content: flex-end;
}
.inline-form {
    display: inline;
}
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--t-fast);
    text-decoration: none;
}
.action-btn:hover {
    background: var(--bg-warm);
    color: var(--brand-red);
    border-color: var(--brand-red);
}
.action-btn--danger:hover {
    background: var(--brand-red-soft);
    color: var(--brand-red);
    border-color: var(--brand-red);
}

/* ---------- Пагинация ---------- */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}
.pagination__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    background: var(--card-white);
    border: 1px solid var(--border-soft);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--t-fast);
}
.pagination__item:hover {
    border-color: var(--brand-red);
    color: var(--brand-red);
}
.pagination__item--active {
    background: var(--brand-red);
    border-color: var(--brand-red);
    color: #fff;
}
.pagination__item--disabled {
    opacity: 0.4;
    pointer-events: none;
}
.pagination__dots {
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    color: var(--text-light);
}

/* ---------- Пустое состояние ---------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-white);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
}
.empty-state__title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}
.empty-state__text {
    color: var(--text-muted);
    font-size: 14px;
}

/* ---------- Форма редактирования ---------- */
.edit-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}
.edit-aside {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 100px;
}
.edit-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.edit-photo {
    background: var(--card-white);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    padding: 16px;
    text-align: center;
}
.edit-photo__preview {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-warm);
    margin-bottom: 14px;
}
.edit-photo__preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.edit-photo__btn {
    display: block;
}
.edit-photo__hint {
    font-size: 11.5px;
    color: var(--text-light);
    margin-top: 10px;
    line-height: 1.5;
}

.edit-card {
    background: var(--card-white);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    padding: 22px 26px;
}
.edit-card__title {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-soft);
}
.edit-card .switch + .switch {
    margin-top: 12px;
}
.edit-card__title + .switch {
    margin-top: 0;
}

.edit-submit {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-soft);
    margin-top: 8px;
}

/* code внутри hint */
.field__hint code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    background: var(--bg-warm);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11.5px;
    color: var(--brand-red-dark);
}

/* ---------- Адаптив админки ---------- */
@media (max-width: 1100px) {
    .edit-grid {
        grid-template-columns: 240px 1fr;
    }
}

@media (max-width: 900px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .admin-sidebar {
        position: static;
        height: auto;
        padding: 16px;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 12px;
    }
    .admin-sidebar__brand {
        border-bottom: none;
        padding: 4px 8px;
        margin-bottom: 0;
    }
    .admin-sidebar__nav {
        flex-direction: row;
        flex: 1;
    }
    .admin-sidebar__foot {
        border-top: none;
        padding-top: 0;
        flex-direction: row;
        align-items: center;
    }
    .admin-user__info { display: none; }
    .admin-logout span { display: none; }

    .admin-content,
    .admin-flash {
        padding-left: 18px;
        padding-right: 18px;
    }
    .admin-topbar {
        padding: 16px 18px;
        position: static;
    }
    .admin-topbar__title { font-size: 17px; }

    .edit-grid {
        grid-template-columns: 1fr;
    }
    .edit-aside {
        position: static;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 10px;
        font-size: 13px;
    }
    .admin-table thead th:nth-child(4),
    .admin-table tbody td:nth-child(4) {
        display: none;
    }
}

@media (max-width: 600px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar__select {
        width: 100%;
    }
    .admin-table thead th:nth-child(5),
    .admin-table tbody td:nth-child(5),
    .admin-table thead th:nth-child(6),
    .admin-table tbody td:nth-child(6) {
        display: none;
    }
    .login-card {
        padding: 30px 22px;
    }
}