/* Frontend Styles for EV Map Plugin */

.ev-map-container {
    margin: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.ev-map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    font-size: 16px;
    color: #666;
    transition: opacity 0.3s ease;
    min-height: 300px;
}

.ev-loading-animation {
    margin-bottom: 15px;
}

.ev-spinner-container {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ev-spinner-ring {
    position: absolute;
    border: 3px solid transparent;
    border-radius: 50%;
    animation: ev-spin 2s linear infinite;
}

.ev-spinner-ring:nth-child(1) {
    width: 100px;
    height: 100px;
    border-top: 3px solid #007cba;
    border-right: 3px solid #007cba;
    animation-duration: 1.5s;
}

.ev-spinner-ring:nth-child(2) {
    width: 80px;
    height: 80px;
    border-bottom: 3px solid #f5af22;
    border-left: 3px solid #f5af22;
    animation-duration: 2s;
    animation-direction: reverse;
}

.ev-spinner-ring:nth-child(3) {
    width: 60px;
    height: 60px;
    border-top: 2px solid #28a745;
    border-right: 2px solid #28a745;
    animation-duration: 1s;
}

.ev-loading-icon {
    font-size: 24px;
    animation: ev-pulse 1.5s ease-in-out infinite;
    z-index: 1;
}

@keyframes ev-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes ev-pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.1);
        opacity: 0.7;
    }
}

.ev-map-loading-overlay .loading-text {
    font-weight: 500;
    color: #007cba;
    text-align: center;
    animation: ev-text-glow 2s ease-in-out infinite;
}

@keyframes ev-text-glow {
    0%, 100% { color: #007cba; }
    50% { color: #f5af22; }
}

/* Responsive loading overlay */
@media (max-width: 768px) {
    .ev-map-loading-overlay {
        min-height: 250px;
    }
    
    .ev-spinner-container {
        width: 80px;
        height: 80px;
    }
    
    .ev-spinner-ring:nth-child(1) {
        width: 70px;
        height: 70px;
    }
    
    .ev-spinner-ring:nth-child(2) {
        width: 56px;
        height: 56px;
    }
    
    .ev-spinner-ring:nth-child(3) {
        width: 42px;
        height: 42px;
    }
    
    .ev-loading-icon {
        font-size: 18px;
    }
}

/* Map containers - isolated from other scripts */
#ev-frontend-map,
#ev-frontend-map-v2 {
    /* Prevent other scripts from interfering */
    pointer-events: auto !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

/* Ensure Leaflet controls work properly */
#ev-frontend-map .leaflet-control,
#ev-frontend-map-v2 .leaflet-control {
    pointer-events: auto !important;
}

#ev-frontend-map {
    border: none;
    border-radius: 8px 8px 0 0;
    height: 400px;
    width: 100%;
    position: relative;
    z-index: 1;
    overflow: hidden;
    touch-action: pan-x pan-y;
    isolation: isolate; /* Isolate from other scripts */
    transform: translateZ(0); /* Force hardware acceleration */
    will-change: transform; /* Optimize for transformations */
    cursor: grab;
}

#ev-frontend-map:active {
    cursor: grabbing;
}

#ev-frontend-map-v2 {
    border: none;
    border-radius: 8px;
    height: 500px;
    width: 100%;
    position: relative;
    z-index: 1;
    overflow: hidden;
    touch-action: pan-x pan-y;
}

.ev-map-info-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    padding: 20px;
    border-radius: 0 0 8px 8px;
    
    /* Continuous breathing animation - slower and subtle */
    animation: gentleBreath 8s ease-in-out infinite;
    
    /* Subtle hover effect */
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* .ev-map-info-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 123, 186, 0.15);
    border-color: #007cba;
} */

/* Subtle background animation */
.ev-map-info-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 123, 186, 0.05),
        transparent
    );
    transition: left 0.8s ease;
}

.ev-map-info-panel:hover::before {
    left: 100%;
}

/* Animation keyframes */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Breathing animation - continuous and slower */
@keyframes gentleBreath {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
        transform: scale(1.005);
        box-shadow: 0 6px 16px rgba(0, 123, 186, 0.15);
    }
}

.ev-map-info-content h4 {
    margin: 0 0 8px 0;
    color: #007cba;
    font-size: 1.3em;
    font-weight: 600;
    
    /* Text appear animation */
    animation: fadeInDown 0.8s ease-out 0.2s both;
    
    /* Simple hover effect */
    transition: all 0.3s ease;
}

.ev-map-info-content h4:hover {
    color: #0056b3;
    transform: translateX(3px);
}

.ev-map-info-content h5 {
    margin: 0 0 15px 0;
    color: #555;
    font-size: 1.1em;
    font-weight: 500;
    
    /* Text appear animation with delay */
    animation: fadeInDown 0.8s ease-out 0.4s both;
    
    transition: color 0.3s ease;
}

.ev-map-info-content h5:hover {
    color: #007cba;
}

.ev-map-info-content p {
    margin: 0;
    color: #666;
    line-height: 1.6;
    
    /* Text appear animation with longer delay */
    animation: fadeInUp 0.8s ease-out 0.6s both;
    
    transition: color 0.3s ease;
}

.ev-map-info-content p:hover {
    color: #333;
}

/* Text animation keyframes */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Icon animation for bullet points */
/* .ev-map-info-content p::before {
    content: '💡';
    margin-right: 8px;
    animation: bounce 2s ease-in-out infinite;
    display: inline-block;
} */

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-3px);
    }
    60% {
        transform: translateY(-2px);
    }
}

/* Pulse animation for interactive elements */
/* @keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
} */

/* Smooth focus states for accessibility */
/* .ev-map-info-panel:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 123, 186, 0.15);
} */

.ev-map-info-content .location-details {
    margin-top: 15px;
}

.ev-map-info-content .location-details div {
    margin-bottom: 8px;
}

.ev-map-info-content .location-details strong {
    color: #333;
    display: inline-block;
    min-width: 80px;
}

.ev-map-info-content .location-link {
    color: #007cba;
    text-decoration: none;
}

.ev-map-info-content .location-link:hover {
    text-decoration: underline;
}

/* Custom marker popup styles */
.leaflet-popup-content {
    margin: 13px 19px;
    line-height: 1.4;
}

.leaflet-popup-content h4 {
    margin: 0 0 10px 0;
    color: #333;
}

.leaflet-popup-content .popup-address {
    margin: 5px 0;
    color: #666;
    font-size: 0.9em;
}

.leaflet-popup-content .popup-contact {
    margin: 8px 0;
    font-size: 0.9em;
}

.leaflet-popup-content .popup-contact a {
    color: #007cba;
    text-decoration: none;
}

.leaflet-popup-content .popup-contact a:hover {
    text-decoration: underline;
}

/* Loading state */
.ev-map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    background: #f9f9f9;
    color: #666;
    border-radius: 8px;
}

.ev-map-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .ev-map-container {
        margin: 15px 0;
    }
    
    .ev-map-info-panel {
        padding: 15px;
    }
    
    .ev-map-info-content h3 {
        font-size: 1.1em;
    }
    
    #ev-frontend-map {
        height: 300px !important;
    }
}

@media (max-width: 480px) {
    .ev-map-container {
        margin: 10px 0;
        border-radius: 4px;
    }
    
    #ev-frontend-map {
        border-radius: 4px 4px 0 0;
    }
    
    .ev-map-info-panel {
        border-radius: 0 0 4px 4px;
        padding: 12px;
    }
}

/* Modal de Marcação */
.ev-booking-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ev-booking-modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.ev-booking-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.ev-booking-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.ev-booking-modal-close {
    font-size: 24px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    background: none;
    border: none;
}

.ev-booking-modal-close:hover {
    color: #333;
}

.ev-booking-modal-body {
    padding: 20px;
}

.ev-booking-workshop-info {
    background: #f0f7ff;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #007cba;
}

.ev-booking-workshop-info h4 {
    margin: 0 0 5px 0;
    color: #007cba;
    font-size: 16px;
}

.ev-booking-workshop-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.ev-booking-field {
    margin-bottom: 15px;
}

.ev-booking-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.ev-booking-field input,
.ev-booking-field select,
.ev-booking-field textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.ev-booking-field input:focus,
.ev-booking-field select:focus,
.ev-booking-field textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.ev-booking-field textarea {
    resize: vertical;
    min-height: 80px;
}

.ev-booking-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.ev-booking-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ev-booking-btn-cancel {
    background: #f5f5f5;
    color: #666;
}

.ev-booking-btn-cancel:hover {
    background: #e0e0e0;
}

.ev-booking-btn-submit {
    background: #007cba;
    color: #fff;
}

.ev-booking-btn-submit:hover {
    background: #005a85;
}

.ev-booking-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Botão de marcação no popup */
.ev-book-appointment-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
    max-width: 200px;
}

.ev-book-appointment-btn:hover {
    background: linear-gradient(135deg, #218838, #1ea87a);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.4);
}

.ev-book-appointment-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

/* Estilo para popups do Leaflet */
.leaflet-popup-content {
    margin: 15px 20px !important;
    line-height: 1.6 !important;
}

.popup-services {
    margin: 5px 0;
    font-size: 13px;
}

.popup-contact {
    margin: 8px 0;
    font-size: 14px;
}

.popup-contact a {
    color: #007cba;
    text-decoration: none;
}

.popup-contact a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .ev-booking-modal-content {
        width: 95%;
        margin: 20px auto;
    }
    
    .ev-booking-modal-header,
    .ev-booking-modal-body {
        padding: 15px;
    }
    
    .ev-booking-actions {
        flex-direction: column;
    }
    
    .ev-booking-btn {
        width: 100%;
    }
}

/* Modal styling and animations */
@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ensure modals are always on top */
#ev-contact-modal,
#ev-contact-modal-v2 {
    position: fixed !important;
    z-index: 999999 !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    overflow-y: auto !important;
}

/* Modal content styling */
#ev-contact-modal > div,
#ev-contact-modal-v2 > div {
    position: relative !important;
    z-index: 1000000 !important;
}

#ev-contact-modal input:focus, 
#ev-contact-modal textarea:focus,
#ev-contact-modal-v2 input:focus, 
#ev-contact-modal-v2 textarea:focus {
    outline: none !important;
    border-color: #007cba !important;
    box-shadow: 0 0 0 3px rgba(0,123,186,0.1) !important;
}

#ev-close-modal:hover,
#ev-close-modal-v2:hover {
    background: rgba(255,255,255,0.1) !important;
    transform: scale(1.1);
}

#ev-cancel-contact:hover,
#ev-cancel-contact-v2:hover {
    background: #e8eaed !important;
}

#ev-submit-contact:hover,
#ev-submit-contact-v2:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,123,186,0.4) !important;
}

/* Prevent scrolling on body when modal is open */
body.ev-modal-open {
    overflow: hidden !important;
}

/* V2 Responsive Design */
@media (max-width: 768px) {
    .ev-map-v2-container {
        flex-direction: column !important;
    }
    
    .ev-map-v2-details-section {
        flex: 1 !important;
        min-width: auto !important;
    }
    
    /* Hide banner on mobile devices */
    #ev-workshop-banner {
        display: none !important;
    }
    
    #ev-contact-modal > div,
    #ev-contact-modal-v2 > div {
        margin: 5% auto !important;
        width: 90% !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
    
    #ev-contact-modal .ev-form-buttons,
    #ev-contact-modal-v2 .ev-form-buttons {
        flex-direction: column !important;
    }
    
    #ev-contact-modal .ev-form-buttons button,
    #ev-contact-modal-v2 .ev-form-buttons button {
        width: 100% !important;
        margin: 5px 0 !important;
    }
}

/* Contact workshop button hover effect */
#ev-contact-workshop-btn:hover {
    background: #0b335e !important;
    transform: translateY(-1px);
}
