/**
 * Base styling for IEM Widgets
 * Premium aesthetics, responsive, vanilla CSS
 */

:root {
    --iem-primary: #6366f1;
    --iem-primary-hover: #4f46e5;
    --iem-bg: #f8fafc;
    --iem-surface: #ffffff;
    --iem-text: #0f172a;
    --iem-text-muted: #64748b;
    --iem-border: #e2e8f0;
    --iem-radius: 12px;
    --iem-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --iem-shadow-hover: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --iem-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Map Widget */
.iem-map-container {
    width: 100%;
    min-height: 400px;
    background-color: var(--iem-border);
    border-radius: var(--iem-radius);
    overflow: hidden;
    box-shadow: var(--iem-shadow);
    z-index: 1; /* Leaflet needs this sometimes */
}

/* Search Widget */
.iem-search-container {
    width: 100%;
    margin-bottom: 20px;
    position: relative;
}

.iem-search-input {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    color: var(--iem-text);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--iem-border);
    border-radius: 30px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--iem-shadow);
    transition: var(--iem-transition);
    outline: none;
    font-family: 'Inter', system-ui, sans-serif;
}

.iem-search-input:focus {
    border-color: var(--iem-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    background: var(--iem-surface);
}

/* Integrated Event List & Table */
.iem-integrated-list {
    background: var(--iem-surface);
    box-shadow: var(--iem-shadow);
    overflow: hidden;
    font-family: 'Inter', system-ui, sans-serif;
}

/* Filters Header Box */
.iem-list-header-box {
    background: #612f9b; /* Purple from reference */
    padding: 10px 20px;
    color: #ffffff;
}

.iem-list-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}
.iem-filter-item {
    display: flex;
    flex-direction: column;
}
.iem-filter-item label {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.9);
}
.iem-filter-item input,
.iem-filter-item select {
    padding: 10px;
    border-radius: 20px;
    border: none;
    font-size: 0.85rem;
    outline: none;
    font-weight: 600;
    color: #4b5563;
}
.iem-btn-limpar {
    background: transparent;
    color: #fcd34d; /* yellow text */
    border: none;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
}
.iem-btn-limpar:hover {
    text-decoration: underline;
}

/* Events Table */
.iem-table-responsive {
    overflow-x: auto;
}
.iem-events-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.75rem;
    margin-bottom: 0;
}
.iem-events-table th {
    background: #ec4899; /* Pink header */
    color: #ffffff;
    padding: 8px 12px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.7rem;
    white-space: nowrap;
}
.iem-events-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
    color: #4b5563;
}
.iem-events-table tr:nth-child(even) {
    background-color: #f9fafb;
}
.iem-events-table tr:hover {
    background-color: #f3f4f6;
}

/* Past Events Greyed Out Styling */
.iem-events-table tr.iem-tr-past {
    background-color: #f3f4f6 !important;
    opacity: 0.55;
}
.iem-events-table tr.iem-tr-past td {
    color: #9ca3af !important;
}
.iem-events-table tr.iem-tr-past .iem-td-title strong,
.iem-events-table tr.iem-tr-past .iem-td-time strong {
    color: #9ca3af !important;
}
.iem-events-table tr.iem-tr-past .iem-btn-mapa {
    color: #9ca3af !important;
}
.iem-events-table tr.iem-tr-past .iem-table-cat-badge {
    opacity: 0.5;
    filter: grayscale(100%);
}

.iem-venue-popup-item.iem-popup-item-past {
    opacity: 0.55;
    background-color: #e5ded0 !important;
}
.iem-venue-popup-item.iem-popup-item-past strong {
    color: #71717a !important;
}
.iem-venue-popup-item.iem-popup-item-past span {
    color: #9ca3af !important;
}
.iem-td-title strong {
    color: #612f9b;
    font-size: 0.85rem;
}
.iem-td-time strong {
    color: #612f9b;
}
.iem-table-cat-badge, .iem-modal-badge {
    background: transparent;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 800;
    display: inline-block;
    white-space: nowrap;
    text-transform: uppercase;
    border: 1px solid currentColor;
}
.iem-btn-mapa {
    background: transparent;
    color: #ec4899;
    font-weight: 800;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    transition: color 0.2s;
}
.iem-btn-mapa:hover {
    color: #db2777;
    text-decoration: underline;
}
.iem-no-results {
    text-align: center;
    padding: 30px !important;
    font-size: 1rem;
    color: #6b7280;
}

/* Pagination */
.iem-list-pagination {
    background: #f3f4f6;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e5e7eb;
}
.iem-btn-page {
    background: #612f9b;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}
.iem-btn-page:hover:not(:disabled) {
    background: #4c1d95;
}
.iem-btn-page:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}
#iem-page-info {
    font-size: 0.85rem;
    color: #4b5563;
}
#iem-page-info strong {
    color: #111827;
}

/* Modal Evento */
.iem-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.iem-modal-container {
    background: #fbf8ee;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    border-radius: 18px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    font-family: 'Kurdis', system-ui, sans-serif !important;
}
.iem-modal-header-orange {
    background-color: #FF691F;
    color: #ffffff;
    padding: 24px 24px 20px 24px;
    position: relative;
    font-family: 'Kurdis', system-ui, sans-serif !important;
}
.iem-modal-close-white {
    position: absolute;
    top: 14px;
    right: 18px;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.9;
    transition: opacity 0.2s;
    font-weight: bold;
}
.iem-modal-close-white:hover {
    opacity: 1;
}
.iem-modal-header-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    padding-right: 25px;
}
.iem-modal-title-kurdis {
    font-family: 'Kurdis', system-ui, sans-serif !important;
    font-size: 1.85rem;
    font-weight: 900;
    color: #111827;
    margin: 0;
    text-transform: uppercase;
    line-height: 1.1;
    letter-spacing: 0.5px;
}
.iem-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.iem-header-action-btn {
    background: transparent !important;
    border: none !important;
    color: #111827 !important;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1 !important;
    text-decoration: none !important;
    box-shadow: none !important;
    outline: none !important;
}
.iem-header-action-btn:hover,
.iem-header-action-btn:focus,
.iem-header-action-btn:active {
    background: transparent !important;
    color: #111827 !important;
    opacity: 1 !important;
    transform: none !important;
    box-shadow: none !important;
}
.iem-modal-header-subrow {
    font-family: 'Kurdis', system-ui, sans-serif !important;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.iem-modal-header-badges-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.iem-modal-cat-pill {
    background-color: transparent !important;
    color: #111827 !important;
    border: 1.5px solid #111827 !important;
    padding: 3px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    box-shadow: none !important;
    font-family: 'Kurdis', system-ui, sans-serif !important;
}
.iem-modal-rating-square {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 900;
    font-family: 'Kurdis', system-ui, sans-serif !important;
    box-shadow: none;
}
.iem-modal-body-beige {
    background-color: #fbf8ee;
    padding: 24px;
    color: #2d3748;
    overflow-y: auto;
    max-height: 60vh;
}
.iem-modal-description {
    font-family: 'Kurdis', system-ui, sans-serif !important;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #2d3748;
}

/* Popup Hover & Saiba Mais Btn */
.iem-hover-popup {
    text-align: center;
    padding: 5px;
}
.iem-hover-popup strong {
    display: block;
    font-size: 1.1rem;
    color: #111827;
    margin-bottom: 5px;
}
.iem-hover-popup p {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 15px;
    line-height: 1.4;
}
.iem-saiba-mais-btn {
    background: #3b82f6;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}
.iem-saiba-mais-btn:hover {
    background: #2563eb;
}

/* Venue Marker & Badge */
.iem-venue-icon-wrapper {
    background: transparent;
    border: none;
}
.iem-custom-venue-marker {
    position: relative;
    width: 32px;
    height: 32px;
}
.iem-custom-venue-marker img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0px 2px 4px rgba(0,0,0,0.4));
}
.iem-marker-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: #fbbf24; /* yellow badge */
    color: #111827;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
}

/* Venue Popup (Blue Header & Beige List) */
.iem-venue-popup {
    min-width: 220px;
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
    font-family: 'Kurdis', system-ui, sans-serif !important;
}
.iem-venue-popup-header {
    background-color: #0ba6d8; /* Blue header */
    color: #ffffff;
    padding: 12px;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.iem-venue-popup-header span {
    text-transform: uppercase;
}
.iem-venue-popup-divider {
    width: 2px;
    height: 18px;
    background-color: #067c9f; /* Darker blue */
    border-radius: 1px;
}
.iem-venue-popup-list {
    max-height: 200px;
    overflow-y: auto;
    background: #f3ebd7; /* Beige background */
}
.iem-venue-popup-item {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
}
.iem-venue-popup-item:last-child {
    border-bottom: none;
}
.iem-venue-popup-item:hover {
    background: #e9dec3;
}
.iem-popup-date {
    display: block;
    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 2px;
}
.iem-venue-popup-item strong {
    display: block;
    color: #111827;
    font-size: 13px;
}

/* Override Leaflet default popup padding for our custom popup */
.leaflet-popup-content-wrapper {
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
}
.leaflet-popup-content {
    margin: 0;
    width: 100% !important;
}
.leaflet-container a.leaflet-popup-close-button {
    display: none !important;
}
.leaflet-container a.leaflet-popup-close-button:hover {
    color: #f3f4f6 !important;
}
.leaflet-popup-tip {
    background: #f3ebd7 !important;
}

/* Directions Buttons */
.iem-btn-directions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff !important;
    transition: opacity 0.2s;
}
.iem-btn-directions:hover {
    opacity: 0.9;
}
.iem-btn-waze {
    background-color: #33ccff;
}
.iem-btn-gmaps {
    background-color: #34a853;
}
.iem-btn-amaps {
    background-color: #000000;
}

/* Share Buttons */
.iem-btn-share {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff !important;
    transition: opacity 0.2s;
}
.iem-btn-share:hover {
    opacity: 0.9;
}
.iem-btn-whatsapp { background-color: #25D366; }
.iem-btn-instagram { background-color: #E1306C; }
.iem-btn-x { background-color: #000000; }
.iem-btn-facebook { background-color: #1877F2; }
.iem-btn-linkedin { background-color: #0A66C2; }
.iem-btn-email { background-color: #6b7280; }

/* Animated User Location Marker */
.iem-user-location-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}
.iem-user-dot {
    width: 14px;
    height: 14px;
    background-color: #2563eb;
    border: 2px solid #ffffff;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.iem-user-pulse {
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: rgba(37, 99, 235, 0.4);
    border-radius: 50%;
    z-index: 1;
    animation: iem-pulse-animation 2s infinite ease-out;
}
@keyframes iem-pulse-animation {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}
