/* Modern Map CSS with Safari Compatibility */

/* Import Iran Sans font */
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/iran-sans/dist/font-face.css');

:root {
    --map-primary: #2563eb;
    --map-secondary: #64748b;
    --map-success: #059669;
    --map-warning: #d97706;
    --map-danger: #dc2626;
    --map-info: #0891b2;
    --map-light: #f8fafc;
    --map-dark: #1e293b;
    --map-border: #e2e8f0;
    --map-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --map-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --map-radius: 0.75rem;
    --map-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-map-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 2rem 0;
}

.map-header {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: var(--map-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--map-shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.map-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--map-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.map-header .header-icon {
    background: linear-gradient(135deg, var(--map-primary), var(--map-info));
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.map-sidebar {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: var(--map-radius);
    padding: 0;
    box-shadow: var(--map-shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.map-container {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: var(--map-radius);
    overflow: hidden;
    box-shadow: var(--map-shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.map-control-btn {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--map-dark);
    box-shadow: var(--map-shadow);
    transition: var(--map-transition);
    cursor: pointer;
}

.map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.3s ease;
}

/* Custom marker styles */
.custom-marker {
    background: var(--map-primary);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: var(--map-shadow);
    transition: var(--map-transition);
}

.custom-marker:hover {
    transform: scale(1.1);
    box-shadow: var(--map-shadow-lg);
}

/* Enhanced marker styles based on categories with emoji support */
.marker-restaurant {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}
.marker-hotel {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}
.marker-attraction {
    background: linear-gradient(135deg, #10b981, #059669);
}
.marker-shopping {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}
.marker-medical {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}
.marker-education {
    background: linear-gradient(135deg, #3b82f6, #1e40af);
}
.marker-transport {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}
.marker-sport {
    background: linear-gradient(135deg, #10b981, #047857);
}
.marker-religious {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
.marker-fuel {
    background: linear-gradient(135deg, #f97316, #ea580c);
}

/* Package type marker enhancements */
.marker-diamond {
    background: linear-gradient(135deg, #a855f7, #7c3aed) !important;
    border: 3px solid #fbbf24 !important;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.6) !important;
}

.marker-gold {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    border: 3px solid #fbbf24 !important;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5) !important;
}

.marker-silver {
    background: linear-gradient(135deg, #6b7280, #4b5563) !important;
    border: 3px solid #d1d5db !important;
    box-shadow: 0 0 10px rgba(107, 114, 128, 0.4) !important;
}

.marker-bronze {
    background: linear-gradient(135deg, #92400e, #78350f) !important;
    border: 3px solid #d97706 !important;
    box-shadow: 0 0 8px rgba(146, 64, 14, 0.4) !important;
}

/* Popup styles */
.location-popup {
    font-family: 'IRANSans', sans-serif;
    min-width: 200px;
    max-width: 350px;
}

.location-popup h6 {
    margin: 0 0 8px 0;
    color: var(--map-primary);
    font-weight: bold;
}

.location-popup p {
    margin: 0 0 5px 0;
    color: var(--map-secondary);
    font-size: 12px;
}

.location-popup .rating {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 5px 0;
}

.location-popup .rating .star {
    color: #fbbf24;
}

.location-popup .package-badge {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #92400e;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    margin: 5px 0;
    display: inline-block;
}

/* Responsive design */
@media (max-width: 1024px) {
    .map-main-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .map-sidebar {
        order: 2;
        height: auto;
    }
    
    .map-container {
        order: 1;
        height: 60vh;
    }
}

@media (max-width: 768px) {
    .modern-map-container {
        padding: 1rem 0;
    }
    
    .map-header {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .map-header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .map-control-btn {
        width: 2rem;
        height: 2rem;
        font-size: 0.8rem;
    }
}

/* Animation keyframes */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.marker-pulse {
    animation: pulse 2s infinite;
}

/* Enhanced Cluster styles */
.marker-cluster {
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.marker-cluster:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.marker-cluster-small {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    width: 40px;
    height: 40px;
}

.marker-cluster-small div {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    width: 34px;
    height: 34px;
    margin: 3px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-cluster-medium {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    width: 50px;
    height: 50px;
}

.marker-cluster-medium div {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    width: 44px;
    height: 44px;
    margin: 3px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-cluster-large {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    width: 60px;
    height: 60px;
}

.marker-cluster-large div {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    width: 54px;
    height: 54px;
    margin: 3px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-cluster div span {
    color: white;
    font-weight: bold;
    font-size: 14px;
    font-family: 'IRANSans', 'Tahoma', sans-serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    direction: ltr;
    unicode-bidi: embed;
}

.marker-cluster-medium div span {
    font-size: 16px;
}

.marker-cluster-large div span {
    font-size: 18px;
}

/* Enhanced cluster hover effects */
.marker-cluster:hover {
    cursor: pointer;
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.marker-cluster:active {
    transform: scale(0.95);
}

/* Cluster click animation */
@keyframes cluster-click {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.marker-cluster.clicked {
    animation: cluster-click 0.3s ease-in-out;
}

/* Improved cluster visibility */
.marker-cluster {
    z-index: 1000;
}

.marker-cluster:before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.marker-cluster:hover:before {
    opacity: 1;
}

/* Spin animation for refresh button */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* User location marker styles */
.user-location-marker {
    z-index: 1001;
}

/* Enhanced map control buttons */
.map-control-btn {
    font-family: 'IRANSans', sans-serif;
}

.map-control-btn:active {
    transform: translateY(-1px) scale(0.95);
}

/* Filter stats styling */
.filter-stats {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-family: 'IRANSans', sans-serif;
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
}

.stat-value {
    font-size: 14px;
    color: white;
    font-weight: bold;
    background: var(--map-primary);
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 24px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-value.updated {
    animation: stat-update 0.5s ease-in-out;
}

@keyframes stat-update {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); background: #10b981; }
    100% { transform: scale(1); }
}

/* Classes to replace inline styles */
.marker-icon-style {
    background: var(--map-primary);
    border: 3px solid white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
    position: relative;
}

.marker-icon-style:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.marker-icon-style span {
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
    font-size: 16px;
    line-height: 1;
    text-shadow: none;
    filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.3));
}

.test-marker-style {
    background: red;
    border: 2px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.popup-content-style {
    font-family: 'Vazir', sans-serif;
    text-align: center;
}

.popup-title {
    margin: 0 0 5px 0;
    color: var(--map-primary);
    font-weight: bold;
}

.popup-subtitle {
    margin: 0;
    color: var(--map-secondary);
    font-size: 12px;
}

/* Map stats and info styles */
.map-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    background: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--map-dark);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.stat-item i {
    color: var(--map-primary);
}

/* Filter styles */
.filter-section {
    border-bottom: 1px solid var(--map-border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.filter-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.filter-title {
    font-weight: 600;
    color: var(--map-dark);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modern-btn {
    border-radius: 0.5rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    transition: var(--map-transition);
    border: none;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.modern-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--map-shadow-lg);
}

.modern-input, .modern-select {
    border: 2px solid var(--map-border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    transition: var(--map-transition);
    background: white;
    width: 100%;
}

.modern-input:focus, .modern-select:focus {
    border-color: var(--map-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}
