/* ArcGIS Map Styles for Appian Plugin */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    height: 100%;
    width: 100%;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

#viewDiv {
    height: 100vh;
    width: 100vw;
    position: absolute;
    top: 0;
    left: 0;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    font-size: 18px;
    color: #333;
}

.loading-overlay.hidden {
    display: none;
}

/* Error message styling */
.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    text-align: center;
    z-index: 1001;
    max-width: 400px;
}

.error-message h3 {
    color: #d32f2f;
    margin-bottom: 10px;
}

.error-message p {
    margin-bottom: 8px;
    line-height: 1.4;
}

.error-message .error-details {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
    font-family: monospace;
    background: #f5f5f5;
    padding: 8px;
    border-radius: 4px;
    text-align: left;
}

/* Future styles for polygons and POIs */
.polygon-layer {
    /* Custom styling for polygon layers */
    opacity: 0.8;
}

.poi-layer {
    /* Custom styling for POI layers */
    cursor: pointer;
}

.map-controls {
    /* Custom map control styling */
    position: relative;
}

.map-controls-overlay {
    position: absolute;
    inset: 0;
    z-index: 900;
    pointer-events: none;
}

.map-controls-overlay__row {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.map-controls-overlay__left,
.map-controls-overlay__right {
    pointer-events: auto;
}

.map-controls-overlay__left {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.map-controls-overlay__spacer {
    flex: 1;
}

.map-controls-overlay__stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    pointer-events: auto;
}

.map-control-btn {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
    background: #000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    user-select: none;
}

.map-control-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.map-control-btn__inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #fff;
}

.map-control-btn__inner--small {
    gap: 4px;
}

.map-control-btn__icon {
    font-size: 20px;
    line-height: 1;
}

.map-control-btn__icon img {
    width: 22px;
    height: 22px;
    display: block;
}

.map-control-btn--active .map-control-btn__icon img {
    filter: invert(33%) sepia(94%) saturate(2466%) hue-rotate(196deg) brightness(101%) contrast(103%);
}

.map-control-btn__label {
    font-size: 9px;
    line-height: 1;
}

.map-control-btn--inactive .map-control-btn__inner {
    color: #fff;
}

.map-control-btn--active .map-control-btn__inner {
    color: #78A6FF;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    padding: 16px;
}

.modal-overlay.is-open {
    display: flex;
}

.drawing-panel {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    display: none;
    width: min(520px, calc(100% - 32px));
    padding: 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
}

.drawing-panel.is-open {
    display: block;
}

.drawing-panel__title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}

.drawing-panel__subtitle {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: 12px;
}

.drawing-panel__actions {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.drawing-panel__btn {
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    flex: 1;
}

.drawing-panel__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.drawing-panel__btn--primary {
    background: #78A6FF;
    border-color: #78A6FF;
    color: #fff;
    font-weight: 600;
}

.drawing-panel__btn--danger {
    border-color: rgba(255, 59, 48, 0.4);
    color: #ff3b30;
}

.modal {
    width: min(720px, 100%);
    max-height: min(90vh, 800px);
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.modal__header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.modal__title {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.modal__btn {
    background: transparent;
    border: none;
    color: #78A6FF;
    font-size: 14px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    justify-self: start;
}

.modal__btn--primary {
    justify-self: end;
    font-weight: 600;
}

.modal__btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.modal__body {
    padding: 14px;
    overflow: auto;
    background: #f2f2f7;
}

.form-section {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.form-section__title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    color: rgba(0, 0, 0, 0.7);
}

.form-field {
    display: block;
    margin-bottom: 10px;
}

.form-field:last-child {
    margin-bottom: 0;
}

.form-field__label {
    font-size: 12px;
    margin-bottom: 6px;
    color: rgba(0, 0, 0, 0.7);
}

.form-field__input,
.form-field__textarea {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

.form-field__textarea {
    resize: vertical;
}

.color-pill-row {
    display: flex;
    gap: 10px;
}

.color-pill {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    background: transparent;
}

.color-pill--selected {
    background: rgba(0, 0, 0, 0.06);
}

.color-pill__dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.color-pill__dot--blue {
    background: #78A6FF;
}

.color-pill__dot--red {
    background: #ff3b30;
}

.color-pill__dot--green {
    background: #34c759;
}

.color-pill__text {
    font-size: 12px;
}

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.info-row:first-of-type {
    border-top: none;
    padding-top: 0;
}

.info-row__label {
    font-size: 14px;
}

.info-row__value {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.55);
}

.marker-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
}

.marker-type-btn {
    height: 80px;
    width: 100%;
    border: none;
    border-radius: 12px;
    background: #f2f2f7;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
}

.marker-type-btn__icon {
    font-size: 28px;
    line-height: 1;
    color: #78A6FF;
}

.marker-type-btn__label {
    font-size: 12px;
    line-height: 1;
    color: #111;
}

.marker-type-btn--selected {
    background: #78A6FF;
    box-shadow: inset 0 0 0 2px #78A6FF;
}

.marker-type-btn--selected .marker-type-btn__icon,
.marker-type-btn--selected .marker-type-btn__label {
    color: #fff;
}
