/* ========== Базовые стили ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #2c3e50;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* ========== Заголовок и верхняя панель ========== */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: white;
    padding: 20px 30px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.header-bar h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
}

.header-bar h1 a {
    text-decoration: none;
    color: #1a73e8;
    transition: opacity 0.3s;
}

.header-bar h1 a:hover {
    opacity: 0.8;
}

.btn-logout {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* ========== Вкладки ========== */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 25px;
    background: white;
    padding: 6px;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    width: fit-content;
}

.tab {
    padding: 12px 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #94a3b8;
    border-radius: 10px;
    transition: all 0.3s;
}

.tab:hover {
    color: #1a73e8;
    background: rgba(26, 115, 232, 0.05);
}

.tab.active {
    color: white;
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.3);
}

/* ========== Контент вкладок ========== */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== Заголовок секции и кнопка Add ========== */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-row h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
}

.btn-add {
    background: linear-gradient(135deg, #00b894 0%, #00a381 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
    letter-spacing: 0.5px;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
}

/* ========== Таблицы ========== */
.table-wrapper {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

th {
    padding: 16px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s;
    white-space: nowrap;
}

th:hover {
    background: rgba(26, 115, 232, 0.05);
}

th.active-sort {
    color: #1a73e8;
    background: rgba(26, 115, 232, 0.08);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: #f8fafc;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ========== Статусные бейджи ========== */
.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.status-ok {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.status-broken {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

/* ========== Кнопки действий ========== */
.actions {
    display: flex;
    gap: 8px;
}

.btn-edit, .btn-delete {
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-edit {
    background: #eff6ff;
    color: #1a73e8;
}

.btn-edit:hover {
    background: #dbeafe;
    transform: scale(1.1);
}

.btn-delete {
    background: #fef2f2;
    color: #ef4444;
}

.btn-delete:hover {
    background: #fee2e2;
    transform: scale(1.1);
}

/* ========== Kit Master-Detail layout ========== */
.kit-layout {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

.kit-list-panel {
    flex: 0 0 48%;
}

.kit-detail-panel {
    flex: 1;
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    min-height: 300px;
    position: sticky;
    top: 20px;
    animation: fadeIn 0.3s ease;
}

.kit-row {
    cursor: pointer;
    transition: all 0.2s;
}

.kit-row:hover {
    background: #f0f7ff !important;
}

.kit-row.selected {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
    border-left: 4px solid #1a73e8;
}

.kit-row.selected td:first-child {
    padding-left: 12px;
}

.kit-equipment-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.kit-equipment-table th {
    background: #f8fafc;
    font-size: 11px;
    padding: 12px;
}

.kit-equipment-table td {
    padding: 10px 12px;
    font-size: 13px;
}

.placeholder-text {
    color: #94a3b8;
    font-size: 16px;
    text-align: center;
    margin-top: 80px;
    font-style: italic;
}

.error-message {
    color: #ef4444;
    text-align: center;
    margin-top: 50px;
}

.kit-detail-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
}

.kit-detail-header h3 {
    font-size: 20px;
    color: #1e293b;
    margin-bottom: 8px;
}

.kit-notes {
    color: #64748b;
    font-size: 14px;
    margin-top: 8px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
}

.empty-message {
    color: #94a3b8;
    font-style: italic;
    text-align: center;
    margin-top: 30px;
}

/* ========== Модальное окно ========== */
#modal-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

#modal-container.visible {
    display: flex;
}

.modal-overlay {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal {
    background: white;
    padding: 35px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f5f9;
}

/* ========== Формы ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s;
    background: #f8fafc;
    color: #1e293b;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1a73e8;
    background: white;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.form-group textarea {
    height: 100px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.btn-save {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.3);
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 115, 232, 0.4);
}

.btn-cancel {
    background: #f1f5f9;
    color: #64748b;
    border: none;
    padding: 12px 28px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-cancel:hover {
    background: #e2e8f0;
}

/* ========== Скроллбар ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========== Адаптивность ========== */
@media (max-width: 768px) {
    .container {
        padding: 15px 10px;
    }

    .header-bar {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 20px;
    }

    .kit-layout {
        flex-direction: column;
    }

    .kit-list-panel {
        flex: 1;
    }

    .kit-detail-panel {
        position: static;
    }

    .modal {
        width: 95%;
        padding: 25px;
    }
}

/* Kit holder info */
.kit-holder-info {
    margin: 15px 0;
    padding: 15px;
    background: #f8fafc;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-issue {
    background: linear-gradient(135deg, #00b894, #00a381);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-issue:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,184,148,0.3);
}

.btn-return {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    color: #475569;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-return:hover {
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
}

.movement-history {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #f1f5f9;
}

.movement-history h4 {
    font-size: 16px;
    color: #475569;
    margin-bottom: 12px;
}