/* T5E Interactive Map - Frontend Styles */

/* Typography is loaded via Google Fonts in the plugin PHP file */
/* Lato for body text, Paytone One for headings */

/* Pin size control - adjust --pin-width to resize all pins */
:root {
    --pin-width: 28px; /* Change this value to resize pins */
    --pin-height: 34.36px; /* Maintains aspect ratio - or calculate: width * 1.227 */
    --color-uncategorized: #f68e45;
    --color-our-activites: #dda52b;
    --color-our-partners: #f15c32;
    --color-impact-stories: #5fa3a0;
}
@media screen and (max-width: 400px) {
    :root {
        --pin-width: 20px;
        --pin-height: 24.5px;
    }
}
@media screen and (min-width: 400px) and (max-width: 700px) {
    :root {
        --pin-width: 24px;
        --pin-height: 29.45px;
    }
    
}

/* Map Section Container */
.t5e-map-section {
    width: 100%;
    position: relative;
}

#t5e-map-container-outer {
    position: relative;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100%;
    background: #8bafc4;
    background: linear-gradient(310deg, rgba(180, 216, 194, 1) 10%, rgba(95, 163, 160, 1) 90%);
}

#t5e-map-container {
    width: 100%;
    height: 630px; /* Default height, responsive rules below */
    position: relative;
    margin: auto;
}

/* Responsive height adjustments */
@media screen and (max-width: 400px) {
    #t5e-map-container { height: 230px; }
}
@media screen and (min-width: 400px) {
    #t5e-map-container { height: 310px; }
}
@media screen and (min-width: 500px) {
    #t5e-map-container { height: 350px; }
}
@media screen and (min-width: 600px) {
    #t5e-map-container { height: 390px; }
}
@media screen and (min-width: 700px) {
    #t5e-map-container { height: 450px; }
}
@media screen and (min-width: 800px) {
    #t5e-map-container { height: 510px; }
}
@media screen and (min-width: 900px) {
    #t5e-map-container { height: 570px; }
}
@media screen and (min-width: 1000px) {
    #t5e-map-container { height: 630px; }
}
@media screen and (min-width: 1100px) {
    #t5e-map-container { height: 690px; }
}

#t5e-world-map {
    width: 100%;
    height: 100%;
    display: block;
    bottom: 0;
    position: relative;
}

/* Map Styling */
.country {
    fill: #E6E6E6;
    stroke: #E6E6E6;
    stroke-width: 0.5;
}

.country.antarctica {
    fill: #E6E6E6;
    stroke: none;
    mask-image: linear-gradient(to top, transparent 0%, black 80%);
}

.sphere {
    fill: none;
}

.point {
    cursor: pointer;
    width: var(--pin-width);
    height: var(--pin-height);
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

/* Filter Controls */
#t5e-filter-container {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 4000;
    pointer-events: none;
    margin-bottom: -100px; /* Pull up to overlap map */
}

#t5e-filter-gradient {
    width: 100%;
    height: 100px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

@media screen and (max-width: 900px) {
    #t5e-filter-gradient { 
        background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 60%); 
    }
}

@media screen and (max-width: 700px) {
    #t5e-filter-gradient { 
        background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 40%); 
    }
}

#t5e-filter-options {
    display: flex;
    justify-content: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2px;
    padding: 15px 15px 0px 15px;
    background: #ffffff;
    pointer-events: auto;
}

.t5e-filter-option {
    margin: 0;
}

.t5e-filter-button {
    width: 140px;
    padding: 10px 12px 8px 12px;
    border-top: 2px hidden #fff;
    border-bottom: 0;
    border-left: 0;
    border-right: 0;
    background: white;
    border-radius: 0;
    cursor: pointer;
    font-size: 16px;
    color: #051935;
    text-align: center;
}

.t5e-filter-button:hover {
    padding: 8px 12px;
    border-color: #0c4277;
    border-top: 2px solid #0c4277;
    background: #fff;
}

.t5e-filter-button.active {
    padding: 8px 12px;
    border-color: #0c4277;
    border-top: 2px solid #0c4277;
    background: #fff;
}

/* Hidden points */
.point.hidden {
    display: none;
}

/* Popup Styles */
#t5e-popup {
    position: absolute;
    background: white;
    padding: 10px 26px 12px 12px;
    margin-top: 5px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 500;
    max-width: 250px;
    transform: translateX(-50%);
    line-height: 1.2;
}

#t5e-popup:after {
    content: " ";
    position: absolute;
    left: calc(50% - 8px);
    top: -10px;
    border-top: none;
    border-right: 8px solid transparent;
    border-left: 8px solid transparent;
    border-bottom: 10px solid #ffffff;
}

#t5e-popup.visible {
    pointer-events: auto;
    opacity: 1;
}

.t5e-popup-close {
    position: absolute;
    top: calc(50% - 6px);
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: #051935;
    pointer-events: auto;
    padding: 0;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.t5e-popup-name {
    font-family: "Paytone One", Arial, sans-serif;
    font-size: 16px;
    color: #051935;
    margin-bottom: 2px;
    display: block;
    padding-right: 20px;
}

.t5e-popup-name a,
.t5e-popup-name a:visited {
    color: #051935;
    text-decoration: none;
}

.t5e-popup-name a:hover {
    text-decoration: underline;
}

.t5e-popup-location {
    font-family: "Lato", Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #051935;
    display: block;
}

.category-uncategorized .t5e-popup-location {
    color: var(--color-uncategorized);
}

.category-our-activities .t5e-popup-location {
    color: var(--color-our-activites);
}

.category-our-partners .t5e-popup-location {
    color: var(--color-our-partners);
}

.category-impact-stories .t5e-popup-location {
    color: var(--color-impact-stories);
}

/* Global Button */

#t5e-global-button-container {
    position: absolute;
    left: 50%;
    top: 0;
    width: 100%;
    height: 100%;
    max-width: 960px;
    pointer-events: none;
    transform: translateX(-50%);
    z-index: 999;
}

#t5e-global-button {
    position: absolute;
    bottom: 30px;
    left: 30px;
    background-color: rgba(0,0,0,0);
    background-image: url('../img/global.svg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
    width: 120px;
    height: 120px;
    padding: 0 1px 16px 0;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    pointer-events: all;
    z-index: 999;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

#t5e-map-container.filter-all #t5e-global-button {
    padding: 0 1px 0 0;
}

#t5e-global-button::before {
    content: "";
    position: absolute;
    top: -29px;
    left: 0;
    width: 120px;
    height: 149px;
    display: block;
    background-image: url('../img/global-bg.svg');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
    pointer-events: none;
    z-index: 999;
}

@media screen and (max-width: 500px) {
    #t5e-global-button {
        width: 80px;
        height: 80px;
        font-size: 14px;
        padding: 0 1px 12px 0;
    }
    #t5e-global-button::before {
        width: 80px;
        height: 99px;
        top: -19px;
    }
}

@media screen and (min-width: 501px) and (max-width: 800px) {
    #t5e-global-button {
        width: 100px;
        height: 100px;
        font-size: 15px;
        padding: 0 1px 14px 0;
    }
    #t5e-global-button::before {
        width: 100px;
        height: 124px;
        top: -24px;
    }
}

/* Dynamic global button images based on active filter */
#t5e-map-container.filter-our-activities #t5e-global-button {
    background-image: url('../img/global-projects.svg');
}

#t5e-map-container.filter-our-partners #t5e-global-button {
    background-image: url('../img/global-partners.svg');
}

#t5e-map-container.filter-impact-stories #t5e-global-button {
    background-image: url('../img/global-stories.svg');
}

/* Global Overlay */
#t5e-global-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

#t5e-global-overlay.visible {
    display: flex;
}

#t5e-global-box {
    background: white;
    padding: 8px 40px 12px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    width: 320px;
    max-width: 70%;
    max-height: 70%;
    overflow-y: auto;
    position: absolute;
    clip-path: inset(0 round 12px);
}

.t5e-global-close {
    position: absolute;
    top: 20px;
    right: 22px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 20px;
    height: 16px;
    line-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.t5e-global-close:hover {
    color: #333;
}

.t5e-global-item {
    padding: 12px 0;
    border-bottom: 1px solid #ecf0f1;
}

.t5e-global-item:last-child {
    border-bottom: none;
}

.t5e-global-item .t5e-popup-name {
    margin-bottom: 4px;
}

.t5e-global-empty {
    color: #7f8c8d;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Zoom Controls */
#t5e-zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
    z-index: 1000;
}

.t5e-zoom-button {
    width: 36px;
    height: 36px;
    padding-bottom: 4px;
    background: white;
    border: 1px solid #ddd;
    font-size: 20px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@media screen and (max-width: 500px) {
    .t5e-zoom-button {
        width: 30px;
        height: 30px;
        font-size: 18px;
    }
}

@media screen and (min-width: 501px) and (max-width: 800px) {
    .t5e-zoom-button {
        width: 32px;
        height: 32px;
        font-size: 19px;
    }
}

.t5e-zoom-button:hover {
    background: #f5f5f5;
    border-color: #999;
}

.t5e-zoom-button:active {
    background: #e8e8e8;
}

.t5e-zoom-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Wordpress style fixes */
/* Focus styles */
#t5e-map-section *:focus {
    outline-width: 0px !important;
    outline-style: none !important;
}

#t5e-map-section button {
    font-family: "Lato", Arial, sans-serif;
}