/* RuleHub Frontend Styles */
.rulehub-container, .rulehub-remote-container {
    font-family: 'Sarabun', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 20px 0;
    color: #1a202c;
}

/* Category Section Titles (Separate Sections Layout) */
.rulehub-section-block {
    margin-bottom: 36px;
}

.rulehub-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin: 24px 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 3px solid #00a0e9; /* Match cyan/blue underline from screenshot */
    display: flex;
    align-items: center;
    gap: 8px;
}

.rulehub-icon-menu {
    font-size: 16px;
    color: #4a5568;
}

/* Category Tabs */
.rulehub-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 4px;
}

.rulehub-tab-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s ease;
}

.rulehub-tab-btn:hover {
    color: #2b6cb0;
    background: #edf2f7;
}

.rulehub-tab-btn.active {
    color: #2b6cb0;
    border-bottom: 3px solid #2b6cb0;
    background: #ebf8ff;
}

/* Filter Bar */
.rulehub-filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.rulehub-search-input {
    flex: 1;
    min-width: 240px;
    padding: 10px 14px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 15px;
}

.rulehub-year-select {
    padding: 10px 14px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 15px;
    background: #ffffff;
}

/* Table Style */
.rulehub-table-wrapper {
    overflow-x: auto;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.rulehub-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    background: #ffffff;
}

.rulehub-table th {
    background: #f8fafc;
    color: #2d3748;
    font-weight: 700;
    padding: 12px 14px;
    border: 1px solid #cbd5e0;
    font-size: 15px;
    text-align: center !important; /* CENTER ALIGN ALL TABLE HEADERS */
    vertical-align: middle !important;
}

.rulehub-table td {
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    font-size: 15px;
    vertical-align: middle;
}

/* Column Alignment Defaults */
.rulehub-table td:nth-child(1) {
    text-align: center !important; /* เลขที่: จัดกลาง */
    font-weight: 600;
}

.rulehub-table td:nth-child(2) {
    text-align: center !important; /* ลงวันที่: จัดกลาง */
}

.rulehub-table td:nth-child(3) {
    text-align: left !important; /* เรื่อง: จัดชิดซ้าย */
}

.rulehub-table td:nth-child(4) {
    text-align: center !important; /* สถานะ: จัดกลาง */
}

.rulehub-table tr:hover {
    background: #f8fafc;
}

.rulehub-doc-title-link {
    color: #2e7d32; /* Green text matching screenshots */
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s;
}

.rulehub-doc-title-link:hover {
    color: #1b5e20;
    text-decoration: underline;
}

/* Status Styling */
.rulehub-status-active {
    color: #2e7d32;
    font-weight: bold;
}

.rulehub-status-canceled {
    color: #e53e3e;
    font-weight: bold;
}

.rulehub-replaced-link {
    color: #e53e3e;
    text-decoration: underline;
    font-weight: bold;
    cursor: pointer;
}

/* Bullet List Style (PDPA Mode) */
.rulehub-bullet-list {
    list-style-type: disc;
    padding-left: 24px;
    margin: 16px 0;
}

.rulehub-bullet-list li {
    margin-bottom: 10px;
    font-size: 16px;
    line-height: 1.6;
}

.rulehub-bullet-list a {
    color: #2b6cb0;
    text-decoration: none;
    font-weight: 500;
}

.rulehub-bullet-list a:hover {
    text-decoration: underline;
}

/* PDF Modal Preview (Padded 85px from top to guarantee clearing sticky theme headers) */
.rulehub-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.82) !important;
    z-index: 9999999 !important;
    display: none !important; /* HIDDEN BY DEFAULT */
    align-items: flex-start !important; /* Start below top header */
    justify-content: center !important;
    padding: 85px 20px 20px 20px !important; /* 85px top offset completely clears any theme navbar */
    box-sizing: border-box !important;
}

.rulehub-modal-overlay.active {
    display: flex !important; /* VISIBLE ONLY WHEN .active CLASS IS ADDED BY JS CLICK */
}

.rulehub-modal-content {
    background: #ffffff !important;
    width: 100% !important;
    max-width: 980px !important;
    height: calc(100vh - 110px) !important; /* Height fits cleanly within screen */
    border-radius: 10px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7) !important;
    position: relative !important;
    z-index: 10000000 !important;
}

.rulehub-modal-header {
    padding: 12px 20px !important;
    background: #2b6cb0 !important;
    color: #ffffff !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15) !important;
}

.rulehub-modal-title {
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding-right: 15px !important;
}

.rulehub-modal-close {
    background: rgba(255, 255, 255, 0.25) !important;
    border: none !important;
    color: #ffffff !important;
    font-size: 24px !important;
    line-height: 1 !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
}

.rulehub-modal-close:hover {
    background: #e53e3e !important;
    color: #ffffff !important;
    transform: scale(1.1);
}

.rulehub-modal-body {
    flex: 1;
    background: #edf2f7;
}

.rulehub-pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
}
