* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    color: #000;
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    overflow: auto;
}

h1,
h2,
h3 {
    font-family: Arial, Helvetica, sans-serif;
}

h1 {
    margin: 0;
}

p {
    margin: 0;
    font-size: 12pt;
}

a {
    color: black;
    text-decoration: none;
}

a:visited {
    color: black;
}

a:hover {
    text-decoration: underline;
}

a:active {
    color: black;
}

/* ---------------------------------------------------------
   Layout
   --------------------------------------------------------- */

.wrapper {
}

.outerbox {
    margin: 12pt;
    width: calc(100% - 24pt);
    height: calc(100vh - 24pt);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: relative;
}

.header-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.46);
    width: fit-content;
}

.header-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}


.header-top {
  font-weight: bold;
}

.header-bottom {
  gap: 18px;
}

.hometitle,
.hometitles {
  background: none;
  display: inline-block;
  padding: 0;
  margin: 0;
  font-family: Arial, sans-serif;
  letter-spacing: 1px;
}

.hometitle {
  font-size: 17px;
  font-weight: bold;
}

.hometitles {
  font-size: 13px;
  color: rgb(77,77,77);
}

.hometitle a, .hometitles a {
    pointer-events: auto;
}

.hometitles a:hover {
    color: rgb(52, 52, 52);
}

.title-block {
    text-align: left;
    margin-bottom: 5px;
    line-height: 1.45;
}

.title-block .project-title {
    font-size: 12px;
}

.model-description {
    color: #333;
    background: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
    display: block;
    z-index: 550;
}

.model-frame {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

#model-container {
    width: 65%;
    height: 600px;
    background: #fff;
    border: 1px solid #ccc;
    overflow: hidden;
    position: relative;
}

.nysmodel-container {
    width: 100%;
    height: calc(100% - 80px);
    position: relative;
    overflow: hidden;
}

#azcratermodel-container {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

.side-panel {
    width: 35%;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hint {
    text-align: center;
    color: #777;
    margin-top: 10px;
}

/* ---------------------------------------------------------
   Loading Overlay
   --------------------------------------------------------- */

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#loading-progress {
    width: 200px;
    height: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 10px;
}

#loading-bar {
    width: 0;
    height: 100%;
    background-color: #005892;
    transition: width 0.5s ease;
}

#loading-message {
    text-align: left;
    color: #555;
    font-size: 12px;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: normal;
}

#loading-details {
    font-size: 11px;
    color: #666;
    margin-top: 6px;
}

/* ---------------------------------------------------------
   Controls (zoom / pan / rotate / view)
   --------------------------------------------------------- */

button {
    color: #333;
    height: 25px;
    width: 25px;
    font-size: 14px;
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: none;
    background-color: rgb(160 160 160 / 70%);
}

button:hover {
    background: rgba(199, 199, 199, 0.9);
}

button.active {
    background-color: #0078ff;
    color: white;
}

#controls-container {
    display: flex;
    flex-direction: column;
    z-index: 100;
    top: 0px;
    left: 0px;
    background: rgba(255, 255, 255, 0.8);
}

#azcratercontrols-container {
    display: flex;
    flex-direction: column;
    padding: 5px;
    background: #80808070;
    z-index: 10;
    box-sizing: border-box;
}

.controls-group,
.azcratercontrols-group {
    padding: 0;
    width: 100%;
    border-radius: 8px;
}

.group-label,
.azcratergroup-label {
    display: none;
    color: #040404;
    font-size: 12px;
    margin-bottom: 5px;
    text-transform: uppercase;
    opacity: 0.8;
    background-color: #ffffff85;
}

.controls-grid,
.azcratercontrols-grid {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 0;
    width: 100%;
}

.controls-row {
    display: flex;
    width: 100%;
}

.azcratercontrols-row {
    display: flex;
    gap: 2px;
}

.control-section,
.azcratercontrol-section {
    flex: 1;
    width: 100%;
}

.control-buttons-group {
    display: flex;
    flex-direction: column;
    /* gap: 6px; */
    /* padding: 12px 15px; */
    background: #fff;
    margin-bottom: 5px;
    width: 100%;
    box-sizing: border-box;
}

.control-buttons-group button {
    cursor: pointer;
    text-align: center;
    background: rgb(147 144 144 / 80%);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.control-buttons-group button:hover {
    background: rgba(230, 230, 230, 0.9);
}

/* ---------------------------------------------------------
   Layer Buttons
   --------------------------------------------------------- */

.layer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.layer-btn {
    font-family: Arial, Helvetica, sans-serif;
    /* font-size: 10pt; */
    width: auto;
    margin: 0px;
    padding: 10px;
    background: #444;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
}

.layer-btn:hover {
    background: #222;
}

.layer-btn-active {
    background: #1a6d3f;
    border-color: #145530;
}

.layer-btn-active:hover {
    background: #145530;
}

.layer-buttons-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 5px;
    background: #c0c0c0;
    width: 100%;
}

#controls-container .layer-button {
    width: 100%;
    height: auto;
    padding: 8px;
    font-size: 12px;
    color: #000;
    font-weight: bold;
    background: rgba(255,255,255,0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    white-space: normal;
    display: block;
    margin: 0;
    box-sizing: border-box;
    border: none;
}

#controls-container .layer-button:hover {
    background: rgba(230,230,230,0.9);
}

#controls-container .layer-button.active {
    background: #747474;
    color: white;
}

#controls-container .layer-button[data-layer="satellite"] {
    background: #daa805;
}
/* ---------------------------------------------------------
   Legend
   --------------------------------------------------------- */

.legend {
    padding: 12px 15px;
    background: #fff;
    border: 1px solid #ccc;
}

.legend h3 {
    margin: 0 0 4px;
    font-size: 13px;
}

.legend-scale {
    display: flex;
    flex-direction: column-reverse;
    gap: 5px;
    font-size: 12px;
}

.legend-row {
    display: flex;
    align-items: center;
    font-size: 10pt;
}

.legend-swatch {
    width: 28px;
    height: 18px;
    margin-right: 10px;
    border: 1px solid rgba(0,0,0,.15);
    flex-shrink: 0;
}

/* ---------------------------------------------------------
   North Arrow
   --------------------------------------------------------- */

#north-arrow {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

/* ---------------------------------------------------------
   Scale Bar
   --------------------------------------------------------- */

#scale-bar-container {
    position: absolute;
    left: 10px;
    bottom: 10px;
    background: rgba(255,255,255,.85);
    border: 1px solid #999;
    border-radius: 4px;
    padding: 6px 10px;
    min-width: 90px;
    color: #222;
    font-size: 9pt;
    pointer-events: none;
    z-index: 5;
}

#scale-ratio-text {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
}

#scale-bar-line {
    height: 4px;
    margin-bottom: 3px;
    background: #222;
    border-left: 1px solid #222;
    border-right: 1px solid #222;
    transition: width .1s linear;
}

#scale-bar-label {
    display: block;
    text-align: center;
}

/* ---------------------------------------------------------
   Mobile Layout
   --------------------------------------------------------- */

@media (max-width: 430px) {

    .outerbox {
        width: calc(100% - 16px);
        height: auto;
        margin: 8px;
    }


     .header-container {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        overflow: hidden;
    }


    /* first row */
    .header-row {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        width: 100%;
        white-space: nowrap;
    }


    /* second row underneath */
    .header-bottom {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        width: 100%;
        white-space: nowrap;
    }


    .hometitle {
        font-size: 15px;
        white-space: nowrap;
    }


    .hometitles {
        font-size: 12px;
        white-space: nowrap;
    }


    /* Stack model above side panel */
    .model-frame {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }


    /* Full width model frame */
    #model-container {
        width: 100%;
        height: 65vh;
        border: 1px solid #ccc;
    }


    /* Side panel below model */
    .side-panel {
        width: 100%;
        max-width: none;
        height: auto;
    }


    /* Smaller controls */
    #controls-container {
        width: 100%;
    }


    .layer-buttons-group {
        flex-direction: row;
        flex-wrap: wrap;
    }


    #controls-container .layer-button {
        width: auto;
        flex: 1;
        min-width: 90px;
        text-align: center;
        white-space: nowrap;
    }


    /* Smaller legend */
    .legend {
        padding: 8px;
    }

    .legend-row {
        font-size: 11px;
    }

    .legend-swatch {
        width: 22px;
        height: 14px;
    }

}