/* Reusable UI components (cards, popups, widgets) */

.center-button {
    text-align: center;
    margin-top: 1rem;
}

.submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--page-foreground);
    min-width: 120px;
    position: relative;
}

.submit-btn .button-text {
    display: inline-block;
}

.submit-btn .button-spinner {
    display: none;
}

.submit-btn.buttonformat {
    padding: 0.5rem 1rem;
    min-width: 120px;
    text-align: center;
}

.submit-btn.buttonformat .button-text {
    width: 100%;
    text-align: center;
}

.submit-btn.buttonformat .button-spinner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.spinner {
    border: 4px solid var(--page-background);
    border-left-color: var(--page-foreground);
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    margin-left: 0.5rem;
    animation: spin 1s linear infinite;
    display: none;
    vertical-align: middle;
}

button.loading {
    position: relative;
}

button.loading .spinner {
    display: inline-block;
    margin-left: 0.5rem;
    vertical-align: middle;
}

button.submitting .spinner {
    display: inline-block;
    margin-left: 0.5rem;
    vertical-align: middle;
}


/* Button states and variants from base.css */
.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background-color: var(--alt-background);
    color: var(--alt-foreground);
}

.btn-primary:hover { opacity: .5; }

.btn-secondary {
    margin-top: 0.5rem;
    align-self: flex-start;
    background-color: var(--alt-background);
    color: var(--alt-foreground);
    border-radius: 4px;
}

.btn-secondary:hover { background-color: var(--alt-background-hover); }

.btn-danger {
    background-color: var(--danger-color);
}

/* Other Components */

.colorcell {
    background-color: var(--alt-background);
    color: var(--alt-foreground);
    border: 1px solid var(--page-foreground);
    border-radius: 5px;
    box-shadow: 8px 8px 5px var(--shadow-color);
    padding: 12px;
    margin-bottom: 12px;
}

.colorcell > label,
.colorcell th {
    color: var(--alt-foreground);
}

.widget-controls button {
    margin: 5px 2px;
    padding: 5px 10px;
}

.drilldown-search-selects {
    width: 95%;
    margin: auto;
}

button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.threedcell {
    margin: 2em .5em;
    border: 1px solid var(--page-foreground);
}

/* Filter Controls / Distinct Select Widget */
.distinct-select-widget-frame {
    padding: 1em;
    margin: auto;
    min-width: 610px;
}

.select-container-wrapper {
    display: flex;
    align-items: flex-start;
    padding-top: 1em;
    justify-content: space-between;
}

.distinct-select-widget { flex-direction: column; }

.filter-controls-wrapper {
    font-size: 150%;
    font-weight: bold;
}

.filter-name {
    width: 80%;
    margin: auto;
    display:none;
}

.filter-name input[type="text"] {
    width: 400px;
}

.filter-controls {
    display: flex;
    justify-content: space-between;
}

.filter-controls label {
    word-wrap: break-word;
    color: var(--page-foreground);
}

/* Keyword Search Results */
.kws_results {
    background-color: var(--page-background);
    padding: 0 2rem;
    margin: auto;
}

#kws_results h3 { margin-bottom: 4px; }

#kws_results ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
}

/* Link Options */
.link_options {
    margin-top: 2px;
    margin-bottom: 2px;
}

.link_options a {
    margin-left: 15px;
    font-weight: bold;
}

/* Comment Results */
.comment_results {
    margin-left: 20px;
    font-size: 16px;
    padding: 8px 12px;
    font-weight: normal;
    background-color: var(--alt-row-background);
    border-left: 3px solid var(--alt-background);
    margin-bottom: 8px;
    border-radius: 0 4px 4px 0;
}

/* Quick Search */
.quicksearch-outer {
    width: 100%;
    padding: 1em;
}

.quicksearch-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Search Result Links */
.search_result_links { padding: 8px; }

.search_result_links img {
    vertical-align: middle;
    width: 24px;
    height: 24px;
}

.search_result_links a { margin-left: 8px; }

/* Map Popup */
#map_popup {
    display: none;
    border: 1px solid var(--alt-row-foreground);
    background-color: var(--page-background);
    color: var(--page-foreground);
    position: fixed;
    z-index: 2;
    border-radius: 5px;
}

#map_popup_close {
    font-size: 14px;
    line-height: 14px;
    right: 6px;
    top: 4px;
    position: absolute;
    font-weight: 700;
    display: block;
}

/* Background Popup Overlay */
#background_popup {
    display: none;
    position: fixed;
    height: 100%;
    width: 100%;
    left: 0;
    top: 0;
    background: var(--overlay-background);
    border: 1px solid var(--alt-row-background);
    z-index:1;
}

/* User Select */
.users-select {
    height: 350px;
}

/* Instructions Box */
#instructions { padding: 8px; width: 80%; }

#instructions p {
    margin-bottom: 0px;
    padding-bottom: 3px;
}

/* Callout */
.callout {
  width: fit-content;
  margin: 0 auto;
  text-align: left;
}

.search-row {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

/* Chat Widget Styles */
.clear-chat-link {
    display: block;
    width: fit-content;
    margin: 5px auto 10px auto;
    padding: 3px 12px;
    font-size: 0.8em;
    color: var(--page-foreground);
    background-color: var(--alt-row-background);
    border: 1px solid var(--table-border-color, #ddd);
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.2;
}

.clear-chat-link:hover {
    background-color: var(--alt-row-background);
    color: var(--page-foreground);
    text-decoration: none;
}

/* --- Progress Bar Styles --- */
.progress-bar-container {
    width: 80%;
    height: 10px;
    background-color: var(--page-background);
    border-radius: 5px;
    margin: 15px auto;
    overflow: hidden;
    border: 1px solid var(--page-foreground);
}

.progress-bar-indeterminate {
    width: 100%;
    height: 100%;
    background-color: var(--alt-foreground);
    border-radius: 5px;
    animation: indeterminate-progress 2s linear infinite;
    transform-origin: left center;
}

@keyframes indeterminate-progress {
    0% { transform: translateX(-100%) scaleX(0.5); }
    50% { transform: translateX(0%) scaleX(0.5); }
    100% { transform: translateX(100%) scaleX(0.5); }
}

/* --- Modal Styles --- */
.modal-spinner {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 40px;
    margin: 10px auto;
}

.modal-spinner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--alt-foreground);
    border-radius: 50%;
    animation: pulse-opacity 1.5s ease-in-out infinite alternate;
    box-sizing: border-box;
}

@keyframes pulse-opacity {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* --- Loadie Modal Core Styles --- */
#loadie-overlay, #loadie-content {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
    position: fixed;
    z-index: 9999;
    display: block;
}

#loadie-overlay.visible, #loadie-content.visible {
    opacity: 1;
    visibility: visible;
}

#loadie-content {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 300px;
    padding: 20px;
    background: var(--alt-background);
    color: var(--outer-foreground) !important;
    box-shadow: 0 0 20px var(--shadow-color-dark);
    border-radius: 8px;
    outline: 2px solid var(--alt-foreground);
    text-align: center;
}

#loading-message {
    color: var(--alt-foreground) !important;
}

#cancel-search-btn {
    color: var(--alt-foreground) !important;
    background-color: var(--alt-background);
    border-color: var(--alt-foreground);
}

#loadie-overlay {
    background-color: var(--overlay-background);
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Geographic Area Size Indicators (EWS Page) */
.geo-indicator {
  display: inline-block;
  border: 1px solid currentColor;
  margin-right: 4px;
  vertical-align: middle;
  background-color: transparent;
}

.geo-indicator.small {
  width: 6px;
  height: 6px;
}

.geo-indicator.medium {
  width: 9px;
  height: 9px;
}

.geo-indicator.large {
  width: 12px;
  height: 12px;
}

/* EWS Profile List */
.profile-name {
    font-size: 1.2em;
    vertical-align: middle;
}