/* ========================================
   SHARED STYLES - style.css
   Used by: index.html, world.html, sectors.html
   ======================================== */

/* ========================================
   DC.JS CHART OVERRIDES
   ======================================== */

.dc-chart g.row text {
    fill: #000;
    font-size: 13px;
    font-weight: 400;
}

.dc-chart svg {
    overflow: visible;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

input[type="checkbox"] {
    accent-color: white;
    border: 1px solid #999;
}

/* ========================================
   NAVIGATION
   ======================================== */

.nav-link {
    float: right;
    font-size: 14px;
    color: #666;
    text-decoration: none;
    font-weight: bold;
    margin-right: 15px;
}

.nav-link:hover {
    text-decoration: underline;
}

/* ========================================
   LOADING OVERLAY
   ======================================== */

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.2s ease;
}

.loading-hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-visible {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 100px;
    height: 100px;
    border: 20px solid #f3f3f3;
    border-top: 20px solid #9ecae1;
    border-radius: 90%;
    animation: spin 1s linear infinite;
}

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

/* ========================================
   CLEAR/RESET BUTTON
   ======================================== */

.clear-button {
    background-color: transparent;
    border: none;
    padding: 4px 12px;
    margin-right: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #0066cc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clear-button:hover {
    text-decoration: underline;
}

/* ========================================
   FILTER BOXES (Active Filters Display)
   ======================================== */

.filter-boxes-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.filter-box {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    background-color: #fff;
}

.filter-box-title {
    font-size: 13px;
    margin-bottom: 4px;
    color: #555;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-box-values {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.filter-value-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-value-badge:hover {
    background-color: #ffe0e0;
    border-color: #c88;
}

.filter-value-close {
    color: #888;
    font-size: 12px;
    margin-left: 2px;
}

.filter-value-badge:hover .filter-value-close {
    color: #c00;
}

/* ========================================
   CHART UI COMPONENTS
   ======================================== */

.chart-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-title-text {
    /* inherits from .chart-title */
}

.chart-title-count {
    font-size: 12px;
    font-weight: 400;
    color: #888;
    text-transform: none;
    letter-spacing: 0;
    min-width: 30px;
    text-align: right;
}

.chart-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Search inputs in filter columns */
.chart-search-container {
    position: relative;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.chart-search {
    width: 100%;
    padding: 6px 28px 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
}

.chart-search:focus {
    outline: none;
    border-color: #0066cc;
}

.chart-search::placeholder {
    color: #999;
}

.chart-search-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 18px;
    pointer-events: none;
}

.chart-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    display: none;
}

.chart-search-clear:hover {
    color: #333;
}

/* When input has value or selection, hide icon and show clear button */
.chart-search:not(:placeholder-shown)~.chart-search-icon,
.chart-search-container.has-selection .chart-search-icon {
    display: none;
}

.chart-search:not(:placeholder-shown)~.chart-search-clear,
.chart-search-container.has-selection .chart-search-clear {
    display: block;
}

.chart-search.has-selection {
    border: 2px solid #333;
    background-color: #fff;
}

.chart-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.chart-search-item {
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}

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

.chart-search-item:hover,
.chart-search-item.selected {
    background-color: #e8f0fe;
}

.chart-search-item .item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 10px;
}

.chart-search-item .item-count {
    color: #666;
    font-size: 12px;
    flex-shrink: 0;
}

/* ========================================
   STORY CARD STYLES
   ======================================== */

.story {
    display: flex;
    flex-direction: row;
    position: relative;
    border-bottom: 1px solid #e5e5e5;
    margin: 0;
    padding: 12px 0;
    align-items: flex-start;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.story:hover {
    background-color: #f0f0f0;
}

.story-image {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    margin-right: 12px;
    opacity: 0;
    transition: opacity 0.2s ease-in;
}

.story-image.loaded {
    opacity: 1;
}

.story-body {
    flex: 1;
    min-width: 0;
    margin-left: 0;
    overflow: hidden;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.story-body:hover {
    background-color: #e0e0e0;
}

.story-body h3 {
    margin-top: -6px !important;
    margin-bottom: -2px !important;
}

.story-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0 4px 6px 4px;
    padding: 0;
    font-size: 14px;
    line-height: 1;
}

.story-publication {
    font-weight: 600;
    font-size: 15px;
    color: #c00;
}

.story-date {
    color: #444;
    font-weight: 400;
    font-size: 13px;
}

h3.story-title {
    font-size: 15px;
    font-weight: 500;
    margin: 2px 4px 4px 4px;
    padding: 0;
    padding-right: 80px;
    line-height: 1.3;
    color: #222;
}

.story-title:hover {
    text-decoration: underline;
}

.story-authors {
    margin: 4px 4px 2px 4px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
}

.story-quote {
    margin: 4px 4px 4px 8px;
    padding: 2px 0 2px 8px;
    border-left: 2px solid #ddd;
    font-style: italic;
    font-size: 13px;
    color: #555;
    line-height: 1.4;
}

blockquote.story-quote {
    text-decoration: none;
}

.story-bias {
    position: absolute;
    top: 12px;
    right: 10px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.story-topics {
    margin: 4px 4px 0 4px;
    font-size: 13px;
    font-weight: 500;
    color: #888;
}

.story-topics-small {
    margin: 2px 4px 0 4px;
    font-size: 10px;
    font-weight: 400;
    color: #999;
}

.story-topic {
    margin: 0 4px 2px 4px;
    font-weight: 500;
    font-size: 12px;
    color: #c00;
}

.story-country {
    position: absolute;
    top: 0;
    right: 0.5rem;
    font-size: 0.7em;
    font-weight: 500;
    color: #333;
}

.story-excerpt {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    margin-right: 10px;
    margin-block-start: 2px;
    margin-block-end: 2px;
}

/* Legacy story styles for compatibility */
.story-count {
    font-size: 22px;
    font-weight: 600;
}

.state-story-count {
    font-size: 12px;
    font-weight: 500;
}

.story-filters {
    font-size: 18px;
    font-weight: 500;
    opacity: 0.7;
}

.story-parties {
    flex: wrap;
    font-size: 17px;
    font-weight: 500;
    margin-right: 10px;
}

.story-topics-and-status {
    color: #060ff0;
    font-size: 14px;
    font-weight: 500;
}

a.story-source {
    font-size: 16px;
    font-weight: 500;
    color: var(--grey-text);
    margin-right: 10px;
}

/* ========================================
   SECTOR PANEL STYLES
   ======================================== */

.sector-panel {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    background-color: #f5f5f5;
    width: calc(100% - 8px);
    margin: 0 4px;
    box-sizing: border-box;
    min-height: 36px;
}

.sector-panel:hover {
    background-color: #eaeaea;
    border-color: #999;
}

.sector-panel.active {
    background-color: #e0e0e0;
    border-color: #333;
    border-width: 2px;
}

.sector-panel.active:hover {
    background-color: #d8d8d8;
}

.sector-panel.disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.sector-name {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.2;
    color: #333;
    text-align: left;
}

.sector-story-count {
    font-size: 12px;
    font-weight: 400;
    color: #666;
    margin-left: auto;
    text-align: right;
    white-space: nowrap;
}

/* Sector panels for sectors.html - card style */
.sector-panel-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px;
    border: 2px solid;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 80px;
    min-height: 80px;
}

.sector-panel-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    filter: brightness(0.95);
}

.sector-panel-card.active {
    font-weight: 700;
}

.sector-panel-card.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
    filter: grayscale(100%);
}

/* ========================================
   BUREAU PANEL STYLES
   ======================================== */

/* Bureau panel container - used by world.html in results header */
.bureau-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
}

.bureau-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 8px 4px;
    background-color: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 65px;
    min-height: 80px;
}

.bureau-panel:hover {
    background-color: #e8e8e8;
    border-color: #999;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bureau-panel.active {
    background-color: #0066cc;
    border-color: #0052a3;
    color: white;
}

.bureau-panel.active:hover {
    background-color: #0052a3;
}

.bureau-panel.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
    filter: grayscale(100%);
    background-color: #e8e8e8;
}

.bureau-name {
    font-size: 12px;
    font-weight: 300;
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 70px;
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.bureau-abbr {
    font-size: 14px;
    font-weight: 400;
    margin-top: auto;
    letter-spacing: 0.5px;
}

.bureau-story-count {
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    opacity: 0.8;
    margin-top: 4px;
}

/* ========================================
   COUNTRY TABLE STYLES (sectors.html)
   ======================================== */

.country-header {
    display: grid;
    grid-template-columns: 150px 90px 90px 140px;
    font-weight: 600;
    font-size: 16px;
    padding-bottom: 5px;
    border-bottom: 1px solid #ccc;
    margin-bottom: 5px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.country-row {
    display: grid;
    grid-template-columns: 150px 90px 90px 140px;
    height: 22px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.country-row:hover {
    background-color: #e8e8e8;
}

.country-row.country-active {
    background-color: #0052a3;
    color: white;
}

.country-row.country-active:hover {
    background-color: #003d7a;
}

.country-cell {
    display: flex;
    align-items: center;
    height: 20px;
    margin-bottom: 2px;
}

.country-cell-name {
    font-weight: 400;
    font-size: 16px;
    padding-left: 4px;
}

.country-cell-bar {
    position: relative;
}

.country-bar {
    height: 20px;
    background-color: #9ecae1;
    position: relative;
}

.country-bar-stories {
    height: 20px;
    background-color: #bbb;
    position: relative;
}

.country-bar-label {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

/* Legacy clickable country rows */
.row-background {
    transition: fill 0.2s ease, background-color 0.2s ease;
}

.row-background.row-highlight {
    background-color: #dadada !important;
    fill: #dadada !important;
}

[data-country] {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

[data-country]:hover .row-background {
    background-color: #e8e8e8 !important;
}

[data-country].country-active {
    background-color: #0052a3 !important;
    color: white !important;
}

[data-country].country-active .row-background {
    background-color: #0052a3 !important;
}

[data-country].country-active:hover .row-background {
    background-color: #003d7a !important;
}

/* ========================================
   MISCELLANEOUS
   ======================================== */

.state-img {
    padding-top: 16px;
    padding-right: 16px;
}

.y-axis-label {
    font-size: 14px;
}

.logo-image {
    float: left;
}

#chart-topic label {
    display: block;
    padding-right: 10px;
    padding-left: 20px;
    text-indent: -22px;
    font-size: 14px;
    font-weight: 500;
    margin-right: 10px;
}

.cornerstone-text {
    color: #000;
    font-size: 0.9em;
    font-weight: 500;
    line-height: 0.4;
}

.subtitle-updated {
    font-size: 15px;
    font-weight: 400;
    color: #777;
    margin-top: 5px;
    margin-bottom: 10px;
}

#right-links {
    text-align: right;
    margin-right: 15px;
}

#right-links a {
    color: #0056b3;
    font-weight: 500;
}

#right-links a:hover {
    text-decoration: underline;
}

#about-link {
    font-size: 0.8em;
    font-weight: 1000;
}

