:root {
    --bg-body: #1e1e1e;
    --bg-card: #2c2c2c;
    --bg-element-dark: #1e1e1e;
    --color-red-primary: #ff0000;
    --color-red-hover: #ff0000A0;
    --text-main: #cccccc;
    --text-light: #ffffff;
    --text-muted: #a3a3a3;
    --border-color: #cccccc40;
    --radius-xl: 16px;
    --radius-lg: 12px;
    --radius-md: 8px;
    --transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay {
    position: fixed;
    z-index: 9999;
    top: 50px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 50px);
    background-color: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 16px;
    font-family: 'Roboto', sans-serif;
    box-sizing: border-box;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 1100px;
    max-height: 92vh;
    border-radius: var(--radius-xl);
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

@media (min-width: 900px) {
    .modal-box {
        display: grid;
        grid-template-columns: 420px 1fr;
        max-height: 85vh;
        overflow: hidden;
    }
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-close-trigger {
    position: absolute;
    top: 14px;
    right: 18px;
    color: var(--text-muted);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}

.modal-close-trigger:hover {
    color: var(--text-light);
    transform: scale(1.1);
}

/* Left Pane Controls */
.modal-meta-pane {
    padding: 24px;
    display: flex;
    flex-direction: column;
}

@media (min-width: 900px) {
    .modal-meta-pane {
        padding: 32px;
        overflow-y: auto;
    }
}

.modal-meta-pane h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-light);
    margin-bottom: 20px;
    margin-top: 0;
}

.export-options-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 20px;
}

.control-block label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pill-container {
    display: flex;
    background: var(--bg-element-dark);
    /* border: 1px solid var(--border-color); */
    border: 1px solid #cccccc60;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.pill-container.vertical-pills {
    flex-direction: column;
}

.pill-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 8px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-right: 1px solid var(--border-color);
}

.pill-container:not(.vertical-pills) .pill-btn:last-child {
    border-right: none;
}

.vertical-pills .pill-btn {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
}

.vertical-pills .pill-btn:last-child {
    border-bottom: none;
}

.pill-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.pill-btn.active {
    background: #2a2a2a;
    color: var(--text-light);
    background-color: #cccccc30;
    /* box-shadow: inset 0 2px 0 var(--color-red-primary); */
}

/* .vertical-pills .pill-btn.active {
    box-shadow: inset 2px 0 0 var(--color-red-primary);
} */

.pill-sub {
    font-size: 0.68rem;
    font-weight: 400;
    opacity: 0.65;
    margin-top: 4px;
    display: flex;
    gap: 4px;
}

.pill-btn.active .pill-sub {
    opacity: 0.85;
}

.pill-with-preview {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.pill-with-preview .pill-container {
    flex: 1;
}

.square-preview {
    width: 72px;
    min-height: 72px;
    background-color: var(--bg-element-dark);
    border: 1px solid #cccccc60;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
    overflow: hidden;
    flex-shrink: 0;
}

.square-preview img {
    width: 100%;
    height: 100%;
}

.btn-generate {
    width: 100%;
    background-color: var(--color-red-primary);
    color: white;
    border: none;
    padding: 13px;
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.btn-generate:hover { 
    background-color: var(--color-red-hover); 
}

.btn-generate:disabled {
    background-color: #4b5563;
    cursor: not-allowed;
    opacity: 0.8;
}

.generate-note {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    margin: 8px 0 0 0;
    line-height: 1.4;
}

.modal-visual-pane {
    background-color: var(--bg-element-dark);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
    border-top: 1px solid var(--border-color);
    gap: 20px;
}

@media (min-width: 900px) {
    .modal-visual-pane {
        border-top: none;
        border-left: 1px solid var(--border-color);
        padding: 32px;
        padding-top: 42px;
        overflow-y: auto;
    }
}

.preview-display-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 240px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
    overflow: hidden;
}

.preview-display-container img {
    width: 100%;
    height: 100%;
    max-height: 50vh;
    object-fit: contain;
    padding: 12px;
    box-sizing: border-box;
}

.placeholder-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px;
}

.placeholder-icon {
    font-size: 2.5rem;
    opacity: 0.5;
}

.export-loading-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: white;
    font-weight: 600;
    z-index: 5;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--color-red-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { 
    to { transform: rotate(360deg); } 
}

.download-action-list {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
}

.btn-download-link {
    width: 100%;
    background-color: #242424;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 18px;
    border-radius: var(--radius-lg);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    transition: var(--transition);
    box-sizing: border-box;
    text-align: left;
}

.btn-download-link:hover:not(.disabled) {
    background-color: #333;
    color: var(--text-light);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-download-link.hq-premium {
    background-color: var(--color-red-primary);
    color: var(--text-light);
    border-color: transparent;
}

.btn-download-link.hq-premium:hover:not(.disabled) {
    background-color: var(--color-red-hover);
}

.btn-download-link.disabled {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(100%);
}

.download-meta-specs {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    font-size: 0.75rem;
    line-height: 1.3;
}

.download-res { font-weight: 700; color: var(--text-light); }
.download-size { font-weight: 500; color: rgba(255, 255, 255, 0.75); }

@media (max-width: 380px) {
    .quality-pills .pill-sub {
        flex-direction: column;
        gap: 2px;
    }
}






/* =========================================================
   MAP TYPE CONTROL
   ========================================================= */

.mapTypeControl {
    --main-size: 100px;
    --card-size: 92px;
    --gap: 10px;
    --radius: 18px;

    --bg: #1c1c1e;
    --border: #cccccc40;
    --accent: red;

    position: fixed;
    left: calc(414px + 15px);
    bottom: 15px;

    z-index: 2;

    width: max-content;
    height: var(--main-size);

    font-family: "Roboto", sans-serif;
}

@media (max-width: 1150px) {

    .mapTypeControl {
        left: 15px;
    }
}

body:has(.selection-side[style*="display: none"]) .mapTypeControl {
    left: 15px;
}


/* =========================================================
   MAIN BUTTON
   ========================================================= */

.mapTypeMain {
    position: absolute;
    left: 0;
    top: 0;

    width: var(--main-size);
    height: var(--main-size);

    padding: 0;

    border: 1px solid var(--border);
    border-radius: 20px;

    overflow: hidden;
    box-sizing: border-box;

    background: var(--bg);

    cursor: pointer;

    box-shadow:
        0 12px 26px rgba(0, 0, 0, 0.30),
        0 4px 9px rgba(0, 0, 0, 0.28),
        0 1px 2px rgba(0, 0, 0, 0.40),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);

    transition:
        transform 0.18s cubic-bezier(.2, .8, .2, 1),
        box-shadow 0.18s ease;
}

.mapTypeMain:hover {
    transform: translateY(-2px);

    box-shadow:
        0 16px 32px rgba(0, 0, 0, 0.34),
        0 6px 13px rgba(0, 0, 0, 0.30),
        0 1px 3px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mapTypeMain:active {
    transform: translateY(0) scale(0.975);
}


/* =========================================================
   IMAGE
   ========================================================= */

.mapTypeOptionImg {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    border-radius: inherit;

    pointer-events: none;

    transition:
        transform 0.28s cubic-bezier(.2, .8, .2, 1),
        filter 0.25s ease;
}

.mapTypeMain:hover .mapTypeOptionImg {
    transform: scale(1.035);
    filter: brightness(1.04);
}


/* =========================================================
   IMAGE SHADOW / GRADIENT
   ========================================================= */


/* =========================================================
   MAIN LABEL
   ========================================================= */

.mapTypeText {
    position: absolute;

    left: 11px;
    bottom: 9px;

    color: white;

    font-size: 12px;
    font-weight: 600;

    max-width: 60px;
    text-align: left;

    pointer-events: none;

    paint-order: stroke fill;
    -webkit-text-stroke: 3.25px rgba(0, 0, 0, 0.7);
}


/* =========================================================
   CHEVRON
   ========================================================= */

/*
    Don't use a text character here.
    This creates an actual CSS chevron, so it stays
    perfectly centered regardless of font/platform.
*/

.mapTypeChevron {
    position: absolute;

    right: 9px;
    bottom: 8px;

    width: 18px;
    height: 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: rgba(0, 0, 0, 0.70);

    pointer-events: none;

    transition:
        transform 0.22s cubic-bezier(.2, .8, .2, 1),
        background 0.2s ease;
}

.mapTypeChevron::before {
    content: "";

    width: 5px;
    height: 5px;

    border-right: 1.5px solid rgba(255, 255, 255, 1);
    border-bottom: 1.5px solid rgba(255, 255, 255, 1);

    transform:
        translateY(-1px)
        rotate(45deg);
}

.mapTypeControl:hover .mapTypeChevron {
    transform: rotate(180deg);
    background: rgba(0, 0, 0, 0.80);
}


/* =========================================================
   OPTIONS CONTAINER
   ========================================================= */


/*
    The parent remains hovered while the mouse is
    anywhere over the control or options.
*/

/* =========================================================
   OPTION CARDS
   ========================================================= */

.mapTypeOption {
    position: relative;

    width: var(--card-size);
    height: var(--card-size);

    flex: 0 0 var(--card-size);

    padding: 0;

    border: 2px solid transparent;
    border-radius: var(--radius);

    overflow: hidden;

    box-sizing: border-box;

    background: var(--bg);

    cursor: pointer;

    box-shadow:
        0 10px 23px rgba(0, 0, 0, 0.28),
        0 4px 9px rgba(0, 0, 0, 0.25),
        0 1px 2px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);

    transform: translateY(0);

    transition:
        transform 0.18s cubic-bezier(.2, .8, .2, 1),
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}


/* =========================================================
   OPTION HOVER
   ========================================================= */

.mapTypeOption:hover {
    transform: translateY(-4px);

    border-color: rgba(255, 255, 255, 0.30);

    box-shadow:
        0 16px 30px rgba(0, 0, 0, 0.34),
        0 6px 13px rgba(0, 0, 0, 0.27),
        0 2px 4px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.mapTypeOption:hover .mapTypeOptionImg {
    transform: scale(1.05);
    filter: brightness(1.06);
}

.mapTypeOption:active {
    transform: translateY(-1px) scale(0.975);
}


/* =========================================================
   SELECTED
   ========================================================= */

.mapTypeOption.mapTypeSelected {
    border-color: red;

    box-shadow:
        0 0 0 1px rgba(255, 0, 0, 0.18),
        0 10px 23px rgba(0, 0, 0, 0.30),
        0 4px 9px rgba(0, 0, 0, 0.26),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.mapTypeOption.mapTypeSelected:hover {
    border-color: red;

    box-shadow:
        0 0 0 2px rgba(255, 0, 0, 0.10),
        0 16px 30px rgba(0, 0, 0, 0.36),
        0 6px 13px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}


/* =========================================================
   OPTION LABEL
   ========================================================= */


/* =========================================================
   HIDDEN DETAILED OPTION
   ========================================================= */

#mapType_detailedOption[style*="display: none"] {
    display: none !important;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    .mapTypeOptionsBox {
        left: auto;
        right: var(--main-size);

        padding-left: 0;
        padding-right: var(--gap);

        transform-origin: right center;

        transform:
            translateX(10px)
            scale(0.98);
    }

    .mapTypeControl:hover .mapTypeOptionsBox,
    .mapTypeOptionsBox:hover {
        transform:
            translateX(0)
            scale(1);
    }
}


/* =========================================================
   OPTIONS CONTAINER
   ========================================================= */

.mapTypeOptionsBox {
    position: absolute;

    left: var(--main-size);
    top: 0;

    width: max-content;
    height: var(--main-size);

    display: flex;
    align-items: center;

    /* Visual gap between the main button and options */
    padding-left: var(--gap);

    /* THIS is the gap between the option cards */
    gap: var(--gap);

    box-sizing: border-box;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform:
        translateX(-10px)
        scale(0.98);

    transform-origin: left center;

    transition:
        opacity 0.16s ease,
        transform 0.20s cubic-bezier(.2, .8, .2, 1),
        visibility 0s linear 0.20s;
}


.mapTypeControl:hover .mapTypeOptionsBox,
.mapTypeOptionsBox:hover {
    opacity: 1;
    visibility: visible;

    pointer-events: auto;

    transform:
        translateX(0)
        scale(1);

    transition:
        opacity 0.16s ease,
        transform 0.20s cubic-bezier(.2, .8, .2, 1),
        visibility 0s;
}


/* =========================================================
   OPTION LABEL
   ========================================================= */

.mapTypeOptionText {
    position: absolute;
    left: 9px;
    bottom: 7px;
    width: 74px;
    max-width: calc(100% - 18px);
    color: white;
    font-size: 11px;
    font-weight: 600;
    line-height: 13px;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    pointer-events: none;
    paint-order: stroke fill;
    -webkit-text-stroke: 3.25px rgba(0, 0, 0, 0.7);
}

.leaflet-touch .custom-download-control a,
.custom-download-control a {
  background-image: url('../Images/download.svg');
  background-position: center;
  background-repeat: no-repeat;
  background-size: 20px 20px;
  width: 30px;
  height: 30px;
  line-height: 30px;
  display: block;
  text-align: center;
  text-decoration: none;
}

.custom-download-control a:hover {
  background-image: url('../Images/download-hover.svg');
}