/**
 * Home Truths CSS Styles
 */

/* Map Styles */
.home-truths-map {
    height: 500px;
    width: 100%;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

/* Reset map control styles */
.reset-map-view {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    cursor: pointer;
    background-color: #fff;
    color: #000;
}

.reset-map-view:hover {
    background-color: #f4f4f4;
}

.reset-map-button {
    display: inline-block;
    margin-bottom: 1rem;
    padding: 0.6rem 1rem;
    background-color: #171615;
    color: #B3FF00;
    border: 1px solid #B3FF00;
    cursor: pointer;
    font-weight: 600;
    border-radius: 0px;
    font-family: 'articulat', sans-serif;
    transition: all 0.2s;
}

.reset-map-button:hover {
    background-color: #B3FF00;
    color: #171615;
}

/* Pulsing marker animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.pulsing-marker {
    animation: pulse 1.5s infinite ease-in-out;
}

/* Story Sidebar Styles */
.home-truths-stories {
    color: #f2f2f2;
    padding: 1rem 0;
}

.home-truths-stories h2 {
    font-family: 'articulat', sans-serif;
    margin-top: 0;
    font-size: 1.6rem;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: #b2ff01;
}

#stories-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.story-card {
    margin-bottom: 0;
    padding: 1.25rem;
    background-color: #171615 !important;
    border-left: 1px solid #f2f2f2;
    position: relative;
    border-radius: 0px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

/* Active story card */
.story-card.active {
    border-left: 4px solid #B3FF00;
    background-color: #222 !important;
}

.story-card h3 {
    margin-top: 0;
    font-family: 'articulat', sans-serif;
    font-size: 1.4rem;
    letter-spacing: 0;
    color: #f2f2f2;
    margin-bottom: 0.7rem;
    font-weight: 600;
}

.story-location {
    font-size: 0.85rem;
    color: #ccc;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.story-category {
    display: inline-block;
    padding: 5px 10px;
    background-color: #B3FF00;
    color: #171615;
    font-weight: 600;
    font-size: 0.7rem;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 0px;
}

.category-firsts {
    background-color: #B3FF00;
}

.category-lasts {
    background-color: #B3FF00;
}

.category-huge-life-moment {
    background-color: #B3FF00;
}

.story-content {
    margin-bottom: 0.8rem;
    color: #f2f2f2;
}

.read-more {
    font-family: 'articulat', sans-serif;
    display: inline-block;
    background-color: transparent;
    color: #B3FF00;
    margin-top: 0px;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    box-shadow: none;
    font-weight: 600;
    border-radius: 0px;
    text-decoration: underline;
}

.read-more:hover {
    background-color: transparent !important;
    color: #f2f2f2 !important;
}

/* Form Styles */
.home-truths-form-container {
    background-color: #171615;
    color: #f2f2f2;
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 0px;
}

.home-truths-form-container h2 {
    color: #B3FF00;
    font-family: 'articulat', sans-serif;
    font-size: 28px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
}

.home-truths-form {
    margin-top: 1.5rem;
}

.form-group {
    margin-bottom: 1.8rem;
}

.home-truths-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 20px;
    color: #f2f2f2;
}

.home-truths-form input,
.home-truths-form textarea,
.home-truths-form select {
    width: 95%;
    padding: 1rem;
    border: 1px solid #f2f2f2;
    border-radius: 0px;
    font-family: 'articulat', sans-serif;
    font-size: 1rem;
    background-color: #222222;
    color: #f2f2f2;
}

.home-truths-form input:focus,
.home-truths-form textarea:focus,
.home-truths-form select:focus {
    outline: none;
    border-color: #B3FF00;
    box-shadow: 0 0 0 1px rgba(179, 255, 0, 0.5);
}

.home-truths-form textarea {
    min-height: 150px;
    resize: vertical;
}

.home-truths-form .submit-btn {
    padding: 1rem 1.5rem;
    background-color: transparent;
    color: #B3FF00;
    border: none;
    cursor: pointer;
    font-family: "articulat", sans-serif;
    font-weight: 600;
    font-style: normal;
    font-size: 26px;
    line-height: 38px;
    text-decoration: underline;
    border-radius: 0px;
}

.home-truths-form .submit-btn:hover {
    color: #f2f2f2;
}

.category-selector {
    display: flex;
    gap: 1rem;
    margin-top: 0.7rem;
}

.category-option {
    cursor: pointer;
    padding: 0.7rem 1rem;
    background-color: #222222;
    border-radius: 0px;
    transition: all 0.2s;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
    border: 1px solid #f2f2f2;
}

.category-option:hover {
    background-color: #333333;
}

.category-option.selected {
    color: #171615;
}

.category-option.firsts.selected,
.category-option.lasts.selected,
.category-option.huge-life-moment.selected {
    background-color: #B3FF00;
}

.map-instruction {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-style: italic;
    color: #ccc;
}

/* Anonymous checkbox styling */
.anonymous-option {
    margin-top: -10px;
    margin-bottom: 20px;
}

.anonymous-option label.checkbox-label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
}

.anonymous-option input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    cursor: pointer;
}

.anonymous-option small {
    display: block;
    margin-top: 5px;
    font-style: italic;
    color: #ccc;
}

/* Map mobile instruction styling */
.map-mobile-instruction {
    margin-top: 0.2rem;
    font-size: 0.9rem;
    font-style: italic;
    color: #B3FF00;
    display: none; /* Hidden by default, shown only on mobile */
}

/* Style for disabled/readonly inputs */
.home-truths-form input[readonly] {
    background-color: #333;
    cursor: not-allowed;
}

/* Submission Results */
#submission-result {
    margin-top: 1rem;
}

.success-message {
    padding: 1rem;
    background-color: rgba(179, 255, 0, 0.1);
    border-left: 4px solid #B3FF00;
    color: #f2f2f2;
}

.error-message {
    padding: 1rem;
    background-color: rgba(255, 0, 0, 0.1);
    border-left: 4px solid #ff0000;
    color: #f2f2f2;
}

.info-message {
    padding: 1rem;
    background-color: rgba(70, 130, 180, 0.1);
    border-left: 4px solid #4682B4;
    color: #f2f2f2;
}

.warning-message {
    padding: 1rem;
    background-color: rgba(255, 165, 0, 0.1);
    border-left: 4px solid #FFA500;
    color: #f2f2f2;
}

/* Marker styles */
.custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Search widget styles */
.home-truths-search-container {
    background-color: #171615;
    color: #f2f2f2;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0px;
}

.home-truths-search {
    margin-bottom: 1.5rem;
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
}

.home-truths-search input,
.home-truths-search select {
    flex: 1;
    padding: 0.75rem;
    background-color: #222222;
    color: #f2f2f2;
    border: 1px solid #444;
    border-radius: 0px;
    font-family: 'articulat', sans-serif;
}

.home-truths-search-button {
    padding: 0.75rem 1.5rem;
    background-color: transparent;
    color: #B3FF00;
    border: 1px solid #B3FF00;
    cursor: pointer;
    font-family: 'articulat', sans-serif;
    font-weight: 600;
    border-radius: 0px;
    transition: all 0.2s;
}

.home-truths-search-button:hover {
    background-color: #B3FF00;
    color: #171615;
}

.home-truths-search-results h3 {
    color: #B3FF00;
    font-family: 'articulat', sans-serif;
    font-weight: 600;
    margin-bottom: 1rem;
}

.search-stories-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Find location button */
.find-location-btn {
    display: inline-block;
    background-color: #222222;
    color: #B3FF00;
    border: 1px solid #B3FF00;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    border-radius: 0px;
}

.category-option.selected {
    background-color: #B3FF00 !important;
    color: #171615 !important;
    border-color: #B3FF00 !important;
}

.find-location-btn:hover {
    background-color: #B3FF00;
    color: #171615;
}

/* Position the button on the same line for wider screens */
@media (min-width: 768px) {
    .find-location-btn {
        margin-left: 1rem;
    }
}

/* Leaflet Gesture Handling Custom Styles */
.leaflet-gesture-handling-touch-warning,
.leaflet-gesture-handling-scroll-warning {
    background-color: rgba(23, 22, 21, 0.8) !important;
    color: #B3FF00 !important;
    font-family: 'articulat', sans-serif !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
    border-radius: 0px !important;
}

/* Add styling for our custom gesture instructions */
.map-gesture-instructions {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #B3FF00;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1000;
    pointer-events: none;
    font-family: 'articulat', sans-serif;
    animation: fadeOut 5s forwards;
}

@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

/* Responsive styles */
@media (max-width: 768px) {
    .home-truths-form-container {
        padding: 1.5rem;
    }
    
    .home-truths-form-container h2 {
        font-size: 24px;
    }
    
    .home-truths-form label {
        font-size: 18px;
    }
    
    .home-truths-form .submit-btn {
        font-size: 22px;
    }
    
    .category-selector {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .home-truths-form input,
    .home-truths-form textarea,
    .home-truths-form select {
        width: 100%;
    }
    
    /* Show mobile instructions only on mobile devices */
    .map-mobile-instruction {
        display: block;
    }
    
    .map-instruction {
        display: none; /* Hide desktop instructions on mobile */
    }
    
    /* Make story cards more touch-friendly on mobile */
    .story-card {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .story-card h3 {
        font-size: 1.6rem;
    }
    
    .read-more {
        display: inline-block;
        padding: 10px 15px;
        margin-top: 10px;
        background-color: #171615;
        color: #B3FF00 !important;
        text-decoration: none !important;
        border: 1px solid #B3FF00;
    }
    
    .custom-marker {
        transform: scale(1.5);
    }
    
    /* Improve map touch area */
    .leaflet-marker-icon {
        padding: 10px;
        margin-left: -10px !important;
        margin-top: -10px !important;
    }
    
    /* Make popup more readable on mobile */
    .leaflet-popup-content {
        font-size: 14px;
        line-height: 1.5;
        min-width: 200px;
    }
    
    /* Search widget mobile styles */
    .search-input-group {
        flex-direction: column;
    }
    
    .home-truths-search-button {
        width: 100%;
    }
    
    /* Make sure Leaflet gesture handling is visible on top of other elements */
    .leaflet-gesture-handling-touch-warning,
    .leaflet-gesture-handling-scroll-warning {
        z-index: 1500 !important;
    }
}

/* Help hint for mobile users */
.mobile-map-touch-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0,0,0,0.7);
    color: #B3FF00;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    z-index: 1000;
    pointer-events: none;
    animation: fadeOut 5s forwards;
    max-width: 80%;
}

/* Custom checkbox styling to match site theme */
.anonymous-option input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 1px solid #f2f2f2;
    border-radius: 0px;
    background-color: #222222;
    position: relative;
    margin-right: 10px;
    cursor: pointer;
    vertical-align: middle;
}

.anonymous-option input[type="checkbox"]:checked {
    background-color: #B3FF00;
    border-color: #B3FF00;
}

.anonymous-option input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 7px;
    width: 6px;
    height: 10px;
    border: solid #171615;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.anonymous-option input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(179, 255, 0, 0.3);
}

.anonymous-option label.checkbox-label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    font-size: 16px;
    color: #f2f2f2;
}

/* For Elementor form widget - ensure consistent styling */
.elementor-widget-home_truths_form .anonymous-option input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 1px solid #f2f2f2;
    border-radius: 0px;
    background-color: #222222;
}

.elementor-widget-home_truths_form .anonymous-option input[type="checkbox"]:checked {
    background-color: #B3FF00;
    border-color: #B3FF00;
}

/* Fix for map container on mobile */
.home-truths-map {
    min-height: 300px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    touch-action: manipulation; /* Optimize for touch */
}

/* Fix iOS 100vh issue */
:root {
    --real-vh: 1vh;
}

@supports (-webkit-touch-callout: none) {
    .home-truths-map[style*="height: 100vh"] {
        height: calc(var(--real-vh) * 100) !important;
    }
}

/* Make sure elementor widgets work correctly with gesture handling */
.elementor-widget-home_truths_map .leaflet-gesture-handling-touch-warning,
.elementor-widget-home_truths_form .leaflet-gesture-handling-touch-warning {
    z-index: 1500 !important;
}

/**
 * Fixes for map marker styling and mobile rendering
 */

/* Fix for zoom control buttons */
.leaflet-control-zoom a {
    text-decoration: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    height: 30px;
    width: 30px;
}

/* Fix for markers on mobile */
.custom-marker {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
}

.custom-marker div, 
.custom-marker svg {
    display: block !important;
}

/* Ensure markers are properly sized and centered */
@media (max-width: 768px) {
    .custom-marker {
        transform: scale(1.2);
    }
    
    .leaflet-marker-icon {
        margin-left: -7px !important;
        margin-top: -7px !important;
    }
    
    /* Fix for narrow vertical white rectangles */
    .custom-marker div {
        width: 14px !important;
        height: 14px !important;
        border-radius: 7px !important;
        display: block !important;
    }
}

/* Improved gesture handling visibility */
.leaflet-gesture-handling-touch-warning,
.leaflet-gesture-handling-scroll-warning {
    z-index: 1500 !important;
    padding: 10px 15px !important;
    background-color: rgba(23, 22, 21, 0.9) !important;
    transition: opacity 0.3s ease-in-out;
}

/* Fix leaflet container for better touch handling */
.leaflet-container {
    background: #222 !important;
    outline: 0;
}

/* Ensure leaflet panes are properly positioned */
.leaflet-pane {
    z-index: 1;
}

/* Fix gesture handling for Elementor widgets */
.elementor-widget-home_truths_map .leaflet-container,
.elementor-widget-home_truths_form .leaflet-container {
    touch-action: none !important;
}

/* Mobile touch hint styling */
.mobile-map-touch-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0,0,0,0.7);
    color: #B3FF00;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    z-index: 1500;
    pointer-events: none;
    animation: fadeOut 5s forwards;
    max-width: 80%;
    white-space: nowrap;
    font-family: 'articulat', sans-serif;
}

/* Fix marker colors on mobile */
.marker-firsts div,
.marker-lasts div,
.marker-huge-life-moment div {
    background-color: #B3FF00 !important;
}