html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
}

#mapContainer {
    flex: 1 1 auto;
    display: flex;
    flex-direction: row;
    min-height: 0;
    overflow: hidden;
}

#map {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: 100%;
}

#mapContainer * {
    transition: none !important;
}

.info-message {
    background-color: #f5f5f5;
    border-left: 4px solid #007ac2;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #2b2b2b;
}

.warning-message {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 0.75rem;
    border-radius: 4px;
    margin: 0.5rem 0;
}

.main-layout {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}

lojic-sidebar {
    flex: 0 0 clamp(380px, 24vw, 380px);
    --sidebar-content-padding: 10px;
}

.sidebar-overlay {
    position: fixed;
    height: 100%;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.sidebar-overlay[hidden] {
    display: none;
}

.sidebar-overlay-content {
    font-weight: bold;
    font-size: 1rem;
}

lojic-sidebar h2 {
    margin-top: 0;
    border-bottom: 1px solid #e0e0e0;
}

#paymentNoticeFormGroup {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 1rem;
}

#paymentNoticeFormGroup input[type="checkbox"] {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: #111;
    cursor: pointer;
}

#paymentNoticeFormGroup label {
    font-size: 13px;
    color: #444;
    line-height: 1.5;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}

#purchaseTilesBtn {
    display: block;
    background: #3268be;
    color: #FFF;
    border: none;
    border-radius: 3px;
}

#purchaseTilesBtn:hover {
    background: #396fc5;
}

.arcgis-search {
    width: 400px;
    min-width: 200px;
    max-width: calc(100% - 50px);
}

arcgis-map {
    position: relative;
}

.form-group {
    margin-bottom: 1rem;
}

/* Tile Selection Tools */
.tile-selection-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: white;
    width: 100%;
    justify-content: space-evenly;
    margin: 0 auto;
}

.tileSelectTool {
    padding: 0.5rem;
    border: 2px solid transparent;
    background: none;
    cursor: pointer;
    border-radius: 4px;
}

.tileSelectTool:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

.tileSelectTool:hover {
    background-color: #f0f0f0;
}

.tileSelectTool[aria-pressed="true"] {
    background-color: #e6f3ff;
    border-color: #005fcc;
}
.tileSelectTool[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none; /* visually and functionally disables pointer input */
}

lojic-sidebar button {
    padding: 10px;
}

select, input {
    padding: 5px;
}

fieldset {
    border: 1px solid #ccc;
    padding: 0.5rem;
    margin: 1rem 0;
}

legend {
    font-weight: bold;
    padding: 0 0.5rem;
}

#clearSelectedTilesBtn {
    width: 100%;
    padding: 8px 16px;
    background: #e8f0fe;
    color: #111;
    border: 1px solid #b3c8f8;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 1.25rem;
    transition: background 0.15s;
}

#clearSelectedTilesBtn:hover:not(:disabled) {
    background: #eef3fb;
}

#clearSelectedTilesBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#clearSelectedTilesBtn:focus-visible {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}
 
.instructions-icon {
    vertical-align: middle;
}

#tileLimitWarning {
    display: none;
}

#totalSelectedTiles,
#remainingTiles {
    font-weight: bold;
}

/* Tooltip styling */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
    z-index: 1000;
    max-width: 200px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tooltip.visible {
    opacity: 1;
}

.tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
}
/* */

/* Scale Bar - Ruler */
.esri-scale-bar__ruler {
    border: 1px solid black;
    width: 118px!important;
    height: 8px;
}

/* Search */
arcgis-search calcite-loader {
    display: inline-block !important;
    visibility: visible !important;
}

/* Esri UI */
.esri-ui {
    z-index: 100;
}

.field {
    margin-bottom: 1.25rem;
}

.field label,
.form-group label {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.field select,
.field input[type="email"],
  .form-group input[type="email"] {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
    color: #111;
}

.field select:focus,
.field input[type="email"]:focus,
.form-group input[type="email"]:focus {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}

.field select:disabled,
.field input[type="email"]:disabled,
.form-group input[type="email"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.info-banner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #e8f0fe;
    border: 1px solid #b3c8f8;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: #1a4fa0;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.info-banner svg,
.warning-banner svg {
    width: 15px;
    height: 15px;
    min-width: 15px;
    margin-top: 1px;
}

.summary-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.summary-row + .summary-row {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
}

.summary-label {
    color: #333;
}

.summary-value {
    font-weight: 500;
    color: #111;
}

.cost-value {
    font-size: 18px;
    font-weight: 500;
    color: #111;
}

.warning-banner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #fff8e1;
    border: 1px solid #f5c842;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: #7a5800;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.email-help {
    font-size: 12px;
    color: #333;
    margin: 6px 0 0;
    line-height: 1.5;
}

.btn-primary {
    width: 100%;
    padding: 10px 16px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
}

.btn-primary:hover {
    opacity: 0.85;
}

.btn-primary:active {
    transform: scale(0.99);
}

.btn-primary:focus-visible {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}


/* Responsive */
@media (max-width: 768px) {
    #mapContainer {
        flex-direction: column;
    }

    #map {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
    }

    lojic-sidebar {
        flex: 0 0 var(--mobile-size, 50vh);
        width: 100%;
        height: var(--mobile-size, 50vh);
        position: static;
        transform: none;
    }

    lojic-sidebar.collapsed {
        flex: 0 0 0;
        height: 0;
        overflow: hidden;
    }

    lojic-sidebar.mobile-open {
        transform: translateY(0);
    }
}