/* sach-le-app.css - Giao diện hiển thị chuẩn Sách Lễ Roma */

.sach-le-app-container {
    max-width: 1200px;
    margin: 30px auto;
    font-family: 'Times New Roman', Times, serif; /* Sách lễ giấy thường dùng font serif truyền thống */
    color: #1d2327;
}

/* --- TOP CONTROL BAR --- */
.sl-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    margin-bottom: 35px;
    flex-wrap: wrap;
    gap: 15px;
    border-top: 4px solid #d63638;
}

.sl-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
}

.sl-controls select {
    padding: 10px 15px;
    border-radius: 6px;
    border: 1px solid #dcdde1;
    background-color: #f8f9fa;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #2c3e50;
    cursor: pointer;
    transition: border-color 0.2s;
    max-width: 250px;
}
.sl-controls select:hover {
    border-color: #2271b1;
}

.sl-btn-primary, .sl-btn-secondary {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sl-btn-primary {
    background: #d63638;
    color: white;
    box-shadow: 0 4px 10px rgba(214, 54, 56, 0.3);
}
.sl-btn-primary:hover {
    background: #b32d2e;
    transform: translateY(-2px);
}

.sl-btn-secondary {
    background: #2271b1;
    color: white;
}
.sl-btn-secondary:hover {
    background: #135e96;
}

/* --- LAYOUT GRID & RESPONSIVE TABS UI --- */
.sl-layout-grid {
    display: block;
}

.sl-tabs-wrapper {
    position: relative;
}

/* Mobile-First Toggle Button */
.sl-mobile-tab-toggle {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    background: #d63638;
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 8px 0 0 8px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-weight: bold;
    cursor: pointer;
    z-index: 90;
    box-shadow: -2px 0 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.sl-mobile-tab-toggle span {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Overlay for Mobile Sidebar */
.sl-mobile-tab-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 95;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sl-tab-headers.mobile-open ~ .sl-mobile-tab-overlay,
.sl-mobile-tab-overlay.mobile-open {
    opacity: 1;
    visibility: visible;
}

/* Side Drawer Mobile Styles (Default) */
.sl-tab-headers {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100vh;
    background: #fff;
    z-index: 100; /* Below wpadminbar but above content */
    overflow-y: auto;
    padding: 20px;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sl-tab-headers.mobile-open {
    right: 0;
}

.sl-mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e2e4e7;
    padding-bottom: 15px;
    margin-bottom: 15px;
}
.sl-mobile-menu-header h3 {
    margin: 0;
    color: #1d2327;
    font-size: 18px;
    font-weight: bold;
}
.sl-mobile-tab-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #50575e;
    cursor: pointer;
    line-height: 1;
}

.sl-tab-btn {
    background: transparent;
    border: none;
    padding: 12px 15px;
    text-align: left;
    border-radius: 6px;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 15px;
    color: #50575e;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

/* Color coding for specific tabs */
.sl-tab-btn[data-target="tab-nghi-thuc-rieng"] { color: #2271b1; }
.sl-tab-btn.tab-an-tang { color: #663399; }

.sl-tab-btn:hover, .sl-tab-btn.active {
    background: #f0f0f1;
    color: #d63638;
}

/* Desktop CSS Grid overrides (>= 1024px) */
@media (min-width: 1024px) {
    .sl-tabs-wrapper {
        display: grid;
        grid-template-columns: 280px 1fr;
        gap: 30px;
        align-items: start;
    }
    
    .sl-mobile-tab-toggle,
    .sl-mobile-tab-overlay,
    .sl-mobile-menu-header {
        display: none !important;
    }

    .sl-tab-headers {
        position: sticky;
        top: 30px; /* Sticky */
        right: auto;
        width: 100%;
        height: auto;
        background: transparent;
        box-shadow: none;
        padding: 0;
        z-index: 10;
        transform: none;
        overflow: visible;
        border: 1px solid #e2e4e7;
        background: #f8f9fa;
        border-radius: 8px;
        padding: 10px;
    }

    .sl-tab-btn.active {
        background: #fff;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        border-left: 4px solid #d63638; /* Active indicator */
    }
}
.sl-tab-content-container {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 0 8px 8px 8px;
    min-height: 600px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.05);
}

.sl-tab-pane {
    display: none;
    padding: 40px;
}
.sl-tab-pane.active {
    display: block;
    animation: fadeInTab 0.3s ease;
}

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.sl-pane-header {
    border-bottom: 3px double #e2e4e7;
    margin-bottom: 30px;
    padding-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sl-pane-header h2 {
    margin: 0;
    color: #d63638;
    font-size: 25px;
    font-weight: bold;
    text-transform: uppercase;
}

/* --- JSON TO HTML TYPOGRAPHY (Mô phỏng sách in) --- */
.sl-pane-body {
    font-size: 17px; /* Chuẩn văn bản đọc sâu học thuật */
    line-height: 1.7;
    color: #111;
}

.sl-pane-body p {
    margin-bottom: 15px;
}

/* Chữ đỏ (Rubrics) */
.rubrics {
    color: #d63638;
    font-style: normal;
    font-size: 0.95em;
    margin: 12px 0 4px 0;
    white-space: pre-line;
}

/* Lời đọc chung */
.sl-pane-body p {
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.spoken-line {
    margin-bottom: 12px;
}

.spoken-line.no-badge {
    padding-left: 15px; /* Thụt đầu dòng nếu dòng đọc nằm dưới chỉ dẫn đỏ nhưng không có vai trò ở đầu */
}

/* Vai trò Chủ tế / CĐ */
.role-badge {
    font-weight: bold;
    color: #d63638; 
    margin-right: 8px;
}

/* Chữ đen bình thường */
.body-text {
    color: #111;
    white-space: pre-line;
}

/* Tiêu đề cấp nhỏ bên trong nội dung JSON */
.sl-section-title {
    color: #d63638;
    margin-top: 35px;
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
}
.sl-section-title:first-child {
    margin-top: 0;
}

/* --- SIDEBAR TABS (VERTICAL TABS) --- */
.sl-sidebar {
    background: transparent;
    border: none;
    box-shadow: none;
    position: sticky;
    top: 30px;
}

.sl-sidebar-tabs {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 0;
    position: relative;
    z-index: 2;
}

.sl-sidebar-tab-btn {
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    border-bottom: none; /* Connect vertically */
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #50575e;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s ease;
    text-align: left;
    outline: none;
}
.sl-sidebar-tab-btn:last-child {
    border-bottom: 1px solid #c3c4c7;
    border-radius: 8px; /* Not active state */
}

/* Connect active tab to content */
.sl-sidebar-tab-btn.active {
    background: #fff;
    color: #d63638;
    border-color: #c3c4c7;
    border-right-color: transparent; /* Seamless blend if on left */
    border-bottom-color: transparent;
    position: relative;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.02);
}

/* Custom Purple for An Táng */
.sl-sidebar-tab-btn.tab-an-tang.active {
    color: #6a1b9a; /* Purple text */
    border-left: 4px solid #6a1b9a;
}

.sl-sidebar-content-container {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.sl-sidebar-tab-pane {
    display: none;
}
.sl-sidebar-tab-pane.active {
    display: block;
}

/* Quick View Panel */
details.sl-quick-details {
    margin-bottom: 10px;
    border: 1px solid #e2e4e7;
    border-radius: 5px;
    overflow: hidden;
}
details.sl-quick-details summary {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 600;
    cursor: pointer;
    padding: 12px 15px;
    background: #f8f9fa;
    outline: none;
    font-size: 15px;
}
details.sl-quick-details summary:hover { background: #f0f0f1; }
.sl-quick-details-content {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #e2e4e7;
    max-height: 400px;
    overflow-y: auto;
}

/* THÁNH LỄ GỘP CHUNG (ASSEMBLED VIEW) */
.mass-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px dashed #c3c4c7;
}
.mass-section:last-child { border-bottom: none; }

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 900px) {
    /* Menu Nổi Ở Giữa Bên Phải */
    .sl-mobile-tab-toggle {
        display: flex;
        position: fixed;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        background: #d63638;
        color: white;
        border: none;
        padding: 15px 10px 15px 15px;
        border-radius: 8px 0 0 8px;
        box-shadow: -2px 2px 10px rgba(0,0,0,0.2);
        z-index: 99;
        cursor: pointer;
        writing-mode: vertical-rl;
        text-orientation: mixed;
        font-weight: bold;
        font-size: 14px;
        letter-spacing: 1px;
    }
    .sl-mobile-tab-toggle span {
        display: inline-block;
        transform: rotate(180deg);
    }
    
    .sl-mobile-tab-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 100;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    .sl-tabs-wrapper.menu-open .sl-mobile-tab-overlay {
        opacity: 1;
        visibility: visible;
    }

    .sl-tab-headers {
        position: fixed;
        top: 0;
        right: -320px;
        width: 300px;
        max-width: 85vw;
        height: 100vh;
        background: #f9f9f9;
        z-index: 1000;
        flex-direction: column;
        flex-wrap: nowrap;
        padding: 0;
        overflow-y: auto;
        box-shadow: -5px 0 15px rgba(0,0,0,0.2);
        transition: right 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        margin-bottom: 0;
    }
    .sl-tabs-wrapper.menu-open .sl-tab-headers {
        right: 0;
    }

    .sl-mobile-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        background: #fff;
        border-bottom: 1px solid #ddd;
        margin-bottom: 10px;
    }
    .sl-mobile-menu-header h3 {
        margin: 0;
        font-size: 18px;
        color: #d63638;
    }
    .sl-mobile-tab-close {
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
        color: #555;
    }

    .sl-tab-btn {
        margin: 0 15px 10px 15px;
        border-radius: 8px;
        padding: 15px;
        text-align: left;
        font-size: 15px;
        border: 1px solid #e0e0e0;
        box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    }
    
    .sl-top-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sl-controls select {
        max-width: 100%;
    }

    .sl-sidebar {
        position: static;
        margin-top: 20px;
    }
}
