/**
 * EventsMap Component Styles
 * 
 * Mobile-first: Bottom sheet (Google Maps style)
 * Desktop: Floating card
 */

/* Container with scoped CSS variables */
.events-map-container {
    --map-height: 100vh;
    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.15);
    --filter-active-bg: #3b82f6;
    --filter-bg: #ffffff;
    --filter-text: #374151;
    --sheet-height-collapsed: 100px;
    --sheet-height-expanded: 320px;
    --sheet-height-full: calc(100vh - 160px);
    --transition-speed: 0.3s;
}

/* Map container - full screen */
#events-map {
    width: 100vw;
    height: var(--map-height);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Find in This Area Button */
.search-location-btn {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #3b82f6;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 24px;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    display: none;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
}

.search-location-btn:hover {
    background: #2563eb;
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.search-location-btn:active {
    transform: translateX(-50%) translateY(0);
}

/* Date filter dropdown */
.map-filters {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
}

.filter-dropdown {
    position: relative;
}

.dropdown-trigger {
    background: var(--filter-bg);
    border: none;
    padding: 8px 16px;
    border-radius: 24px;
    box-shadow: 0 2px 8px var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--filter-text);
    transition: all 0.2s ease;
}

.dropdown-trigger:hover {
    box-shadow: 0 4px 12px var(--card-shadow);
    transform: translateY(-1px);
}

.dropdown-arrow {
    transition: transform 0.2s ease;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--filter-bg);
    border-radius: 12px;
    box-shadow: 0 4px 16px var(--card-shadow);
    padding: 4px;
    z-index: 1000;
    min-width: 140px;
    animation: dropdownSlideIn 0.2s ease;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--filter-text);
    transition: background 0.15s ease;
}

.dropdown-menu button:hover {
    background: #f3f4f6;
}

/* Custom marker styles */
.custom-event-marker {
    background: transparent;
    border: none;
    position: relative;
}

.marker-pin {
    background: var(--filter-active-bg);
    width: 36px;
    height: 36px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.marker-icon {
    transform: rotate(45deg);
    font-size: 18px;
    display: block;
}

.custom-event-marker.highlighted .marker-pin {
    transform: rotate(-45deg) scale(1.2);
    background: #ef4444;
}

/* Event count badge */
.event-count-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
    z-index: 10;
}

/* Venue hover tooltip */
.venue-tooltip {
    background: rgba(0, 0, 0, 0.9) !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.venue-tooltip::before {
    border-top-color: rgba(0, 0, 0, 0.9) !important;
}

.tooltip-venue-name {
    color: white;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
}

.tooltip-icons {
    font-size: 16px;
    text-align: center;
    letter-spacing: 4px;
}

/* User Location Marker */
.user-location-marker {
    background: transparent;
    border: none;
}

.user-location-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: #3b82f6;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    z-index: 2;
}

.user-location-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    z-index: 1;
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.3;
    }
}

/* ========================================
   Manila Folder Tab (Both Mobile & Desktop)
   ======================================== */

.close-tab {
    position: absolute;
    top: -36px;
    right: 20px;
    width: 44px;
    height: 36px;
    background: var(--card-bg);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11;
}

.close-btn {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #374151;
}

/* ========================================
   MOBILE: Bottom Sheet (Google Maps style)
   ======================================== */

@media (max-width: 768px) {
    .event-card-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--card-bg);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -4px 16px var(--card-shadow);
        z-index: 1000;
        max-height: 60vh;
        overflow: visible;
        animation: slideUpMobile 0.3s ease;
    }
    
    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    /* Hide swipe handle on mobile (not needed with X button) */
    .sheet-handle {
        display: none;
    }
    
    /* Content area */
    .event-card-content {
        padding: 20px;
        overflow-y: auto;
        max-height: calc(60vh - 40px);
    }
    
    /* Adjust dropdown positioning on mobile */
    .map-filters {
        top: 60px;
    }
    
    .search-location-btn {
        top: 10px;
        padding: 8px 20px;
        font-size: 13px;
    }
    
    .dropdown-trigger {
        padding: 6px 14px;
        font-size: 13px;
    }
    
    .dropdown-menu button {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* ========================================
   DESKTOP: Floating Card
   ======================================== */

@media (min-width: 769px) {
    .event-card-container {
        position: fixed;
        bottom: 30px;
        right: 30px;
        width: 400px;
        max-width: 90vw;
        background: var(--card-bg);
        border-radius: 16px;
        box-shadow: 0 8px 24px var(--card-shadow);
        z-index: 1000;
        animation: slideUp var(--transition-speed) ease;
        max-height: 80vh;
        overflow: visible;
        transform: none !important;
    }
    
    /* Remove mobile states on desktop */
    .event-card-container.collapsed,
    .event-card-container.expanded,
    .event-card-container.full {
        transform: none !important;
    }
    
    /* Hide sheet handle on desktop */
    .sheet-handle {
        display: none !important;
    }
    
    /* Content area */
    .event-card-content {
        padding: 20px;
        overflow-y: auto;
        max-height: calc(80vh - 40px);
    }
    
    /* Slide up animation */
    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

/* ========================================
   Event Card Content (Both Mobile & Desktop)
   ======================================== */

/* Carousel Navigation */
.carousel-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
    gap: 12px;
}

.carousel-btn {
    background: #f3f4f6;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
    flex-shrink: 0;
}

.carousel-btn:hover {
    background: #e5e7eb;
    transform: scale(1.05);
}

.carousel-btn:active {
    transform: scale(0.95);
}

.carousel-indicator {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-align: center;
    flex: 1;
    white-space: nowrap;
}

.event-header h3 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.meta-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    position: relative;
}

.meta-item .icon {
    font-size: 20px;
    flex-shrink: 0;
}

.meta-item div {
    flex: 1;
}

.copy-address-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.6;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.copy-address-btn:hover {
    opacity: 1;
    background: #f3f4f6;
    border-radius: 4px;
}

.copy-address-btn.copied {
    opacity: 1;
    color: #10b981;
}

.meta-item strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

.meta-item p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

.event-actions {
    display: flex;
    gap: 10px;
}

.btn {
    flex: 1;
    padding: 12px 16px;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.no-events-message {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.no-events-message p {
    margin: 8px 0;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 480px) {
    .search-location-btn {
        padding: 6px 16px;
        font-size: 12px;
    }
    
    .dropdown-trigger {
        padding: 5px 12px;
        font-size: 12px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .events-map-container {
        --card-bg: #1f2937;
        --filter-bg: #374151;
        --filter-text: #f3f4f6;
        --card-shadow: rgba(0, 0, 0, 0.4);
    }
    
    .event-header h3,
    .meta-item strong {
        color: #f9fafb;
    }
    
    .meta-item p {
        color: #9ca3af;
    }
    
    .carousel-nav {
        border-bottom-color: #374151;
    }
    
    .carousel-btn {
        background: #374151;
        color: #e5e7eb;
    }
    
    .carousel-btn:hover {
        background: #4b5563;
    }
    
    .carousel-indicator {
        color: #9ca3af;
    }
    
    .btn-secondary {
        background: #374151;
        color: #f3f4f6;
    }
    
    .btn-secondary:hover {
        background: #4b5563;
    }
    
    .dropdown-menu button:hover {
        background: #4b5563;
    }
    
    .close-tab {
        background: var(--card-bg);
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.6);
    }
    
    .close-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #e5e7eb;
    }
}

/* ========================================
   Floating Branding & Auth UI
   ======================================== */

.explore-header-overlay {
    position: fixed;
    top: 80px;
    left: 20px;
    right: 20px;
    z-index: 998;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.explore-header-overlay > * {
    pointer-events: auto;
}

/* Logo Badge */
.logo-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.logo-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    background: rgba(0, 0, 0, 1);
}

.logo-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.logo-text {
    display: none;
}

/* User Controls Container (Avatar + Location Toggle) */
.user-controls-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

/* View Toggle Button (List/Map switcher) */
.view-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    padding: 8px 16px;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    color: #374151;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.view-toggle-btn svg {
    stroke-width: 2;
}

/* User Dropdown Container */
.user-dropdown-container {
    position: relative;
}

/* User Avatar Button */
.user-avatar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    padding: 6px 12px 6px 6px;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-avatar-btn:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
}

.dropdown-arrow {
    color: #6b7280;
}

/* Login Button (guest) */
.login-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(59, 130, 246, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    padding: 10px 20px;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: white;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.login-btn:hover {
    background: rgba(37, 99, 235, 0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Location Dropdown */
.location-dropdown-container {
    position: relative;
}

.location-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    padding: 8px 16px;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
}

.location-toggle-btn:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.location-toggle-btn .location-icon {
    font-size: 16px;
}

.location-toggle-btn .location-text {
    font-size: 13px;
}

.location-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: dropdownSlideIn 0.2s ease;
    z-index: 1002;
}

.location-dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: background 0.15s ease;
}

.location-dropdown-menu button:hover {
    background: #f3f4f6;
}

.location-dropdown-menu button.coming-soon {
    color: #9ca3af;
    cursor: default;
}

.location-dropdown-menu button.coming-soon:hover {
    background: transparent;
}

.location-dropdown-menu button small {
    font-size: 11px;
    color: #9ca3af;
    margin-left: auto;
}

.location-dropdown-menu .dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
}

/* Dropdown Menu */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: dropdownSlideIn 0.2s ease;
    z-index: 1001;
}

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

.dropdown-header {
    padding: 16px;
    background: #f9fafb;
}

.dropdown-header strong {
    display: block;
    font-size: 14px;
    color: #111827;
    margin-bottom: 2px;
}

.dropdown-header small {
    display: block;
    font-size: 12px;
    color: #6b7280;
}

.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s ease;
    width: 100%;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #f3f4f6;
}

.dropdown-item span {
    font-size: 16px;
}

.dropdown-item-form {
    margin: 0;
}

/* Desktop: Show logo text */
@media (min-width: 769px) {
    .logo-text {
        display: inline;
    }
}

/* Mobile: Adjust positioning */
@media (max-width: 768px) {
    .explore-header-overlay {
        top: 70px;
        left: 10px;
        right: 10px;
    }
    
    .logo-badge {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .logo-icon {
        width: 20px;
        height: 20px;
    }
    
    .user-dropdown-menu {
        width: 200px;
    }
    
    .location-toggle-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .location-toggle-btn .location-text {
        font-size: 12px;
    }
    
    .location-toggle-btn .location-icon {
        font-size: 14px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .logo-badge,
    .user-avatar-btn {
        background: rgba(31, 41, 55, 0.95);
        color: #f9fafb;
    }
    
    .location-toggle-btn {
        background: rgba(31, 41, 55, 0.95);
        color: #e5e7eb;
    }
    
    .location-dropdown-menu {
        background: #1f2937;
    }
    
    .location-dropdown-menu button {
        color: #e5e7eb;
    }
    
    .location-dropdown-menu button:hover {
        background: #374151;
    }
    
    .location-dropdown-menu .dropdown-divider {
        background: #374151;
    }
    
    .user-dropdown-menu {
        background: #1f2937;
    }
    
    .dropdown-header {
        background: #111827;
    }
    
    .dropdown-header strong {
        color: #f9fafb;
    }
    
    .dropdown-item {
        color: #e5e7eb;
    }
    
    .dropdown-item:hover {
        background: #374151;
    }
}
