/**
 * Main CSS file for Declines in Opioid-Related Deaths
 * Custom styles for the product
 */

/* Product-specific styles */

.linkUnderline{
    text-decoration: none!important;
}

/* Visualization containers */
.visualization-container {
    margin: 20px 0;
    padding: 15px;
}

/* Tooltip styling */
div.tooltip {
    background-color: white;
    color: black;
    border: 1px solid black;
    border-radius: 5px;
    padding: 10px;
    position: fixed;
    max-width: 200px;
}

.legend text {
    font-size: 13px !important;
}

.n text {
    font-size: 13px !important;
}

/* Figure 1 styling */
.fig1-legend-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 2px;
    flex-wrap: wrap;
}

#fig1-legendContainer {
    display: inline-block !important;
}
#fig1-legendContainer li {
    display: inline-block !important;
    min-width: fit-content !important;
    vertical-align: top !important;
}
#fig1-legendContainer li:first-child {
    min-width: fit-content !important;
    margin-right: 15px !important;
}
#fig1-legendContainer li:first-child .listDiv {
    grid-template-columns: 30px auto !important;
    min-width: fit-content !important;
    display: grid !important;
}
#fig1-legendContainer li:first-child svg {
    width: 30px !important;
    min-width: 30px !important;
    display: block !important;
    flex-shrink: 0 !important;
    overflow: visible !important;
}
#fig1-legendContainer li:first-child svg line {
    stroke-width: 4px !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#fig1-legendContainer2 {
    display: inline-block !important;
}
#fig1-legendContainer2 li {
    display: inline-block !important;
}
#fig1-legendContainer2 span {
    font-size: 16px !important;
}

/* Figure 3 styling */
#fig3-container g.c g.tick text {
    transform: rotate(-35deg) translate(-5px, -3px) !important;
    text-anchor: end !important;
    font-size: 12px !important;
    /* Added width for better wrapping on rotated labels in some browsers */
    white-space: pre;
}

/* Hide every 2nd tick in fig3-container */
#fig3-container g.c g.tick:nth-of-type(2n) text{
    display: none !important;
}

#fig3-legendContainer {
    list-style: none;
    text-align: left;
    padding: 0px;
    text-wrap: unset!important;
}

/* Figure 4 styling */
#fig4-container g.c g.tick text {
    transform: rotate(-35deg) translate(-5px, -3px) !important;
    text-anchor: end !important;
    font-size: 12px !important;
    /* Added width for better wrapping on rotated labels in some browsers */
    white-space: pre;
}

/* Hide every 2nd tick in fig4-container */
#fig4-container g.c g.tick:nth-of-type(2n) text{
    display: none !important;
}

/* Hide x-axis tick text for BC, Ontario, and Saskatchewan in figure 9 */
#fig9-container-1 g.c g.tick text,
#fig9-container-2 g.c g.tick text,
#fig9-container-3 g.c g.tick text {
    display: none !important;
}

/* Figure 5 styling */
#fig5-container g.c0 g.tick text {
    font-size: 12px !important;
    /* Added width for better wrapping on rotated labels in some browsers */
    white-space: pre;
}

/* Figure 6 styling */

#fig6-container .axes .tick text {
    font-size: 12px !important;
}

/* Figure 7 styling */
#fig7-container .legend-text {
    font-size: 18px !important;
}

#fig7-container .axes text:not(.x-axis-title, .y-axis-title) {
    font-size: 16px !important;
}

#fig7-container .x-axis-title {
    font-size: 24px !important;
}

#fig7-container .y-axis-title {
    font-size: 24px !important;
}

/* Figure 8 styling */
#fig8-container g.c g.tick text {
    transform: rotate(-35deg) translate(-5px, -3px) !important;
    text-anchor: end !important;
    font-size: 12px !important;
    /* Added width for better wrapping on rotated labels in some browsers */
    white-space: pre;
}

/* Hide every nth tick in fig8-container - change the number before 'n' to hide every nth tick */
/* Examples: 2n = every 2nd, 3n = every 3rd, 4n = every 4th, etc. */
#fig8-container g.c g.tick:nth-of-type(2n) text {
    display: none !important;
}

/* Figure 9 styling */
/* Hide x-axis tick text for BC, Ontario, and Saskatchewan in figure 9 */
#fig9-container-1 g.c0 g.tick:nth-of-type(4n+2) text,
#fig9-container-1 g.c0 g.tick:nth-of-type(4n+3) text,
#fig9-container-1 g.c0 g.tick:nth-of-type(4n+4) text,
#fig9-container-2 g.c0 g.tick:nth-of-type(4n+2) text,
#fig9-container-2 g.c0 g.tick:nth-of-type(4n+3) text,
#fig9-container-2 g.c0 g.tick:nth-of-type(4n+4) text,
#fig9-container-3 g.c0 g.tick:nth-of-type(4n+2) text,
#fig9-container-3 g.c0 g.tick:nth-of-type(4n+3) text,
#fig9-container-3 g.c0 g.tick:nth-of-type(4n+4) text {
    display: none !important;
}

/* Data table styling */
table.dataTable thead .bg-primary {
    background-color: #26374A;
    color: white;
}
table.dataTable thead .sorting_asc, table.dataTable thead .sorting_desc {
    background-color: #26374A;
    color: white;
}
table.dataTable thead .sorting_asc {
    background-image: url(/src/img/sorting-icons/sort_asc.png)!important;
    padding-right: 15px;
}
table.dataTable thead .sorting_desc {
    background-image: url(/src/img/sorting-icons/sort_desc.png)!important;
    padding-right: 15px;
}
table.dataTable thead .sorting {
    background-image: url(/src/img/sorting-icons/sorting_both.png)!important;
    padding-right: 15px;
}
table.dataTable thead .sorting, table.dataTable thead .sorting_asc, table.dataTable thead .sorting_desc, table.dataTable thead .sorting_asc_disabled, table.dataTable thead .sorting_desc_disabled {
    cursor: pointer;
    background-repeat: no-repeat;
    background-position: center right;
}
table.dataTable thead .sorting-cnt {
    white-space: nowrap;
    display: none !important;
}

/* Factors tiles section styling */
#factors {
    margin-top: 2rem;
}

#factors > h2 {
    margin-bottom: 1rem;
}

#factors > p {
    margin-bottom: 2rem;
    font-size: 1.1em;
}
/* 
#factors h3 {
    font-size: 1.4em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
} */

/* Factor tile cards */
#factors .row {
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
}

#factors .row > [class*="col-"] {
    display: flex;
}

#factors .well.well-sm {
    background-color: #ffffff;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#factors .well.well-sm:hover {
    border-color: #26374A;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

#factors .well.well-sm:focus-within {
    border-color: #26374A;
    box-shadow: 0 0 0 3px rgba(38, 55, 74, 0.2);
    outline: none;
}

#factors .well.well-sm h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.2em;
    line-height: 1.4;
}

#factors .well.well-sm h4 a {
    color: #26374A;
    text-decoration: none;
    display: block;
    transition: color 0.2s ease;
    position: relative;
    padding-right: 1.5rem;
}

#factors .well.well-sm h4 a::after {
    content: '→';
    position: absolute;
    right: 0;
    opacity: 0.5;
    transition: all 0.2s ease;
    font-weight: normal;
}

#factors .well.well-sm h4 a:hover,
#factors .well.well-sm h4 a:focus {
    color: #1a2532;
    text-decoration: underline;
}

#factors .well.well-sm h4 a:hover::after,
#factors .well.well-sm h4 a:focus::after {
    opacity: 1;
    transform: translateX(3px);
}

#factors .well.well-sm p {
    color: #555;
    margin-bottom: 0;
    font-size: 0.95em;
    line-height: 1.6;
    flex-grow: 1;
}

/* Category badges */
.factor-category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.factor-category-badge.likely {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.factor-category-badge.possible {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.factor-category-badge.unlikely {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Add category accent bars to tiles */
#factors .factor-tile::before {
    content: '';
    display: block;
    height: 4px;
    border-radius: 8px 8px 0 0;
    margin: -1.5rem -1.5rem 1rem -1.5rem;
}

/* Likely factors - green accent */
#factors .factor-tiles[data-category="likely"] .factor-tile::before {
    background-color: #28a745;
}

/* Possible factors - yellow accent */
#factors .factor-tiles[data-category="possible"] .factor-tile::before {
    background-color: #ffc107;
}

/* Unlikely factors - red accent */
#factors .factor-tiles[data-category="unlikely"] .factor-tile::before {
    background-color: #dc3545;
}

/* Better spacing for factor sections */
#factors > h3 + .row {
    margin-top: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #factors .well.well-sm {
        padding: 1.25rem;
    }
    
    #factors .well.well-sm h4 {
        font-size: 1.1em;
    }
    
    #factors h3 {
        font-size: 1.25em;
    }
}

