/**
 * Safety Library Dashboard — style2025 theme
 * File: themes/style2025/css/safety_library.css
 * Layout: Body (trái 65%) | Terms + Checklist + Tips (phải 35%) — song song
 */

/* =============================================
   WRAPPER
   ============================================= */
.sl-wrapper {
    font-family: inherit;
    margin: 0 0 2rem 0;
}

/* =============================================
   HEADER
   ============================================= */
.sl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e5e7eb;
}

.sl-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sl-header-title h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.sl-header-badge {
    background: #ede9fe;
    color: #5b21b6;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 99px;
    letter-spacing: 0.04em;
}

.sl-header-meta {
    font-size: 12px;
    color: #64748b;
}

/* =============================================
   TAB NAVIGATION — arrow + scroll
   ============================================= */
.sl-tabs-outer {
    margin-bottom: 18px;
}

.sl-tabs-nav {
    display: flex;
    align-items: stretch;
    border-bottom: 2px solid #e5e7eb;
    position: relative;
}

.sl-arrow {
    flex-shrink: 0;
    display: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    min-width: 30px;
    background: #fff;
    border: none;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: -2px;
    cursor: pointer;
    color: #64748b;
    transition: color 0.15s, background 0.15s;
    z-index: 2;
    padding: 0;
}
.sl-arrow.visible { display: flex; }
.sl-arrow:hover { color: #1d4ed8; background: #f0f6ff; }

.sl-arrow-right { position: relative; }
.sl-arrow-right::before {
    content: '';
    position: absolute;
    left: -20px; top: 0; bottom: 2px; width: 20px;
    background: linear-gradient(to right, transparent, #fff);
    pointer-events: none;
}
.sl-arrow-left::after {
    content: '';
    position: absolute;
    right: -20px; top: 0; bottom: 2px; width: 20px;
    background: linear-gradient(to left, transparent, #fff);
    pointer-events: none;
}

.sl-tabs-bar {
    flex: 1;
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    padding: 0 2px;
}
.sl-tabs-bar::-webkit-scrollbar { display: none; }

.sl-tab-btn {
    flex-shrink: 0;
    padding: 9px 15px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    border-radius: 6px 6px 0 0;
    outline: none;
    line-height: 1.4;
}
.sl-tab-btn:hover { background: #f8fafc; color: #1e293b; }
.sl-tab-btn.active {
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
    background: #eff6ff;
    font-weight: 600;
}
.sl-tab-btn.empty { color: #94a3b8; font-style: italic; }

/* =============================================
   PANEL
   ============================================= */
.sl-panel { display: none; }
.sl-panel.active { display: block; }

/* =============================================
   2-COLUMN LAYOUT: body trái | sidebar phải
   ============================================= */
.sl-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 16px;
    align-items: start;
}

.sl-col-main { min-width: 0; }

.sl-col-sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* =============================================
   CARD — dùng chung
   ============================================= */
.sl-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 0;
}

.sl-card-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.sl-card-title svg { color: #1d4ed8; flex-shrink: 0; }

/* =============================================
   CỘT TRÁI: Body + search
   ============================================= */
.sl-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.sl-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.sl-search-input {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    outline: none;
    width: 190px;
    transition: border-color 0.15s;
}
.sl-search-input:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 2px rgba(29,78,216,0.1);
}

/* Body bài viết — bảng từ CKEditor */
.sl-article-body { line-height: 1.6; }

.sl-article-body table,
.bodytext table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 0 0 10px 0;
}
.sl-article-body table th,
.bodytext table th {
    background: #f8fafc;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: #475569;
    border: 1px solid #e5e7eb;
    white-space: nowrap;
}
.sl-article-body table td,
.bodytext table td {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    vertical-align: top;
    line-height: 1.5;
}
.sl-article-body table tr:hover td,
.bodytext table tr:hover td { background: #f8fafc; }

/* =============================================
   CỘT PHẢI: Terms
   ============================================= */
.sl-term-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sl-term-item {}

.sl-term-name {
    font-weight: 700;
    font-size: 12px;
    color: #1d4ed8;
    display: block;
    margin-bottom: 2px;
}

.sl-term-desc {
    font-size: 12px;
    color: #475569;
    line-height: 1.5;
    display: block;
}

/* =============================================
   CỘT PHẢI: Checklist
   ============================================= */
.sl-checklist-reset {
    margin-left: auto;
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 11px;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 7px;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}
.sl-checklist-reset:hover { color: #ef4444; border-color: #fca5a5; }

.sl-progress { margin-bottom: 10px; }

.sl-progress-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 5px;
}

.sl-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1d4ed8, #06b6d4);
    border-radius: 99px;
    width: 0%;
    transition: width 0.3s ease;
}

.sl-progress-label { font-size: 11px; color: #64748b; }

.sl-checklist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sl-checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 6px 5px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12.5px;
    color: #374151;
    line-height: 1.5;
    transition: background 0.12s;
}
.sl-checklist-item:hover { background: #f8fafc; }

.sl-check-box {
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    margin-top: 1px;
    transition: background 0.15s, border-color 0.15s;
    position: relative;
}

.sl-checklist-item.checked .sl-check-box {
    background: #1d4ed8;
    border-color: #1d4ed8;
}
.sl-checklist-item.checked .sl-check-box::after {
    content: '';
    position: absolute;
    left: 2px; top: 5px;
    width: 9px; height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translateY(-2px);
}
.sl-checklist-item.checked .sl-check-text {
    text-decoration: line-through;
    color: #94a3b8;
}

/* =============================================
   CỘT PHẢI: Tips AI
   ============================================= */
.sl-tips-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sl-tip {
    background: #f0f9ff;
    border-left: 3px solid #0ea5e9;
    border-radius: 0 6px 6px 0;
    padding: 9px 11px;
}

.sl-tip-label {
    font-size: 12px;
    font-weight: 700;
    color: #0c4a6e;
    margin-bottom: 4px;
}

.sl-tip-content {
    font-size: 12px;
    color: #334155;
    line-height: 1.5;
}

/* =============================================
   EMPTY STATE
   ============================================= */
.sl-empty {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
    border: 1px dashed #e2e8f0;
    border-radius: 10px;
}
.sl-empty-icon { font-size: 32px; margin-bottom: 10px; }
.sl-empty-text { font-size: 14px; line-height: 1.6; }
.sl-admin-link {
    display: inline-block;
    margin-top: 12px;
    font-size: 12px;
    color: #1d4ed8;
    text-decoration: none;
}
.sl-admin-link:hover { text-decoration: underline; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 900px) {
    /* 2 cột → 1 cột khi màn nhỏ: sidebar xuống dưới body */
    .sl-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .sl-tab-btn { font-size: 12px; padding: 8px 11px; }
    .sl-search-input { width: 100%; }
    .sl-section-header { flex-direction: column; align-items: flex-start; }

    /* table → card view trên mobile */
    .sl-article-body table thead,
    .bodytext table thead { display: none; }
    .sl-article-body table tr,
    .bodytext table tr {
        display: block;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        margin-bottom: 8px;
        padding: 6px;
    }
    .sl-article-body table td,
    .bodytext table td {
        display: flex;
        gap: 8px;
        border: none;
        border-bottom: 1px solid #f1f5f9;
        padding: 5px 4px;
        font-size: 12px;
    }
    .sl-article-body table td::before,
    .bodytext table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #475569;
        min-width: 80px;
        flex-shrink: 0;
        font-size: 11px;
    }
    .sl-article-body table td:last-child,
    .bodytext table td:last-child { border-bottom: none; }
}
