/**
 * Max Interactive Maps - Admin Styles
 *
 * @package Max_Interactive_Maps
 */

/* ========================================
   Map Builder Container
   ======================================== */

.mximap-map-builder {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

/* ========================================
   Toolbar
   ======================================== */

.mximap-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f6f7f7;
    border-bottom: 1px solid #dcdcde;
}

.mximap-toolbar .button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mximap-toolbar .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.mximap-toolbar-info {
    color: #646970;
    font-size: 13px;
}

/* ========================================
   Map Container
   ======================================== */

.mximap-map-container {
    position: relative;
    padding: 20px;
    background: #fff;
    min-height: 400px;
}

.mximap-map-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: var(--mximap-water, #a8d4e6);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* Force aspect ratio to match SVG viewBox (2000x1000 = 2:1) */
    aspect-ratio: 2 / 1;
}

.mximap-world-map {
    display: block;
    width: 100%;
    height: auto;
}

.mximap-world-map .mximap-land {
    fill: var(--mximap-land, #c9e4c5);
    stroke: var(--mximap-border, #ffffff);
    stroke-width: 0.5;
    transition: fill 0.3s ease;
}

.mximap-world-map .mximap-water {
    fill: var(--mximap-water, #a8d4e6);
}

/* ========================================
   Pins Layer
   ======================================== */

.mximap-pins-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.mximap-pin {
    position: absolute;
    /* Only center horizontally. Vertical position is top-aligned to coordinate */
    transform: translateX(-50%);
    cursor: grab;
    pointer-events: auto;
    z-index: 10;
    transition: transform 0.15s ease;
}

.mximap-pin:hover {
    transform: translateX(-50%) scale(1.15);
    z-index: 20;
}

.mximap-pin.ui-draggable-dragging {
    cursor: grabbing;
    z-index: 100;
    transform: translateX(-50%) scale(1.2);
}


.mximap-pin-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Translate UP by 100% of its OWN height so bottom is at coordinate */
    transform: translateY(-100%);
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.mximap-pin-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* Pin styles - different sizes */
.mximap-pin-dot .mximap-pin-icon {
    width: 16px;
    height: 16px;
}

.mximap-pin-teardrop .mximap-pin-icon {
    width: 32px;
    height: 32px;
}

.mximap-pin-star .mximap-pin-icon {
    width: 24px;
    height: 24px;
}

.mximap-pin-flag .mximap-pin-icon {
    width: 24px;
    height: 32px;
}

.mximap-pin-pushpin .mximap-pin-icon {
    width: 24px;
    height: 32px;
}

/* Selected state */
.mximap-pin.mximap-pin-selected {
    z-index: 50;
}

.mximap-pin.mximap-pin-selected::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px dashed #2271b1;
    border-radius: 50%;
    animation: mximap-pulse 1.5s infinite;
}

@keyframes mximap-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ========================================
   Modal
   ======================================== */

.mximap-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mximap-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

.mximap-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: auto;
}

.mximap-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #dcdcde;
}

.mximap-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.mximap-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #646970;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.mximap-modal-close:hover {
    background: #f0f0f1;
    color: #1d2327;
}

.mximap-modal-body {
    padding: 20px;
}

.mximap-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #dcdcde;
    background: #f6f7f7;
}

.mximap-modal-footer .mximap-modal-delete {
    margin-right: auto;
}

/* ========================================
   Form Styles
   ======================================== */

.mximap-form-row {
    margin-bottom: 16px;
}

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

.mximap-form-row label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #1d2327;
}

.mximap-form-row input[type="text"],
.mximap-form-row input[type="url"],
.mximap-form-row select {
    width: 100%;
}

.mximap-form-row-inline {
    display: flex;
    gap: 16px;
}

.mximap-form-col {
    flex: 1;
}

/* Color Picker Adjustments */
.mximap-form-row .wp-picker-container {
    display: block;
}

.mximap-form-row .wp-picker-container .wp-color-result.button {
    margin: 0;
}

/* ========================================
   Settings Box
   ======================================== */

.mximap-settings-box {
    padding: 0;
}

.mximap-settings-box .mximap-form-row {
    margin-bottom: 20px;
}

/* ========================================
   Shortcode Box
   ======================================== */

.mximap-shortcode-box input {
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    background: #f6f7f7;
    color: #2271b1;
}

.mximap-shortcode-box .description {
    margin-top: 8px;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media screen and (max-width: 782px) {
    .mximap-toolbar {
        flex-wrap: wrap;
    }

    .mximap-form-row-inline {
        flex-direction: column;
        gap: 16px;
    }

    .mximap-modal-content {
        margin: 20px;
    }
}