@charset "utf-8";
/**
 * RealEstateMap - Main Stylesheet with Banner System
 * สไตล์หลักสำหรับระบบแผนที่อสังหาแบบเรียลไทม์ + ระบบแบนเนอร์โฆษณา
 * รองรับ Mobile-First Design + PWA + Image Gallery + Banner Ads
 */

/* ===== Reset และ Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Sarabun', 'Prompt', sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

/* ===== Layout หลัก ===== */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== Header ===== */
.header {
    background: linear-gradient(135deg, #FF5722 0%, #E64A19 100%);
    color: white;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: white;
}

.logo i {
    font-size: 1.8rem;
    color: #FFD54F;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-primary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 8px 16px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-1px);
}

.online-users {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    opacity: 0.9;
}

.online-users i {
    color: #4CAF50;
    animation: pulse 2s infinite;
}

/* ===== Map Container ===== */
.map-container {
    flex: 1;
    margin-top: 60px;
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    background: #e8f5e8;
}

/* ===== 🔥 BANNER SYSTEM ENHANCED STYLES (FIXED) ===== */

/* 🎯 Banner Marker - ทำให้เด่นมากขึ้น */
.banner-marker {
    z-index: 700 !important;
}

.banner-marker-custom {
    background: linear-gradient(135deg, #ff1744 0%, #d50000 100%) !important;
    border-radius: 12px !important;
    width: 50px !important;
    height: 30px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 0px solid #ffffff !important;
    box-shadow: 0 6px 25px rgba(255, 23, 68, 0.6), 
                0 0 0 3px rgba(255, 23, 68, 0.3) !important;
    position: relative;
    overflow: visible;
    transition: all 0.3s ease;
    cursor: pointer;
    animation: bannerBounce 1.5s ease-in-out infinite !important;
}

/* Animation ใหม่ที่เด่นกว่า */
@keyframes bannerBounce {
    0%, 100% { 
        transform: translateY(0) scale(1); 
        box-shadow: 0 6px 25px rgba(255, 23, 68, 0.6), 
                    0 0 0 3px rgba(255, 23, 68, 0.3);
    }
    50% { 
        transform: translateY(-8px) scale(1.05); 
        box-shadow: 0 12px 35px rgba(255, 23, 68, 0.8), 
                    0 0 0 6px rgba(255, 23, 68, 0.4);
    }
}

.banner-marker-custom:hover {
    transform: scale(1.15) translateY(-5px) !important;
    box-shadow: 0 10px 35px rgba(255, 23, 68, 0.8), 
                0 0 0 5px rgba(255, 23, 68, 0.4) !important;
    animation: none !important;
}

/* ไอคอน AD ใหญ่และเด่นขึ้น */
.banner-icon {
    color: #ffffff !important;
    font-size: 20px !important;
    font-weight: bold !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
    animation: iconGlow 2s ease-in-out infinite !important;
}

@keyframes iconGlow {
    0%, 100% { 
        text-shadow: 0 2px 8px rgba(0,0,0,0.4),
                     0 0 20px rgba(255,255,255,0.6);
    }
    50% { 
        text-shadow: 0 2px 8px rgba(0,0,0,0.4),
                     0 0 30px rgba(255,255,255,0.9);
    }
}

/* Pulse Effect แยกต่างหาก */
.banner-pulse {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 30px;
    height: 30px;
    background: #ffeb3b;
    border-radius: 50%;
    border: 3px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #d50000;
    animation: bannerPulseEffect 1.5s infinite;
    box-shadow: 0 2px 10px rgba(255, 235, 59, 0.6);
}

.banner-pulse::after {
    content: 'AD';
    font-weight: bold;
}

@keyframes bannerPulseEffect {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 235, 59, 0.8);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(255, 235, 59, 0);
        transform: scale(1.1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 235, 59, 0);
        transform: scale(1);
    }
}

/* Text "โฆษณา" ใต้ไอคอน */
.banner-marker-custom::after {
    content: 'โฆษณา';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff1744;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(255, 23, 68, 0.4);
}

/* 🖼️ Banner Modal - แก้ไขรูปภาพใหญ่เกินไป */
#bannerModal .modal-content {
    max-width: 90%;
    max-height: 90vh;
    width: auto;
    margin: 5vh auto;
}

#bannerModal .modal-body {
    max-height: calc(90vh - 120px);
    overflow-y: auto;
    padding: 20px;
}

/* รูปภาพใน Banner Modal - Responsive */
.banner-image-container {
    text-align: center;
    margin-bottom: 20px;
    max-width: 100%;
    overflow: hidden;
}

.banner-image-container img {
    max-width: 100% !important;
    max-height: 60vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    display: block;
    margin: 0 auto;
}

/* Banner popup image ใน marker popup */
.banner-popup-image {
    max-width: 100% !important;
    max-height: 200px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px;
    margin: 10px auto;
    display: block;
}

/* HTML Content Container */
.banner-html-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    max-width: 100%;
}

.banner-html-container img {
    max-width: 100% !important;
    height: auto !important;
}

/* Banner Popup Styles */
.banner-popup-wrapper {
    max-width: 350px !important;
}

.banner-popup {
    min-width: 300px;
    padding: 15px;
}

.banner-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f3e5f5;
}

.banner-popup-header h4 {
    margin: 0;
    color: #7b1fa2;
    font-size: 18px;
    font-weight: 600;
}

.banner-badge {
    background: linear-gradient(135deg, #ff1744 0%, #d50000 100%);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.banner-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin: 10px 0;
}

.banner-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-view-banner {
    flex: 1;
    background: linear-gradient(135deg, #673ab7 0%, #512da8 100%);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-view-banner:hover {
    background: linear-gradient(135deg, #512da8 0%, #4527a0 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(103, 58, 183, 0.3);
}

.btn-visit-banner {
    flex: 1;
    background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-visit-banner:hover {
    background: linear-gradient(135deg, #0097a7 0%, #00838f 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.3);
}

/* Admin Banner Controls */
.admin-banner-controls {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.btn-edit-banner {
    flex: 1;
    background: #4caf50;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.btn-edit-banner:hover {
    background: #45a049;
}

.btn-delete-banner {
    flex: 1;
    background: #f44336;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.btn-delete-banner:hover {
    background: #da190b;
}

/* Modal Actions */
.banner-modal-actions {
    margin-top: 25px;
    text-align: center;
}

.banner-modal-actions .btn-primary {
    max-width: 400px;
    margin: 0 auto;
}

.banner-modal-description {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #ff1744;
}

/* 📱 Mobile Responsive - Banner */
@media (max-width: 768px) {
    .banner-marker-custom {
        width: 70px !important;
        height: 50px !important;
    }
    
    .banner-icon {
        font-size: 24px !important;
    }
    
    .banner-pulse {
        width: 25px;
        height: 25px;
        top: -10px;
        right: -10px;
        font-size: 10px;
    }
    
    .banner-marker-custom::after {
        font-size: 10px;
        padding: 2px 6px;
        bottom: -18px;
    }
    
    #bannerModal .modal-content {
        max-width: 95%;
        max-height: 95vh;
        margin: 2.5vh auto;
    }
    
    #bannerModal .modal-body {
        max-height: calc(95vh - 100px);
        padding: 15px;
    }
    
    .banner-image-container img {
        max-height: 50vh !important;
    }
}

@media (max-width: 480px) {
    .banner-marker-custom {
        width: 60px !important;
        height: 45px !important;
    }
    
    .banner-icon {
        font-size: 20px !important;
    }
    
    .banner-pulse {
        width: 22px;
        height: 22px;
        font-size: 9px;
    }
    
    #bannerModal .modal-content {
        max-width: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    #bannerModal .modal-body {
        max-height: calc(100vh - 80px);
        padding: 10px;
    }
    
    .banner-image-container img {
        max-height: 40vh !important;
    }
}

/* 🌟 Desktop Effects */
@media (min-width: 769px) {
    .banner-marker-custom::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100%;
        height: 100%;
        border-radius: 12px;
        border: 2px solid #ff1744;
        animation: ripple 2s linear infinite;
        pointer-events: none;
    }
    
    @keyframes ripple {
        0% {
            width: 100%;
            height: 100%;
            opacity: 1;
        }
        100% {
            width: 150%;
            height: 150%;
            opacity: 0;
        }
    }
}

/* ===== Auto Refresh Indicator ===== */
.refresh-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1e293b;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 999;
    animation: fadeInUp 0.5s ease;
}

.refresh-indicator i {
    animation: rotate 2s linear infinite;
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Modal Styles ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    backdrop-filter: blur(5px);
    overflow-y: auto;
    padding: 20px;
}

.modal-content {
    background: white;
    margin: 20px auto;
    padding: 0;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transform: scale(0.9);
    animation: modalSlideIn 0.3s ease forwards;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

@keyframes modalSlideIn {
    to {
        transform: scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, #FF5722 0%, #E64A19 100%);
    color: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header-content {
        padding: 0 15px;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .logo i {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header {
        height: 55px;
    }
    
    .map-container {
        margin-top: 55px;
    }
    
    .header-content {
        padding: 0 10px;
    }
    
    .logo {
        font-size: 1.1rem;
    }
    
    .logo span {
        display: none;
    }
}

/* ===== Other Styles (existing) ===== */
.leaflet-control-container {
    font-family: inherit;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.leaflet-popup-content {
    margin: 0;
    padding: 0;
}

.custom-popup .leaflet-popup-content-wrapper {
    padding: 0;
}

.custom-popup .leaflet-popup-tip {
    background: white;
}

/* Z-index hierarchy */
.leaflet-pane.leaflet-marker-pane {
    z-index: 600;
}

.leaflet-pane.leaflet-tooltip-pane {
    z-index: 650;
}

.leaflet-pane.leaflet-popup-pane {
    z-index: 700;
}

.banner-marker {
    z-index: 650 !important;
}

.listing-marker {
    z-index: 600 !important;
}

/* Performance optimization */
.banner-marker-custom {
    will-change: transform, box-shadow;
}

.banner-icon {
    will-change: text-shadow;
}

.banner-pulse {
    will-change: transform, box-shadow;
}

/* Shadow และ Glow Effect */
.banner-marker-custom {
    filter: drop-shadow(0 4px 8px rgba(255, 23, 68, 0.5));
}

.banner-marker-custom:hover {
    filter: drop-shadow(0 6px 12px rgba(255, 23, 68, 0.7));
}

/* Override conflicting styles */
.leaflet-div-icon.banner-marker {
    background: transparent !important;
    border: none !important;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    #bannerModal .modal-content {
        background: #2d2d2d;
        color: #fff;
    }
    
    #bannerModal .modal-body {
        background: #2d2d2d;
    }
    
    .banner-html-container {
        background: #404040;
        color: #e0e0e0;
    }
    
    .banner-modal-description {
        background: #404040;
        color: #ccc;
        border-left-color: #ff1744;
    }
}