/* ==========================================================================
   jTable Bootstrap 5 — Стили
   ========================================================================== */

/* ---- Main Container ---- */
.jt-main-container {
    position: relative;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    overflow: hidden;
}

/* ---- Title ---- */
.jt-title {
    background: linear-gradient(135deg, #1a56db 0%, #1971c2 100%);
    color: #fff;
    padding: 0.6rem 1rem;
    min-height: 48px;
}

.jt-title-text {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: .01em;
}

/* ---- Toolbar ---- */
.jt-toolbar {
    /* inherits flexbox from title */
}

.jt-toolbar-item-add-record {
    background: rgba(255,255,255,.15) !important;
    border-color: rgba(255,255,255,.3) !important;
    color: #fff !important;
    font-size: 0.82rem;
}

.jt-toolbar-item-add-record:hover {
    background: rgba(255,255,255,.28) !important;
}

/* ---- Table ---- */
.jt-table thead th {
    background: #f1f5fb;
    color: #2c3e50;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom: 2px solid #d0dff0 !important;
    vertical-align: middle;
    padding: 0.6rem 0.75rem;
    user-select: none;
}

.jt-table tbody tr {
    transition: background 0.12s;
}

.jt-table tbody tr:hover {
    background-color: #f0f7ff !important;
}

.jt-table tbody td {
    font-size: 0.9rem;
    vertical-align: middle;
    padding: 0.5rem 0.75rem;
    color: #374151;
}

/* Responsive table wrapper */
.jt-main-container .table-responsive {
    border: none;
}

/* ---- Row States ---- */
.jt-row-created {
    animation: jtRowCreated 2.5s ease-out forwards;
}
@keyframes jtRowCreated {
    0%   { background-color: #bfdbfe; }
    100% { background-color: transparent; }
}

.jt-row-updated {
    animation: jtRowUpdated 2.5s ease-out forwards;
}
@keyframes jtRowUpdated {
    0%   { background-color: #d1fae5; }
    100% { background-color: transparent; }
}

.jt-row-deleting {
    opacity: 0.4;
    background-color: #fee2e2 !important;
    transition: opacity 0.3s, background 0.3s;
}

/* ---- Sortable Headers ---- */
.jt-column-header-sortable .jt-column-header-text {
    padding-right: 18px;
    position: relative;
}

.jt-column-header-sortable .jt-column-header-text::after {
    content: '↕';
    position: absolute;
    right: 0;
    opacity: 0.4;
    font-size: 0.75em;
}

.jt-column-header-sorted-asc .jt-column-header-text::after {
    content: '↑';
    opacity: 1;
    color: #1a56db;
}

.jt-column-header-sorted-desc .jt-column-header-text::after {
    content: '↓';
    opacity: 1;
    color: #1a56db;
}

/* ---- Command Buttons ---- */
.jt-command-column {
    white-space: nowrap;
    width: 1%;
}

.jt-edit-command-button,
.jt-delete-command-button {
    border-radius: 0.375rem;
    line-height: 1;
    padding: 0.2rem 0.45rem;
    font-size: 0.78rem;
}

/* ---- No data row ---- */
.jt-no-data-row td {
    background: #fafafa;
    font-style: italic;
}

/* ---- Bottom Panel ---- */
.jt-bottom-panel {
    background: #f8f9fa;
    border-top: 1px solid #e5e9f2;
    padding: 0.4rem 0.8rem;
    min-height: 40px;
    font-size: 0.83rem;
}

.jt-page-btn {
    min-width: 32px;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.4;
}

.jt-page-btn-active {
    font-weight: 700;
}

.jt-page-info {
    font-size: 0.82rem;
    color: #6c757d;
}

/* ---- Busy Overlay ---- */
.jt-busy-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.65);
    z-index: 100;
    display: flex !important;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.jt-busy-overlay.jt-busy-invisible {
    background: transparent;
    backdrop-filter: none;
}

.jt-busy-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.jt-busy-message {
    font-size: 0.88rem;
    color: #495057;
    font-weight: 500;
}

/* ---- Modals ---- */
.jt-modal-header {
    background: linear-gradient(135deg, #1a56db 0%, #1971c2 100%);
    color: #fff;
}

.jt-modal-header .modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.modal-body .mb-3:last-child {
    margin-bottom: 0 !important;
}

/* ---- Child Rows ---- */
.jt-child-row > td {
    background: #f8faff !important;
    border: none !important;
    padding: 0 !important;
}

.jt-child-table-container {
    border-top: 2px solid #d0dff0;
}

/* ---- Selecting ---- */
.jt-row-selected {
    background-color: #dbeafe !important;
}

/* ---- Responsive: small screens ---- */
@media (max-width: 575.98px) {
    .jt-title-text { font-size: 0.95rem; }
    .jt-bottom-panel { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
    .jt-table tbody td, .jt-table thead th { font-size: 0.78rem; padding: 0.35rem 0.5rem; }
}
