/* 
  ==========
  GLOBAL PAGE STYLES
  ==========
  Fill the entire screen on large devices; no scrolling. 
  The .map-container will center its children.
*/
html,
body {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

/* 
  ==========
  MAP-CONTAINER
  ==========
  A flex container that expands to fill the full page size.
*/
.map-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

/* 
  ==========
  CONTENT CONTAINER
  ==========
  Holds the map and the foreground image (the frame graphic). 
  By default, it uses half the viewport width (50%).
*/
.content-container {
    position: relative;
    width: 50%;
    max-width: 50%;
    height: auto;
}

/* 
  ==========
  FOREGROUND IMAGE
  ==========
  The image that frames the map. 
  Pointer-events:none so it doesn’t interfere with map interaction.
*/
.foreground-image {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    transition: opacity 0.40s ease-in-out;
    opacity: 1;
}

/* 
  ==========
  MAP DIV (DEFAULT)
  ==========
  The position & size of the map for the default orientation/size.
  Absolutely positioned within .content-container.
*/
#viewDiv {
    position: absolute;
    top: 46.05%;
    left: 50%;
    width: 62.3%;
    height: 76.79%;
    transform: translate(-50%, -50%);
}

/* 
  ==========
  ZOOM-LEVEL OVERLAY
  ==========
  Shows the current zoom level, updated dynamically.
*/
.zoom-level {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 14px;
    display: none;
}

/* 
  ==========
  MAP TITLE
  ==========
  Displays the main map title on top of the foreground image.
  Position gets updated on size/orientation changes.
*/
.map-title {
    position: absolute;
    top: 86.6%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0);
    padding: 2px 2px;
    border-radius: 5px;
    font-size: 1.8vw;
    font-weight: bold;
    pointer-events: none;
}

/* 
  ==========
  MAP SUBTITLE
  ==========
  Secondary label, same absolute positioning approach as title.
*/
.map-subtitle {
    position: absolute;
    top: 89.4%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0);
    padding: 2px 2px;
    border-radius: 5px;
    font-size: 1.2vw;
    font-weight: bold;
    pointer-events: none;
}

/* 
  ==========
  COORDINATES LABEL
  ==========
  Displays current lat/lon at the bottom of the map, updated dynamically.
*/
.coordinates {
    position: absolute;
    top: 91.3%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0);
    padding: 2px 2px;
    border-radius: 5px;
    font-size: 0.55vw;
    pointer-events: none;
}

/* 
  ==========
  EXPORT BUTTON
  ==========
  A styled button for downloading the final map.
*/
.export-button {
    display: block;
    width: 100%;
    padding: 10px 20px;
    margin-top: 20px;
    background-color: #57758F;
    color: white;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.export-button:hover {
    background-color: #e2e2e2;
    color: rgb(0, 0, 0);
    font-size: 16px;
    font-weight: bold;
}

/* 
  ==========
  Add to Cart BUTTON
  ==========
  A styled button for adding the map to the cart.
*/
.add-to-cart-button {
    display: block;
    width: 100%;
    padding: 10px 20px;
    margin-top: 20px;
    background-color: #57758F;
    color: white;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    position: relative;
    /* For pseudo-element positioning */
    transition: background-color 0.3s ease, opacity 0.3s ease;
    /* Smooth transitions */
}

.add-to-cart-button:hover {
    background-color: #e2e2e2;
    color: rgb(0, 0, 0);
}

/* Add to Cart BUTTON loading state*/
.add-to-cart-button.loading {
    pointer-events: none;
    /* Disable clicks while loading */
    opacity: 0.8;
    /* position: relative; already set above */
}

.add-to-cart-button.loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-top-color: #fff;
    /* Make one part solid for spinner effect */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* --- ADD THESE NEW STATES --- */
.add-to-cart-button.success {
    /* background-color: #28a745; /* Green */
    color: white;
    pointer-events: none;
    /* Keep disabled briefly */
}

.add-to-cart-button.success::after {
    /* Hide spinner on success */
    display: none;
}

.add-to-cart-button.error {
    background-color: #dc3545;
    /* Red */
    color: white;
}

.add-to-cart-button.error::after {
    /* Hide spinner on error */
    display: none;
}

/* 
  ==========
  CUSTOMIZATION PANEL
  ==========
  An absolutely positioned panel on the right for larger screens.
  Contains user controls (search, orientation, size, basemap, etc.).
*/
/* ==========
  CUSTOMIZATION PANEL - ArcGIS Search Widget Override
  ========== */

/* Target the main container of the search widget */
.customization-panel .esri-search__container {
    flex: 1 0 100%;
    align-items: stretch;
    position: relative;
    background-color: #FCF7F1
}


.customization-panel {
    position: absolute;
    top: 50%;
    right: 5%;
    transform: translateY(-50%);
    width: 15%;
    min-width: 250px;
    background: #FCF7F1;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 4px 4px 16px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    border: 1px solid #b4b4b4;
}

/* 
  ==========
  CUSTOMIZATION PANEL TITLE
  ==========
  Main heading in the panel.
*/
.customization-panel-title {
    font-family: 'Barlow', sans-serif;
    letter-spacing: 1px;
    word-spacing: 4px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 50px;
}

/* 
  ==========
  INPUT FIELD STYLES (for map title, subtitle, etc.)
*/
.customization-panel input {
    margin-top: 10px;
    padding: 8px;
    font-size: 14px;
    border: 1px solid #b4b4b4;
    border-radius: 4px;
}

#mapTitleInput {
    width: 60%;
}

#mapSubtitleInput {
    width: 60%;
}

/* 
  ==========
  LABEL STYLES
*/
/* General styles for labels within the panel */
.customization-panel label {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    display: block;
    margin-top: 0px;
}

.customization-panel .search-label {
    margin-top: 0px; /* Example: First label might have no top margin */
}

/*
  ==========
  RESET VIEW BUTTON
  ==========
*/
.reset-view-button {
    display: block;
    width: 100%;
    padding: 5px 10px; /* Adjusted to match other small panel buttons */
    margin-top: 10px; /* Space above, after search input */
    margin-bottom: 25px; /* Space below before next section (Basemap) */
    background-color: #ffffff; /* Adjusted to match other small panel buttons */
    color: #333;
    font-size: 14px;
    font-weight: normal; /* Adjusted to match other small panel buttons */
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s, color 0.3s;
}

.reset-view-button:hover {
    background-color: #e2e2e2; /* Adjusted to match other small panel buttons hover */
    color: #000;
}


.customization-panel .basemap-label {
    margin-top: 30px; /* You already had this, adjust as needed */
}

/* 
  ==========
  BASEMAP SWATCHES
  ==========
  A row of small thumbnail images with labels.
*/
.basemap-swatches {
    margin-top: 10px;
    margin-bottom: 10px;
    display: flex;
    gap: 15px;
}

.swatch-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.basemap-swatch {
    width: 70px;
    height: auto;
    margin-bottom: 5px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 15px;
}

.basemap-swatch:hover {
    border-color: #999;
}

.swatch-label {
    font-size: 14px;
    text-align: center;
}

.hillshade-wrapper .hillshade-label { /* Note: .hillshade-label is inside .hillshade-wrapper */
    margin-top: 7px;    /* Example: If wrapper handles top margin */
    margin-bottom: 0; /* Override if it inherits panel-label margin */
    margin-left: 5px; /* Keep or adjust */
    /* Add any other specific styles for only the hillshade label */
}

.customization-panel .format-label {
    margin-top: 30px;
}

.customization-panel .orientation-label {
    margin-top: 0px; /* Your desired value */
}

.customization-panel .size-label {
    margin-top: 5px; /* Example: To reduce space above size buttons */
}

.customization-panel .map-title-input-label {
    margin-top: 30px; /* Your desired value */
}

.customization-panel .map-subtitle-label {
    margin-top: 15px; /* You already had this, adjust as needed */
}

/* 
  ==========
  MAP SIZE & ORIENTATION BUTTONS
  ==========
  Arranged in a flex row, letting user pick different sizes/orientations.
*/
.map-size-buttons,
.map-orientation-buttons,
.format-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.map-size-btn,
.map-orientation-btn,
.format-btn {
    cursor: pointer;
    padding: 5px 10px;
    font-size: 14px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: #ffffff;
    transition: background-color 0.3s, color 0.3s;
    /* Added for positioning the pseudo-element */
    position: relative;
    margin-bottom: 20px;
    /* Add space below for the price text */
}

.map-size-btn::after {
    display: block;
    /* Make it appear on its own line */
    position: absolute;
    bottom: -22px;
    /* Position below the button; adjust as needed */
    left: 0;
    right: 0;
    text-align: center;
    /* Center the price text */
    font-size: 1.00em;
    /* Smaller font for the price */
    color: #555;
    /* Price text color */
    font-weight: 600;
    /* Font Boldness */
    font-family: 'Barlow', sans-serif;
    /* Barlow Font Family */
}

.map-size-btn[data-size="12x16"]::after {
    content: "$ 39.99";
}

.map-size-btn[data-size="18x24"]::after {
    content: "$ 64.99";
}

.map-size-btn[data-size="24x36"]::after {
    content: "$ 84.99";
}

.map-size-btn[data-size="33.11x46.81 A0"]::after {
    content: "$ 99.99";
}

.map-size-btn[data-size="36x48"]::after {
    content: "$ 99.99";
}

/* --- CSS rule to show digital price when its format is active --- */
/* This rule will override the specific prices above when the .digital-pricing-active class is on the container */
.map-size-buttons.digital-pricing-active .map-size-btn::after {
    content: "$19.99";
}

/* Hover and Selected states for ALL buttons */
.map-size-btn:hover,
.map-orientation-btn:hover,
.format-btn:hover {
    background-color: #e2e2e2;
}

.map-size-btn.selected,
.map-orientation-btn.selected,
.format-btn.selected {
    background-color: #57758F;
    color: #fff;
    border-color: #57758F;
}

/* 
  ==========
  HILLSHADE CHECKBOX
  ==========
  Allows toggling terrain/hillshade on/off.
*/
.hillshade-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    white-space: nowrap;
    margin-top: 30px;
    margin-bottom: 30px;
}

.hillshade-checkbox {
    accent-color: #57758F;
    transform: scale(1.7);
    cursor: pointer;
    margin-right: 5px;
}

.hillshade-label {
    display: inline-block;
    margin: 10px;
    font-weight: bold;
    white-space: nowrap;
}

/* 
  ==========
  CUSTOM ATTRIBUTION
  ==========
  Replaces Esri's default attribution with a custom container + toggle.
*/
#pageAttribution {
    position: absolute;
    bottom: 10px;
    left: 0;
    z-index: 9999;
    pointer-events: auto;
}

#pageAttribution .esri-attribution__sources {
    display: inline-block;
    width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    background-color: rgba(255, 255, 255, 0.8);
    color: #929292;
    font-size: 10px;
    font-family: Arial, sans-serif;
    padding: 10px 0px 0px 8px;
    border-top-right-radius: 5px;
    vertical-align: middle;
}

#pageAttribution .esri-attribution__sources.expanded {
    width: auto;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
}

#pageAttribution .info-button {
    display: inline-block;
    margin-left: 10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    line-height: 15px;
    text-align: center;
    font-size: 16px;
    font-family: Arial, sans-serif;
    padding: 0px;
    background: #ccc;
    border: 1px solid #999;
    cursor: pointer;
    pointer-events: auto;
    vertical-align: middle;
}

#pageAttribution .info-button:hover {
    background: #bbb;
}

.esri-attribution__powered-by {
    text-align: right;
    white-space: nowrap;
    align-self: auto;
    padding: 0 5px;
    font-weight: 400;
}

.esri-attribution__powered-by a.esri-attribution__link {
    text-decoration: none;
    color: #0079c1;
    font-weight: bold;
}

/* 
  ==========
  RESPONSIVE DESIGN FOR SMALL SCREENS
  ==========
  Allow scrolling and reflow the layout under 1080px width.
*/
@media (max-width: 1080px) {

    html,
    body {
        height: auto;
        overflow-y: auto;
    }

    .map-container {
        height: auto;
        display: block;
    }

    .content-container {
        width: 100%;
        max-width: 100%;
    }

    #viewDiv {
        position: relative;
        top: 0;
        left: 0;
        transform: none;
        width: 100%;
        height: 60vh;
    }

    .customization-panel {
        position: static;
        transform: none;
        width: 50%;
        margin: 20px auto;
    }
    #pageAttribution {
        position: static;
        margin-top: 20px;
    }
    
    .map-title {
        font-size: 3.4vw; /* Or try something like 4vw for responsive scaling */
    }

    .map-subtitle {
        font-size: 2vw; /* Or try 3vw */
        /* Example: top: 88%; */
    }

    .coordinates {
        font-size: 1vw; /* Or try 2vw */
        /* Example: top: 90%; */
    }
}

/* Popup Warning Styles */
.popup-warning {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #FCF7F1;
    color: #57758F;
    padding: 20px 25px;
    border: 2px solid #57758F;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    font-size: 16px;
    text-align: center;
}

.popup-warning .close-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    cursor: pointer;
    font-size: 20px;
    color: #57758F;
}

/* Blur Overlay Styles */
.blur-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(5px);
    /* For Safari support */
    z-index: 9999;
}

/*
  ==========
  STYLES FOR MULTI-LINE SIZE BUTTONS
  ==========
*/
.map-size-btn {
  text-align: center; /* Ensures both lines of text are centered */
  line-height: 1.4;   /* Adds a little vertical space between the lines */
  padding-top: 8px;   /* Adds some extra space above the text */
  padding-bottom: 8px;/* Adds some extra space below the text */
}

/* ==================================
  ELEVATION RENDERER CONTROLS
  ==================================
*/

/* Container for a single control (label + input) */
.renderer-control {
  margin-bottom: 15px;
}

/* Style for the labels of the new controls */
.renderer-control label {
  display: block;
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 8px;
}

/* Styling for the new select dropdowns */
.renderer-control select {
  width: 100%;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #b4b4b4;
  background-color: #fff;
  font-size: 14px;
}

/* Styling for the new range sliders */
.renderer-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: #ddd;
  border-radius: 5px;
  outline: none;
  opacity: 0.7;
  transition: opacity .2s;
  cursor: pointer;
}

.renderer-control input[type="range"]:hover {
  opacity: 1;
}

.renderer-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #57758F;
  border-radius: 50%;
  cursor: pointer;
}

.renderer-control input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #57758F;
  border-radius: 50%;
  cursor: pointer;
}

/* Styling for the new checkboxes */
.renderer-control .checkbox-label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.renderer-control input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: #57758F;
}

/*
  ==========
  OPACITY SLIDER STYLES
  ==========
*/
.opacity-slider-wrapper {
    position: relative;
    margin-top: 15px; /* Gives space for the value display */
    padding-right: 20px;
}

.opacity-value {
    position: absolute;
    top: -10px; /* Position above the slider track */
    transform: translateX(-50%); /* Center the value on its 'left' position */
    font-size: 12px;
    font-weight: bold;
    color: #333;
    pointer-events: none; /* So it doesn't interfere with slider interaction */
    background-color: #FCF7F1;
    padding: 0 2px;
}

/* ========== CUSTOM SELECT DROPDOWN ========== */
.custom-select-container {
    position: relative;
    width: 100%;
}

.select-selected {
    display: flex;
    align-items: center;
    padding: 8px;
    border: 1px solid #b4b4b4;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    user-select: none;
}

.selected-text {
    flex-grow: 1;
    font-size: 14px;
    font-weight: normal;
}

.color-ramp-preview {
    height: 15px;
    width: 100px;
    margin: 0 10px;
    border: 1px solid #898989;
    flex-shrink: 0;
}

.select-arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #555;
    transition: transform 0.2s ease-in-out;
}

.select-arrow.arrow-up {
    transform: rotate(180deg);
}

.select-items {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    border: 1px solid #b4b4b4;
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 99;
    max-height: 200px;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
}

.select-hide {
    display: none;
}

.select-items li {
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: normal;
}

.select-items li:hover {
    background-color: #f0f0f0;
}

.option-text {
    flex-grow: 1;
}

/* ==========
  NEW: DUAL-THUMB ELEVATION SLIDER
  ==========
*/
.elevation-slider-container {
    position: relative;
    width: 100%;
    height: 20px;
    display: flex;
    align-items: center;
}

.slider-track {
    position: absolute;
    width: 100%;
    height: 8px;
    background-color: #ddd;
    border-radius: 5px;
    top: 50%;
    transform: translateY(-50%);
}

.slider-range {
    position: absolute;
    height: 8px;
    background-color: #57758F;
    border-radius: 5px;
    top: 50%;
    transform: translateY(-50%);
}

.slider-thumb {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: #57758F;
    border-radius: 50%;
    cursor: pointer;
    top: 50%;
    transform: translate(-50%, -50%); /* Center thumb on the track */
    z-index: 2;
}

.slider-values {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: #333;
}
