#detailedModal, #downloadModal{
    width:100%;
    height: 100%;
    z-index: 2000;
    background-color: rgba(0,0,0,0.5);
    position: absolute;
    top:0;
    left:0;
    display: none;
    /* border-radius: 10px; */ /* this is applied to content div*/
    align-items: center; 
    justify-content: center;
}

#isDownloadingModal{
    width:100%;
    height: 100%;
    z-index: 3000;
    background-color: rgba(0,0,0,0.5);
    position: absolute;
    top:0;
    left:0;
    display: none;    
    align-items: center; 
    justify-content: center;
}
#downloadMessage{
    position: absolute;
    z-index: 8501;
    color:white;
    font-size: 1.5rem;
    font-weight: bold;
    width:100%;
    text-align: center;
    top:44%;
}


#downloadModalContent{
  z-index: 2500;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  max-height: 95%;
  background-color: var(--light-beige-color);
  padding: .5rem;
  text-align: center;
  /* border-radius: 10px; */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}


#downloadSpeciesList{
    text-align: left;
    margin: 0 1.4rem; /* to indent the list of check boxes */
    font-size: .75rem;
    /* flex-shrink: 1; */
    overflow-y:auto;
    max-height: 500px; /* hard coded, fix later if possible */
    max-height: 65vh; /* hard coded, fix later if possible */
    margin-bottom:1rem;
}

/* Single-herd layout styles */
.singleHerdHeader {
    font-size: 0.95rem;
    font-weight: 600;
    color: #444;
    margin: 0.4rem 0 0.6rem 0;
}

.singleHerdCard {
    border: 2px solid var(--lighter-accent-color);
    background-color: var(--lighter-accent-color);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    width: 60%;
    margin: 0.5rem auto;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.singleHerdName {
    font-size: 1.05rem;
    font-weight: 500;
    color: white;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35); 
}

.singleHerdImage {
    width: 200px;
    height: auto;
    object-fit: contain;
    margin-bottom: 0.4rem;
}

.downloadMessage {
  font-size: 0.8rem; 
  margin-bottom: 0.2em;
  margin-top: 0.5em;
  line-height: 1.3;
  /* background-color: rgba(255, 244, 205, 0.7); */ /*pale yellow*/
  background-color: #d9e6ec;
  padding: 0.6em 0.8em;
  border-radius: 7px 15px 15px 7px;
  border-left: 3px solid var(--accent-color);
  width: 99%;
}

#herdDownloadList{
    margin-left: 0.5em;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-weight: 100;
}

.modalDownloadButton{
    width: 50%;
    font-size: 1.2rem;
}

#modalDownloadButton.disabled {
  background-color: transparent !important;
  border: 2px solid var(--lighter-accent-color);
  color: var(--lighter-accent-color);
  cursor: not-allowed;
}

#detailedModalContent{
    width:80%; /*also adjust left when updating*/
    max-width:98%;
    height: auto;
/*        padding: 1rem;*/
    background-color: var(--light-beige-color);
    position: absolute;
    z-index: 2500;
    /* top:1rem; */
    left:10%; /*adjust rem with width*/
    text-align: center;
    top: 10rem;        
    /* border-radius: 10px; */
}
.tabContent{
    margin:1rem 1rem 1rem 1rem;
    /* font-size: 1.1rem; */
    text-align: left !important;
    /* border-radius: 10px; */
    padding: 1rem;
    line-height: 1.5rem;
}
.hiddenTabContent, .hiddenModalTab{
    display: none;
}
#reportButtonModal,
#methodButtonModal, 
#aboutButtonModal,
#gisButtonModal{
    margin-top: 2rem !important;
    margin-bottom: 2rem !important;
    width: 20rem;
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
}
.boldModalHeading{
    /* font-weight: bold; */
    font-size: 1.4rem;
    padding: 0rem 0rem 1rem 0rem;
    color: #505050;
    margin-bottom: 0;
    margin-top:0;
}
.modalSourceItem{
    padding-bottom: 0.6rem!important;
    font-size: 1em;
    padding-left: 1em;
    text-indent:-1em;
    margin-top:0;
    margin-bottom: 0;
}
.modalParagraph{
	margin-top:0.1rem;
}
.modalHyperlink{
    color: var(--accent-color);
    font-size: 11pt;
    text-decoration: underline;
}
#tabsHolder {
    display: flex;
    flex-direction: row;
    width: 100%;
    text-align: center;
    background-color: var(--lighter-accent-color);
     text-transform: uppercase;
    /* background:
    url(../img/folder_tabs/modal_blank.png);
    background-repeat: repeat;
    background-size: auto;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    border-radius: 10px; */
}
.modalTab{
    /* width:calc(30.2%); */
    color:var(--light-beige-color);
    flex:1;
    font-size: 1.3rem;
    font-weight: 300;
    text-align:center;
    padding: 0.75rem;
    /* padding-bottom:1.2rem; */
    display: flex;
    cursor:pointer;
    user-select: none;
    /* border-radius: 10px; */
    
}  
/* Add border only to the first two tabs */
.modalTab:nth-child(-n+2) {
    border-right: 1px solid var(--light-beige-color);
}

.leftTabText {
    margin: auto;
}

.rightTabText {
    margin: auto;
}

.centerTabText{
    margin: auto;
}

.left{
    /* border-radius: 10px 0px 0px 0px; */
    order: 0;
}

.center{
    order:1;
}

.right{
    /* border-radius: 0px 10px 0px 0px; */
    order: 2;
}

.selectedTabCenter,.selectedTabLeft, .selectedTabRight {
    background-color: var(--light-beige-color);
    color: var(--accent-color);
    font-weight: 500;
}

/*
.selectedTabLeft{
    /* background-color:var(--light-beige-color); 
    /* background: url(../img/folder_tabs/modal_left.png); 
	/* background-repeat: no-repeat; */
	/* background-size:100% 100%;
    image-rendering: crisp-edges;
    image-rendering: -moz-crisp-edges;          /* Firefox 
    image-rendering: -o-crisp-edges;            /* Opera 
    image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming)
    -ms-interpolation-mode: nearest-neighbor;   IE (non-standard property) 
}
/*if the LEFT tab is selected, 
put a light line right of the left tab. It's location is the same as the 2 modalTab's width + padding*/
/*  this is rather brute force and needs redesign. See GIUM method */
/* .selectedTabLeft::before {
	content: '';
	margin-left: calc(60.4% + 3rem);
	position: absolute;
	width: 0px;
	height: calc(3.5rem + 2.5px);
	border-left: 1.5px solid var(--light-beige-color);
	top: 0;
    pointer-events: none;
}    

.selectedTabRight {
    /* background-color: var(--light-beige-color); 
    /* background: url(../img/folder_tabs/modal_right.png);
	background-repeat: no-repeat;
	background-size:100% 100%;
    image-rendering: crisp-edges;
    image-rendering: -moz-crisp-edges;          /* Firefox 
    image-rendering: -o-crisp-edges;            /* Opera 
    image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming)
    -ms-interpolation-mode: nearest-neighbor;   IE (non-standard property) 
}
/*if the RIGHT tab is selected, 
put dark grey lines on either side of an element that has the width of a modalTab (plus padding). 
It's location is left of a modalTab's width + padding
/*  this is rather brute force and needs redesign. See GIUM method 
 /* .selectedTabRight::before {
	content: '';
	margin-left: calc(-30.2% - 3rem);
	position: absolute;
	width: 0px;
	height: calc(3.5rem + 2px);
	border-left: 1.5px solid var(--light-beige-color);
	top: 0;
    pointer-events: none;
}

.selectedTabCenter {
    /* background-color: var(--light-beige-color); 
    /* background: url(../img/folder_tabs/modal_center.png);
	background-repeat: no-repeat;
	background-size:100% 100%;
    image-rendering: crisp-edges;
    image-rendering: -moz-crisp-edges;          /* Firefox 
    image-rendering: -o-crisp-edges;            /* Opera 
    image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming)
    -ms-interpolation-mode: nearest-neighbor;   IE (non-standard property) 
}
*/

/*checkbox for download style */
input {
        appearance: none;
        position: relative;
        width: 0.8rem;
        height: 0.8rem;
        border: 0px solid;
        line-height: 1;
        background: #aaa;
      }

      input[type="checkbox"]::before {
        position: absolute;
        width: 100%;
        height: 100%;
        text-align: center;
        white-space: pre;
        content: " ";
      }
      
      input[type="checkbox"]:checked::before {
        content: "\2713";
        font-weight: 700;
        font-size: 1rem;
      }

.stateSection {
    margin-bottom: 1rem;
}

.herdStateTitle {
    font-size: 1.1rem;
    font-weight: bold;
    margin-top: 1em;
    color: #444;
    cursor: pointer;
    user-select: none;
}

.downloadMessage{
    line-height: initial;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6em 0.8em;
    border-radius: 7px 15px 15px 7px;
    border-left: 3px solid var(--accent-color);
    background-color: #d9e6ec;
    transition: all 0.3s ease;
}

@keyframes messageFlash {
    0% { 
        background-color: #d9e6ec;
        border-left-color: var(--accent-color);
        border-left-width: 3px;
    }
    50% { 
        background-color: #ffd966;
        border-left-color: #ff8c00;
    }
    100% { 
        background-color: #d9e6ec;
        border-left-color: var(--accent-color);
    }
}

.downloadMessage.flash {
    animation: messageFlash 0.6s ease-in-out 2;
}

.downloadMessageIcon{
    display: inline-flex;
    width: 34px;
    height: 34px;
    line-height: 34px;
    justify-content: center;
    align-items: center;
    font-size: 1.3rem;
    color: var(--brandText);
    font-weight: 700;
}

.downloadMessageIconHolder{
    width: 25px; 
    display: flex;
    align-items: center; 
    justify-content: center; 
    background: transparent; 
    flex-shrink: 0;
}

.downloadMessageText{
    flex: 1 1 auto; /* take remaining space */
}

.herdItemWrapper {
    line-height: 1.5em;
}

#downloadModalText h2 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 0.5em;
    color: #444;
    text-align: center;
}

#downloadModalText h3 {
    font-size: 1rem;
    margin-bottom: 0.2em;
    color: #444;
    text-align: center;
}

.stateTitleText {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.stateCollapseArrow {
    cursor: pointer;
    /* transition: transform 0.3s ease; */
    font-size: 0.9rem;
    color: #666;
}

.stateCollapseArrow:hover {
    color: #333;
}

.herdDownloadStateContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 0.5em;
    overflow: hidden;
    /* transition: max-height 0.5s ease-in-out, opacity 0.2s ease-in-out; */
    max-height: 1500px; 
    opacity: 1;
}

.herdDownloadStateContainer.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    margin-top: 0;
    margin-bottom: 0;
}

/* for hiding download message when state collapsed */
.stateSection:has(.herdDownloadStateContainer.collapsed) .downloadMessage {
    max-height: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden;
    /* transition: max-height 0.5s ease-in-out, opacity 0.2s ease-in-out; */
}

/* Exception for Idaho download messages - they should always stay visible */
.stateSection:has(.herdDownloadStateContainer.collapsed) .downloadMessage.idahoAlwaysVisible {
    max-height: none !important;
    opacity: 1 !important;
    margin-bottom: 0.2em !important;
    margin-top: 0.5em !important;
    padding: 0.6em 0.8em !important;
    border-left: 3px solid var(--accent-color) !important;
    border-radius: 7px 15px 15px 7px !important;
    background-color: #d9e6ec !important;
    overflow: visible !important;
}

.stateSection:has(.herdDownloadStateContainer.collapsed) .herdItemWrapper.specialStateHerd {
    max-height: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden;
    /* transition: max-height 0.5s ease-in-out, opacity 0.2s ease-in-out; */
}

.stateSection:has(.herdDownloadStateContainer.collapsed) {
    margin-bottom: 0 !important;
}

/* .stateSection:has(.herdDownloadStateContainer.collapsed) .selectAllButton {
    max-height: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, opacity 0.2s ease-in-out;
} */

.herdCheckboxWrapper {
    width: calc(50% - 0.5em);
    display: flex;
    align-items: center;
    padding: 0.1em;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid var(--lighter-accent-color)
}

.herdCheckboxWrapper input[type="checkbox"] {
    display: none;
}

.herdCheckboxWrapper label {
    flex-grow: 1;
    cursor: pointer;
    padding: 0 0.2em 0 2em;
    position: relative;
    font-size: 0.85rem;
}

.herdCheckboxWrapper label::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.15em;
    width: 1em;
    height: 1em;
    /* border: 2px solid #888; */
    border: 2px solid var(--lighter-accent-color);
    border-radius: 3px;
    background-color: var(--light-beige-color);
    padding: 6px;
    left: 6px;
    top: 4px;
}

.herdCheckboxWrapper input[type="checkbox"]:checked + label::before {
    content: "✓";
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border-color: transparent;
    color: black;
    font-weight: bold;
    left: 6px;
    top: 4px;
    line-height: normal;
}

.herdCheckboxWrapper:has(input[type="checkbox"]:checked) {
    background-color: var(--lighter-accent-color, #e6f7ea);
    border-color: var(--lighter-accent-color, #e6f7ea);
    color: white;
}

.herdCheckbox {
    cursor: pointer;
}

.selectAllButton, .copyButton {
    background-color: transparent;
    color: black;
    border: none;
    padding: 0.3em 1em 0.3em 0.5em;
    margin: 0.2em 0 0.1em 0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    /* transition: all 0.2s ease; */
}

.selectAllButton:hover, .copyButton:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Cursor style for disabled items */
.not-allowed-cursor,
.not-allowed-cursor input,
.not-allowed-cursor label {
    cursor: not-allowed !important;
}

@media (max-width: 600px) {
    .herdCheckboxWrapper {
        width: 100%;
    }
    
    .selectAllButton, .copyButton {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
        margin: 0.2rem 0.3rem 0.2rem 0;
    }

    .downloadMessage{
        flex-direction: row;
    }
    .downloadMessageIconHolder{
        width: 38px;
    }
}

/* Herd Modal Specific Styles - scoped to avoid affecting other modals */
/* .herd-modal-content {
    Container for the three-column layout
} */

.herd-modal-column {
    flex: 1; 
    min-width: 300px;
}

.herd-modal-content .boldModalHeading {
    color: #333 !important;
     color: var(--accent-color) !important;
    font-weight: 500;
    margin-bottom: 0.25rem;
    margin-top: 0;
}

.herd-modal-content .modalParagraph {
    line-height: 1.3;
    margin-bottom: 1rem;
    margin-top: 0.1rem;
    color: #666;
}

.herd-modal-content .modalParagraph strong {
    color: #555;
}

.herd-modal-definitions ul {
    margin: 0;
    padding-left: 0;
    line-height: 1.3;
}

.herd-modal-definitions li {
    margin-bottom: 0.4rem;
    line-height: 1.3;
    list-style-position: outside;
    margin-left: 0;
}

.herd-modal-definitions li::marker {
    color: #666;
}

.herd-modal-content .useBox {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 8px;
    vertical-align: baseline;
    position: relative;
    top: 1px;
}

/* additional styles for Utah/Colorado special state handling */

/* special state herd items (UT/CO) */
.herdItemWrapper {
    width: calc(50% - 0.5em);
    display: flex;
    align-items: center;
    padding: 0.3em 0.8em;
    border-radius: 6px;
    border: 2px solid var(--lighter-accent-color); 
    background-color: white;
    /* margin: 0.1em 0; */
}

.specialStateHerd {
    cursor: default;
    /* transition: all 0.2s ease; */
}

.specialStateHerd .herdName {
    flex-grow: 1;
    font-size: 0.85rem;
    color: #333;
}

/* selected state for special herds */
.specialStateHerd.selected {
    background-color: var(--lighter-accent-color);
    border-color: var(--lighter-accent-color);
    color: white;
}

.specialStateHerd.selected .herdName {
    color: white;
    font-weight: 500;
}

.undownloadableHerd {
    cursor: default;
    /* opacity: 0.6; */
    /* transition: all 0.2s ease; */
}

.undownloadableHerd .herdName {
    flex-grow: 1;
    font-size: 0.85rem;
    /* color: #666; */
    /* font-style: italic; */
}

@media (max-width: 600px) {
    .herdItemWrapper {
        width: 100%;
    }
}