/**
 * Rules Master Index - Consolidated Styling
 * Updated Brand Blue: #042969
 */

/* --- 1. SEARCH BAR (Exposed Filter) --- */
.view-id-rules .view-filters {
    background-color: #fcfcfc;
    padding: 10px 20px 20px 20px;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    margin-bottom: 30px;
}

.view-id-rules .view-filters form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.view-id-rules .view-filters .form-item {
    margin: 0;
}

.view-id-rules .view-filters input[type="text"] {
    border: 2px solid #dee2e6;
    padding: 10px 15px;
    border-radius: 4px;
    min-width: 300px;
    transition: border-color 0.2s ease;
}

.view-id-rules .view-filters input[type="text"]:focus {
    border-color: #042969; 
    outline: none;
}

.view-id-rules .view-filters .form-submit,
.view-id-rules .view-filters .button {
    background-color: #042969 !important;
    color: #fff !important;
    border: none;
    padding: 10px 20px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 4px;
}

/* --- 2. CATEGORY HEADERS (The Blue Bars) --- */
.view-id-rules .table-responsive {
    position: relative !important;
    padding-top: 55px !important; 
    overflow: visible !important;
    border: none !important;
}

.view-id-rules table caption {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background-color: #042969 !important; 
    color: #ffffff !important;
    padding: 14px 20px !important;
    font-weight: bold !important;
    text-transform: uppercase;
    text-align: left;
    border-radius: 4px 4px 0 0;
}

/* --- 3. THE TABLE --- */
.view-id-rules table {
    width: 100% !important;
    border-collapse: collapse !important;
    border: 1px solid #dee2e6 !important;
    background-color: #fff;
    margin-bottom: 40px; 
}

.view-id-rules thead {
    display: none; 
}

/* Zebra Striping */
.view-id-rules tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* --- THE HOVER EFFECT (Forcing it via CSS) --- */
.view-id-rules tr:hover, 
.view-id-rules tr:hover td {
    background-color: #f1f5fb !important; /* Very light tint of blue */
    transition: background-color 0.15s ease-in-out;
}

/* 4. Individual Column Styling */
.view-id-rules td.views-field-field-rule {
    font-weight: bold;
    color: #333;
    padding: 12px 20px !important;
    width: 140px; 
}

.view-id-rules td.views-field-title {
    padding: 12px 20px !important;
}

.view-id-rules .views-field-title a {
    color: #042969; 
    text-decoration: none;
    /* This ensures clicking the cell text works */
    display: inline-block;
    width: 100%;
}

.view-id-rules .views-field-title a:hover {
    text-decoration: underline;
}






/**
 * Rule Detail Page - Document List
 */

/* The Category Title above the documents (adjust class if needed based on your setup) */
.field--name-field-rule-category {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 20px;
    font-weight: 500;
}

/* Base styling for the document list table */
.view-id-documents_by_rule table {
    border: none !important; 
    margin-top: 20px;
}

.view-id-documents_by_rule td {
    padding: 8px 0 !important;
    border: none !important;
    background-color: transparent !important;
}

/* THE INDENTATION LOGIC: */
/* Target all rows except the first one (the main document) */
.view-id-documents_by_rule tr:not(:first-child) td {
    padding-left: 40px !important; /* Indent the amendments */
    font-size: 0.95rem; 
}

/* Add a PDF icon before the links */
.view-id-documents_by_rule .views-field-title a::before {
    content: "\f1c1"; 
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 10px;
    color: #042969; /* Updated to match your dark blue brand style */
}

/* Hover state for links */
.view-id-documents_by_rule .views-field-title a {
    color: #042969;
    text-decoration: none;
}

.view-id-documents_by_rule .views-field-title a:hover {
    text-decoration: underline;
}

/* Remove hover effect from this specific table since it's just a list of links */
.view-id-documents_by_rule tr:hover, 
.view-id-documents_by_rule tr:hover td {
    background-color: transparent !important;
    cursor: default;
}

/* Hide the table header row */
.view-id-documents_by_rule thead {
    display: none !important;
}

/* Rule Category Heading on Main Rule Page */
.field--name-field-rule-category, .historical {
    font-size: 1.25rem;
    font-weight: 600;
    color: #042969; /* Matches your dark blue brand color */
    margin-bottom: 0 !important;
}

.historical {
    margin-top: 30px;
}

.field--name-field-rule-category::before{
    content: 'Rule Category: ';
}

/* Remove the stubborn top border from the first document/table body */
.view-id-documents_by_rule tbody,
.view-id-documents_by_rule tbody tr:first-child,
.view-id-documents_by_rule tbody tr:first-child td {
    border-top: none !important;
}

/* Remove indentation for the Historical list specifically */
.view-id-documents_by_rule.view-display-id-block_2 tr td {
    padding-left: 0 !important; 
}

/* ==========================================================
   NUMBERED DOCUMENT - MAIN FILE STYLING
   ========================================================== */

/* Hide the file size text more aggressively */
.numbered-document-node .document-list span.file + span,
.numbered-document-node .document-list .file-size {
  display: none !important;
}

/* Style the main document link to look like the View links */
.numbered-document-node .document-list span.file a {
  color: #042969;
  text-decoration: none;
  font-weight: 500; /* Optional: Make the main doc stand out slightly */
}

.numbered-document-node .document-list span.file a:hover {
  text-decoration: underline;
}

/* Add the PDF icon to the main document */
.numbered-document-node .document-list span.file a::before {
  content: "\f1c1"; 
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 10px;
  color: #042969; 
}

/* ==========================================================
   NUMBERED DOCUMENT - NODE STYLING
   ========================================================== */

/* Style the Number and Category Headings to match the site blue */
.numbered-document-node .nd-heading {
  font-size: 1.25rem;
  font-weight: 600;
  color: #042969; 
  margin-bottom: 0.25rem;
  margin-top: 0;
}

/* Add the FontAwesome PDF icon to the Main Document */
.numbered-document-node .document-list span.file a::before {
  content: "\f1c1"; 
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 10px;
  color: #042969; 
}

/* Fix link styling for the Main Document */
.numbered-document-node .document-list span.file a {
  color: #042969;
  text-decoration: none;
}
.numbered-document-node .document-list span.file a:hover {
  text-decoration: underline;
}

/* Aggressively hide the filesize span on the Main Document */
.numbered-document-node .document-list span.file + span,
.numbered-document-node .document-list .file-size {
  display: none !important;
}

/* Indent the related documents ONLY on the Numbered Document nodes */
.numbered-document-node .view-id-documents_by_rule.view-display-id-block_1 tr td {
    padding-left: 40px !important; 
    font-size: 0.95rem; 
}

/* ==========================================================
   ALIGN MAIN DOCUMENT WITH VIEW TABLE
   ========================================================== */

/* Add bottom padding and a border to the main document so it mimics a table row */
.numbered-document-node .document-list {
    margin-bottom: 0 !important;
    padding-bottom: 8px; /* Matches the 8px padding of your table cells */
    border-bottom: 1px solid #042969; /* Standard Bootstrap table border */
}

/* Strip the top margin from the View table so it connects seamlessly */
.numbered-document-node .related-documents .view-id-documents_by_rule table {
    margin-top: 0 !important;
}

