/* Crescina Event Map Styles */

/* Main Container */
#crescina-event-map-container {
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Filters Section */
.cem-filters {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.cem-filters label {
    display: inline-block;
    margin-right: 10px;
    font-weight: 600;
    color: #495057;
}

.cem-filters select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    min-width: 200px;
}

.cem-filters select:focus {
    outline: none;
    border-color: #AF272F;
    box-shadow: 0 0 0 2px rgba(175, 39, 47, 0.2);
}

/* Map Container */
#cem-map {
    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Events List Section */
#cem-events-list {
    margin-top: 30px;
}

#cem-events-list h3 {
    color: #333;
    border-bottom: 2px solid #AF272F;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* Events Grid */
.cem-events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.cem-event-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cem-event-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cem-event-item h4 {
    color: #AF272F;
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
}

.cem-event-item p {
    margin: 8px 0;
    color: #666;
    line-height: 1.5;
}

.cem-event-item strong {
    color: #333;
}

.cem-view-details {
    background: #AF272F;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin-top: 15px;
    transition: background-color 0.2s ease;
}

.cem-view-details:hover {
    background: #8B1E26;
}

.cem-view-details:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(175, 39, 47, 0.3);
}

/* Modal Styles */
.cem-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.cem-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cem-close {
    position: absolute;
    right: 15px;
    top: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.cem-close:hover,
.cem-close:focus {
    color: #000;
    background-color: #f0f0f0;
}

#cem-modal-body {
    padding: 30px;
    padding-top: 50px;
}

.cem-modal-event-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.cem-modal-event-logo {
    max-width: 150px;
    height: auto;
    margin-bottom: 15px;
    border-radius: 8px;
}

.cem-modal-event-title {
    color: #AF272F;
    font-size: 24px;
    margin: 0;
    font-weight: 600;
}

.cem-modal-event-details {
    display: grid;
    gap: 15px;
}

.cem-modal-detail-item {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.cem-modal-detail-label {
    font-weight: 600;
    color: #495057;
    min-width: 100px;
    margin-right: 15px;
}

.cem-modal-detail-value {
    color: #666;
    flex: 1;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 15px;
    line-height: 1.5;
}

.cem-popup-title {
    color: #AF272F;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
}

.cem-popup-info {
    color: #666;
    font-size: 14px;
    margin: 4px 0;
}

.cem-popup-button {
    background: #AF272F;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 8px;
}

.cem-popup-button:hover {
    background: #8B1E26;
}

/* Loading State */
.cem-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.cem-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #AF272F;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .cem-events-grid {
        grid-template-columns: 1fr;
    }

    .cem-modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .cem-filters {
        text-align: center;
    }

    .cem-filters label {
        display: block;
        margin-bottom: 8px;
    }

    .cem-filters select {
        width: 100%;
        max-width: 300px;
    }

    .cem-modal-detail-item {
        flex-direction: column;
    }

    .cem-modal-detail-label {
        margin-bottom: 5px;
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    #cem-modal-body {
        padding: 20px;
        padding-top: 40px;
    }

    .cem-modal-event-title {
        font-size: 20px;
    }
}

/* Hidden class for filtering */
.cem-hidden {
    display: none !important;
}

/* Error states */
.cem-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
}

.cem-no-events {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* Calendar Styles */
#cem-calendar-container {
    margin: 20px 0;
}

#cem-calendar-container h3 {
    color: #AF272F;
    margin-bottom: 20px;
    font-size: 1.5em;
    font-weight: 600;
}

.cem-calendar-wrapper {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.cem-calendar-month {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cem-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.cem-calendar-header.no-nav {
    justify-content: center;
}

.cem-spacer {
    width: 30px;
    height: 30px;
    display: inline-block;
}

.cem-calendar-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

.cem-calendar-prev,
.cem-calendar-next {
    background: #AF272F;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.cem-calendar-prev:hover,
.cem-calendar-next:hover {
    background: #8a1f26;
}

.cem-calendar-days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 5px;
}

.cem-calendar-day-name {
    text-align: center;
    font-size: 0.8em;
    font-weight: 600;
    color: #666;
    padding: 8px 4px;
    background: #f8f9fa;
}

.cem-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.cem-calendar-date {
    background: #fff;
    padding: 8px 4px;
    text-align: center;
    cursor: default;
    position: relative;
    min-height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.cem-calendar-date.other-month {
    background: #f8f9fa;
    color: #adb5bd;
}

.cem-calendar-date.today {
    background: #e3f2fd;
    font-weight: 600;
}

.cem-calendar-date.has-events {
    background: #AF272F;
    color: white;
    cursor: pointer;
    font-weight: 600;
}

.cem-calendar-date.has-events:hover {
    background: #8a1f26;
}

.cem-calendar-date .date-number {
    font-size: 0.9em;
}

.cem-calendar-date .event-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #fff;
    color: #AF272F;
    font-size: 0.7em;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.cem-calendar-date.has-events .event-indicator {
    background: rgba(255, 255, 255, 0.9);
    color: #AF272F;
}

/* Event Selection Modal Styles */
.cem-modal-event-list {
    max-height: 400px;
    overflow-y: auto;
}

.cem-event-selection-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.cem-event-selection-item:hover {
    background: #f8f9fa;
    border-color: #AF272F;
}

.cem-event-selection-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-right: 15px;
    border-radius: 4px;
}

.cem-event-selection-info {
    flex: 1;
}

.cem-event-selection-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.cem-event-selection-farmacia {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 2px;
}

.cem-event-selection-location {
    color: #888;
    font-size: 0.8em;
}

/* Responsive Calendar */
@media (max-width: 768px) {
    .cem-calendar-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    
    .cem-calendar-month {
        min-width: 100%;
        max-width: 100%;
    }
    
    .cem-calendar-date {
        min-height: 35px;
        padding: 6px 2px;
    }
    
    .cem-calendar-date .date-number {
        font-size: 0.8em;
    }
    
    .cem-calendar-date .event-indicator {
        width: 14px;
        height: 14px;
        font-size: 0.6em;
    }
}
