/**
 * RAGVue WA - OS3 Brand Theme
 * Navy / Gold / Green color scheme
 * Matches os3.org branding
 */

/* ==========================================================================
   COLOR REFERENCE - OS3 Brand Colors
   ==========================================================================
   Navy:        #1a2332  (backgrounds, headers)
   Navy-light:  #2d3e50  (gradients, hover states)
   Gold:        #d4af37  (accents, highlights, CTAs)
   Gold-light:  #e8c547  (hover states)
   Green:       #4a7c59  (success, status badges)
   Green-light: #5c9e6f  (hover states)
   White:       #ffffff
   Gray-light:  #f5f5f5  (section backgrounds)
   Gray:        #888888  (secondary text)
   Gray-dark:   #333333  (body text)
   ========================================================================== */


/* ==========================================================================
   BASE STYLES
   ========================================================================== */
html, body {
    background-color: #f5f5f5;
    color: #333333;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

body {
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

a {
    color: #d4af37;
}

a:hover {
    color: #e8c547;
}


/* ==========================================================================
   NAVBAR - Navy with Gold accent
   ========================================================================== */
.navbar.is-dark {
    background: linear-gradient(135deg, #1a2332 0%, #2d3e50 100%) !important;
    border-bottom: 3px solid #d4af37;
}

.navbar-item.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #d4af37 !important;
    letter-spacing: 1px;
}

.navbar-item.logo .has-text-info {
    color: #ffffff !important;
}

.navbar-item {
    color: #ffffff !important;
    transition: color 0.3s;
}

.navbar-item:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #d4af37 !important;
}

.navbar-item.is-active {
    color: #d4af37 !important;
    border-bottom: 2px solid #d4af37;
    background-color: transparent !important;
}

.navbar-burger span {
    background-color: #ffffff !important;
}

.navbar-menu {
    background: #1a2332 !important;
}

@media screen and (max-width: 1023px) {
    .navbar-menu.is-active {
        background: #1a2332 !important;
    }
}


/* ==========================================================================
   HERO - Page headers with gradient
   ========================================================================== */
.hero-os3 {
    background: linear-gradient(135deg, #1a2332 0%, #2d3e50 100%);
    color: #ffffff;
    border-bottom: 3px solid #d4af37;
}

.hero-os3 .hero-body {
    padding: 2rem 1.5rem;
}

.hero-os3 .title {
    color: #d4af37 !important;
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.hero-os3 .subtitle {
    color: #f5f5f5 !important;
    font-size: 1.1rem;
}

.hero-os3 .hero-stats {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.hero-os3 .stat-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #d4af37;
    color: #d4af37;
    font-size: 14px;
    font-weight: 500;
}


/* ==========================================================================
   FOOTER - Navy with Gold accent
   ========================================================================== */
.footer.has-background-dark {
    background: linear-gradient(135deg, #2d3e50 0%, #1a2332 100%) !important;
    border-top: 3px solid #d4af37;
    padding: 2rem 1.5rem;
    color: #888888;
}

.footer a {
    color: #d4af37;
}

.footer a:hover {
    color: #e8c547;
}


/* ==========================================================================
   SECTIONS
   ========================================================================== */
.section {
    background-color: #f5f5f5;
}

.section-dark {
    background: #1a2332;
    color: #ffffff;
}


/* ==========================================================================
   BOXES / CARDS
   ========================================================================== */
.box {
    background-color: #ffffff;
    border: 1px solid #dddddd;
    color: #333333;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.box:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}


/* ==========================================================================
   BUTTONS - Gold primary, Green success
   ========================================================================== */
.button.is-info {
    background-color: #d4af37;
    border-color: #d4af37;
    color: #1a2332;
    font-weight: bold;
}

.button.is-info:hover {
    background-color: #e8c547;
    border-color: #e8c547;
    color: #1a2332;
}

.button.is-info.is-outlined {
    border-color: #d4af37;
    color: #d4af37;
    background-color: transparent;
}

.button.is-info.is-outlined:hover {
    background-color: #d4af37;
    color: #1a2332;
}

.button.is-success {
    background-color: #4a7c59;
    border-color: #4a7c59;
}

.button.is-success:hover {
    background-color: #5c9e6f;
    border-color: #5c9e6f;
}

.button.is-warning {
    background-color: #d4af37;
    border-color: #d4af37;
    color: #1a2332;
}

.button.is-warning.is-outlined {
    border-color: #d4af37;
    color: #d4af37;
    background-color: transparent;
}

.button.is-warning.is-outlined:hover {
    background-color: #d4af37;
    color: #1a2332;
}


/* ==========================================================================
   TEXT COLORS
   ========================================================================== */
.title {
    color: #1a2332;
}

.subtitle {
    color: #888888;
}

h1, h2, h3, h4, h5, h6 {
    color: #1a2332;
}

.has-text-gold {
    color: #d4af37 !important;
}

.has-text-navy {
    color: #1a2332 !important;
}

.has-text-os3-green {
    color: #4a7c59 !important;
}


/* ==========================================================================
   TAGS / BADGES
   ========================================================================== */
.tag.is-gold {
    background-color: #d4af37;
    color: #1a2332;
}

.tag.is-navy {
    background-color: #1a2332;
    color: #ffffff;
}

.tag.is-os3-green {
    background-color: #4a7c59;
    color: #ffffff;
}

.status-badge {
    display: inline-block;
    background: #4a7c59;
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
}


/* ==========================================================================
   FORMS
   ========================================================================== */
.input, .textarea, .select select {
    background-color: #ffffff;
    border-color: #dddddd;
    color: #333333;
}

.input:focus, .textarea:focus, .select select:focus {
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.input::placeholder, .textarea::placeholder {
    color: #888888;
}


/* ==========================================================================
   SEARCH BOX
   ========================================================================== */
.search-box {
    display: flex;
    gap: 0.5rem;
    max-width: 800px;
    margin: 0 auto;
    flex-wrap: wrap;
    justify-content: center;
}

.search-box input[type="text"] {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: #ffffff;
    color: #333333;
    border: 1px solid #dddddd;
    border-radius: 4px;
}

.search-box input[type="text"]:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.search-box input[type="text"]::placeholder {
    color: #888888;
}

.search-box select {
    padding: 0.75rem 1rem;
    background: #ffffff;
    color: #333333;
    border: 1px solid #dddddd;
    border-radius: 4px;
}

.search-box button {
    padding: 0.75rem 1.5rem;
    background: #d4af37;
    color: #1a2332;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.search-box button:hover {
    background: #e8c547;
}


/* ==========================================================================
   SEARCH RESULTS
   ========================================================================== */
.results-section {
    margin-top: 2rem;
}

.result-item {
    background: #ffffff;
    border: 1px solid #dddddd;
    border-left: 4px solid #d4af37;
    border-radius: 4px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.result-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.result-source {
    font-size: 0.8rem;
    color: #888888;
}

.result-similarity {
    font-size: 0.8rem;
    color: #4a7c59;
    font-weight: 600;
}

.result-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a2332;
    margin-bottom: 0.25rem;
}

.result-doc-key {
    font-size: 0.85rem;
    color: #d4af37;
    margin-bottom: 0.5rem;
}

.result-snippet {
    font-size: 0.9rem;
    color: #333333;
    line-height: 1.5;
}


/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 35, 50, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.modal-backdrop.is-active {
    display: flex;
}

.modal-box {
    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 8px;
    max-width: 900px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #f5f5f5;
    border: 1px solid #dddddd;
    color: #333333;
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: #dddddd;
    color: #1a2332;
}

.modal-body {
    padding: 2rem;
}

.modal-body h2 {
    color: #1a2332;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.modal-body .doc-key {
    color: #d4af37;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.modal-body .content {
    color: #333333;
    line-height: 1.7;
    white-space: pre-wrap;
}


/* ==========================================================================
   CROSSWALK
   ========================================================================== */
.crosswalk-section {
    margin-top: 1.5rem;
}

.crosswalk-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.crosswalk-item {
    background: #ffffff;
    border: 1px solid #dddddd;
    border-left: 4px solid #4a7c59;
    border-radius: 4px;
    padding: 1rem;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.crosswalk-item:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
}

.crosswalk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.crosswalk-citation {
    font-weight: 600;
    color: #d4af37;
    font-size: 0.95rem;
}

.crosswalk-title {
    color: #1a2332;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.crosswalk-context {
    color: #888888;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    font-style: italic;
    line-height: 1.4;
}


/* ==========================================================================
   REPORT
   ========================================================================== */
.report {
    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.report-header {
    margin-bottom: 1.5rem;
}

.report-header.clickable-header {
    cursor: pointer;
    padding: 1rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.report-header.clickable-header:hover {
    background: #f5f5f5;
    border-left: 3px solid #d4af37;
}

.click-hint {
    font-size: 0.8rem;
    color: #d4af37;
    margin-top: 0.5rem;
}

.report-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #d4af37;
    margin-bottom: 0.25rem;
}

.report-subtitle {
    font-size: 1.1rem;
    color: #1a2332;
    margin-bottom: 0.5rem;
}

.report-meta {
    font-size: 0.85rem;
    color: #888888;
}

.report-divider {
    border: none;
    border-top: 1px solid #dddddd;
    margin: 1.5rem 0;
}

.report-summary {
    margin-bottom: 2rem;
}

.report-summary h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1a2332;
    margin-bottom: 0.75rem;
}

.report-summary ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.report-summary li {
    color: #333333;
    padding: 0.25rem 0;
}

.report-section {
    margin-bottom: 2rem;
}

.report-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1a2332;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #d4af37;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
}

.report-table th {
    text-align: left;
    padding: 0.75rem;
    background: #1a2332;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.85rem;
}

.report-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #dddddd;
    color: #333333;
    font-size: 0.9rem;
}

.report-table tr:hover td {
    background: #f5f5f5;
}

.report-table tr.clickable-row {
    cursor: pointer;
}

.report-table tr.clickable-row:hover .citation-cell {
    text-decoration: underline;
}

.report-table .citation-cell {
    color: #d4af37;
    font-weight: 500;
    white-space: nowrap;
    width: 150px;
}

.report-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #dddddd;
    text-align: center;
    font-size: 0.8rem;
    color: #888888;
}


/* ==========================================================================
   EXPLORER TABLES
   ========================================================================== */
.explorer-box {
    max-height: 75vh;
    overflow-y: auto;
}

.explorer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.explorer-table th {
    text-align: left;
    padding: 0.5rem;
    background: #1a2332;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

.explorer-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #dddddd;
    color: #333333;
    vertical-align: middle;
}

.explorer-table tr:hover td {
    background: #f5f5f5;
}

.explorer-table .code-cell {
    font-family: monospace;
    color: #888888;
    width: 50px;
}

.explorer-table .citation-cell {
    color: #d4af37;
    font-weight: 500;
    white-space: nowrap;
}

.explorer-table .number-cell {
    text-align: right;
    color: #888888;
    width: 80px;
}

.explorer-table .actions-cell {
    white-space: nowrap;
    width: 140px;
}

.explorer-table .actions-cell .button {
    margin-right: 0.25rem;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    height: auto;
    min-width: 55px;
}

.explorer-table tr.clickable-row {
    cursor: pointer;
}

.explorer-table tr.clickable-row:hover .citation-cell {
    text-decoration: underline;
}

.agency-abbrev {
    color: #888888;
    font-size: 0.8rem;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.detail-header .title {
    margin-bottom: 0;
    color: #1a2332;
}

.detail-placeholder {
    padding: 2rem;
}

.detail-hint {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 4px;
    border-left: 4px solid #d4af37;
}

.detail-hint p {
    margin-bottom: 0.5rem;
    color: #333333;
}

.detail-hint p:last-child {
    margin-bottom: 0;
}


/* ==========================================================================
   DARK BACKGROUND TABLES - hover fix for light-on-dark tables
   ========================================================================== */
.table.has-background-black-ter tbody tr:hover {
    background-color: #2d3e50;
}

/* ==========================================================================
   CONSTITUTION BROWSE
   ========================================================================== */
.constitution-browse {
    margin-top: 1.5rem;
}

.browse-heading {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a2332;
    margin-bottom: 1.5rem;
}

/* Source-level <details> (WA State / Federal) */
.browse-source {
    margin-bottom: 1.5rem;
}

.browse-source-title {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    background: #f5f5f5;
    color: #1a2332;
    border-left: 4px solid #d4af37;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

.browse-source-title::-webkit-details-marker {
    display: none;
}

.browse-source-title::before {
    content: '\25B6';
    font-size: 0.7rem;
    transition: transform 0.2s;
    color: #1a2332;
}

details[open] > .browse-source-title::before {
    transform: rotate(90deg);
}

.browse-source-body {
    padding: 0.5rem 0 0.5rem 1rem;
}

/* Article-level <details> */
.browse-article {
    margin-bottom: 0.25rem;
}

.browse-article-title {
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    background: #f5f5f5;
    color: #1a2332;
    border-left: 3px solid #d4af37;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

.browse-article-title::-webkit-details-marker {
    display: none;
}

.browse-article-title::before {
    content: '\25B6';
    font-size: 0.6rem;
    transition: transform 0.2s;
    color: #888888;
}

details[open] > .browse-article-title::before {
    transform: rotate(90deg);
}

.browse-article-body {
    padding: 0.25rem 0 0.25rem 1.5rem;
}

/* Sub-group labels (e.g., Federal Article 1, Article 2) */
.browse-sub-group {
    margin-bottom: 0.5rem;
}

.browse-sub-label {
    display: block;
    font-size: 0.85rem;
    color: #1a2332;
    padding: 0.25rem 0;
    border-bottom: 1px solid #dddddd;
    margin-bottom: 0.25rem;
}

/* Individual provision items */
.browse-item {
    display: flex;
    gap: 1rem;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    border-left: 3px solid transparent;
    border-bottom: 1px solid #e8e8e8;
    transition: background 0.15s, border-color 0.15s;
    font-size: 0.85rem;
}

.browse-item:last-child {
    border-bottom: none;
}

.browse-item:hover {
    background: #f5f5f5;
    border-left-color: #d4af37;
}

.browse-item-key {
    color: #d4af37;
    font-weight: 500;
    white-space: nowrap;
    min-width: 220px;
}

.browse-item-title {
    color: #333333;
    flex: 1;
}

/* ==========================================================================
   LANDING PAGE
   ========================================================================== */
.hero-landing {
    background: linear-gradient(135deg, #1a2332 0%, #2d3e50 100%);
    color: #ffffff;
    padding: 60px 0;
    border-bottom: 3px solid #d4af37;
}

.hero-landing .title {
    color: #d4af37 !important;
    font-size: 2.5rem;
}

.hero-landing .subtitle {
    color: #f5f5f5 !important;
}

.disparity-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .disparity-grid {
        grid-template-columns: 1fr;
    }
}

.disparity-box {
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid #dddddd;
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.disparity-box.old {
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid #c62828;
}

.disparity-box.new {
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid #4a7c59;
}

.disparity-box h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: #1a2332;
}

.disparity-box.old h3 { 
    color: #c62828; 
}

.disparity-box.new h3 { 
    color: #4a7c59; 
}

.disparity-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.disparity-box li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #dddddd;
    color: #333333;
    line-height: 1.5;
}

.disparity-box li:last-child {
    border-bottom: none;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    text-align: center;
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #d4af37;
}

.stat-label {
    font-size: 0.85rem;
    color: #888888;
    margin-top: 0.25rem;
}

.cta-button {
    display: inline-block;
    background: #d4af37;
    color: #1a2332;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
}

.cta-button:hover {
    background: #e8c547;
    color: #1a2332;
}


/* ==========================================================================
   HTMX LOADING INDICATOR
   ========================================================================== */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #dddddd;
    border-top-color: #d4af37;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ==========================================================================
   LEVEL STATS (Bulma override)
   ========================================================================== */
.level .heading {
    color: #888888;
}

.level .title {
    color: #d4af37;
}


/* ==========================================================================
   PRINT STYLES
   ========================================================================== */
@media print {
    .navbar, .footer, .hero-os3 {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .report {
        border: none !important;
        padding: 0 !important;
        box-shadow: none !important;
    }
}