/* =============================================
   Titan Apocalypse Map - Apocalyptic Styling
   Dark / Survival / Distressed / Rust Theme
   ============================================= */

html, body
{
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    font-family: 'Courier New', Courier, monospace;
    color: #d8d2c8;
    overflow: hidden;
}

body
{
    background:
        linear-gradient(rgba(25, 15, 10, 0.85), rgba(8, 6, 5, 0.95)),
        radial-gradient(circle at 20% 0%, rgba(180, 60, 20, 0.25), transparent 40%),
        radial-gradient(circle at 80% 100%, rgba(100, 30, 10, 0.2), transparent 35%),
        #0a0a0a;
}

/* Distressed noise overlay */
body::before
{
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
    z-index: 9999;
}

#map-shell
{
    position: relative;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(rgba(20, 18, 16, 0.2), rgba(8, 6, 5, 0.4));
}

#map
{
    width: 100%;
    height: 100%;
    z-index: 1;
    filter: contrast(1.08) saturate(0.82) brightness(0.95);
}

/* =============================================
   HEADER - Warning Panel Style
   ============================================= */

#map-header
{
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    background: rgba(20, 16, 12, 0.92);
    border: 2px solid rgba(180, 80, 30, 0.6);
    border-left: 6px solid rgba(200, 90, 35, 0.8);
    box-shadow: 
        0 0 25px rgba(0, 0, 0, 0.7),
        inset 0 0 30px rgba(60, 30, 15, 0.3);
    backdrop-filter: blur(4px);
}

.title-wrap h1
{
    margin: 0;
    font-size: 26px;
    font-weight: bold;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #e8a050;
    text-shadow: 
        0 0 8px rgba(200, 100, 30, 0.6),
        0 0 20px rgba(180, 70, 20, 0.3);
    font-family: Impact, 'Arial Black', sans-serif;
}

.title-wrap p
{
    margin: 6px 0 0 0;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #b87040;
    text-shadow: 0 0 4px rgba(160, 70, 30, 0.5);
}

/* =============================================
   SEARCH CONTROLS
   ============================================= */

#map-controls
{
    display: flex;
    gap: 10px;
    align-items: center;
}

#world-selector
{
    padding: 12px 16px;
    background: rgba(12, 10, 8, 0.95);
    border: 2px solid rgba(160, 70, 30, 0.6);
    border-left: 4px solid rgba(180, 80, 35, 0.8);
    color: #e8d8c0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    box-shadow: inset 0 0 15px rgba(40, 20, 10, 0.5);
}

#world-selector option
{
    background: #1a1510;
    color: #e8d8c0;
}

#map-search
{
    width: 300px;
    max-width: 35vw;
    padding: 12px 16px;
    background: rgba(12, 10, 8, 0.95);
    border: 2px solid rgba(160, 70, 30, 0.6);
    border-left: 4px solid rgba(180, 80, 35, 0.8);
    color: #e8d8c0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    outline: none;
    box-shadow: inset 0 0 15px rgba(40, 20, 10, 0.5);
}

#map-search::placeholder
{
    color: #705840;
    font-style: italic;
}

#map-search:focus
{
    border-color: rgba(220, 100, 40, 0.8);
    box-shadow: 
        inset 0 0 15px rgba(60, 30, 15, 0.6),
        0 0 10px rgba(200, 90, 35, 0.3);
}

#search-btn
{
    padding: 12px 22px;
    border: 2px solid rgba(160, 70, 30, 0.7);
    border-left: 4px solid rgba(180, 80, 35, 0.9);
    background: linear-gradient(180deg, #6a2a15, #3a150a);
    color: #f0e0d0;
    font-family: Impact, 'Arial Black', sans-serif;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.4);
}

#search-btn:hover
{
    background: linear-gradient(180deg, #8a3a20, #4a1a0d);
    border-color: rgba(220, 100, 45, 0.9);
    box-shadow: 
        0 0 20px rgba(0, 0, 0, 0.5),
        0 0 10px rgba(200, 90, 35, 0.4);
}

#search-btn:active
{
    transform: translateY(1px);
}

/* =============================================
   LEGEND - Tactical Display
   ============================================= */

#map-legend
{
    position: absolute;
    top: 100px;
    left: 14px;
    z-index: 1000;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 650px;
    padding: 12px 14px;
    background: rgba(20, 16, 12, 0.9);
    border: 2px solid rgba(140, 60, 25, 0.5);
    border-left: 4px solid rgba(160, 70, 30, 0.7);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.legend-item
{
    padding: 8px 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid rgba(100, 50, 20, 0.4);
    background: rgba(0, 0, 0, 0.3);
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

.legend-item.settlement { color: #f0d080; border-color: rgba(240, 208, 128, 0.4); }
.legend-item.clan       { color: #6ea8ff; border-color: rgba(110, 168, 255, 0.4); }
.legend-item.region     { color: #c090ff; border-color: rgba(192, 144, 255, 0.4); }
.legend-item.event      { color: #ffa050; border-color: rgba(255, 160, 80, 0.4); }
.legend-item.horde      { color: #cf5050; border-color: rgba(207, 80, 80, 0.4); }
.legend-item.boss       { color: #ff4040; border-color: rgba(255, 64, 64, 0.4); }
.legend-item.spawn      { color: #70d070; border-color: rgba(112, 208, 112, 0.4); }

/* =============================================
   COORDINATE DISPLAY
   ============================================= */

#coord-display
{
    position: absolute;
    bottom: 18px;
    left: 14px;
    z-index: 1000;
    padding: 12px 18px;
    background: rgba(20, 16, 12, 0.92);
    border: 2px solid rgba(140, 60, 25, 0.5);
    border-left: 4px solid rgba(160, 70, 30, 0.7);
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #d0c0b0;
    font-family: 'Courier New', monospace;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.4);
}

#last-update
{
    position: absolute;
    bottom: 18px;
    right: 14px;
    z-index: 1000;
    padding: 10px 16px;
    background: rgba(20, 16, 12, 0.9);
    border: 2px solid rgba(140, 60, 25, 0.4);
    font-size: 11px;
    letter-spacing: 1px;
    color: #a08060;
    font-family: 'Courier New', monospace;
}

/* =============================================
   LEAFLET CUSTOMIZATION
   ============================================= */

.leaflet-popup-content-wrapper
{
    background: rgba(18, 14, 10, 0.96) !important;
    color: #e0d4c8 !important;
    border: 2px solid rgba(160, 70, 30, 0.5) !important;
    border-left: 4px solid rgba(180, 80, 35, 0.7) !important;
    border-radius: 0 !important;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.7) !important;
    font-family: 'Courier New', monospace;
}

.leaflet-popup-content
{
    margin: 12px 16px !important;
    font-size: 13px;
    line-height: 1.5;
}

.leaflet-popup-content b
{
    color: #e8a050;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.leaflet-popup-tip
{
    background: rgba(18, 14, 10, 0.96) !important;
    border: 2px solid rgba(160, 70, 30, 0.5) !important;
}

.leaflet-control-zoom a
{
    background: rgba(20, 16, 12, 0.95) !important;
    color: #e8a050 !important;
    border: 2px solid rgba(140, 60, 25, 0.6) !important;
    border-left: 3px solid rgba(160, 70, 30, 0.8) !important;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4) !important;
}

.leaflet-control-zoom a:hover
{
    background: rgba(35, 28, 22, 0.95) !important;
    color: #ffb060 !important;
    border-color: rgba(200, 90, 40, 0.8) !important;
}

.leaflet-container
{
    background: #0f0d0b !important;
}

/* Custom marker styling */
.custom-marker
{
    filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.8));
}

/* =============================================
   ANIMATIONS
   ============================================= */

@keyframes pulse-red
{
    0%, 100% { box-shadow: 0 0 5px rgba(200, 60, 30, 0.5); }
    50% { box-shadow: 0 0 20px rgba(200, 60, 30, 0.8); }
}

.legend-item.horde
{
    animation: pulse-red 2s ease-in-out infinite;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 768px)
{
    #map-header
    {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .title-wrap h1
    {
        font-size: 18px;
    }
    
    #map-search
    {
        width: 200px;
    }
    
    #map-legend
    {
        top: 140px;
        max-width: 300px;
    }
}
