/* FrostMap - Hytale World Viewer Styles */

@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,wght@0,400;0,600;0,700;1,400&family=Lexend:wght@700&display=swap');

:root {
    /* Hytale Color Palette - extracted from site */
    --hytale-bg-dark: #182636;
    --hytale-bg: #1e3044;
    --hytale-bg-light: #243a52;
    --hytale-nav-bg: #1a2d42;
    --hytale-gold: #c4a35a;
    --hytale-gold-light: #d4b76a;
    --hytale-gold-dark: #a08040;
    --hytale-gold-border: #8b7035;
    --hytale-text: #9ab;
    --hytale-text-bright: #cde;
    --hytale-cyan: #5ad;
    --hytale-border: #2a4a66;

    /* Button gradient colors */
    --btn-top: #6ba3c7;
    --btn-mid: #5a8fb8;
    --btn-bottom: #4a7da5;
    --btn-border: #3a6080;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--hytale-bg-dark);
    color: var(--hytale-text);
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: linear-gradient(180deg,
        var(--hytale-bg-dark) 0%,
        #0f1c28 100%);
}

/* Header - matches Hytale nav bar */
#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 56px;
    background: linear-gradient(180deg,
        rgba(26, 45, 66, 0.98) 0%,
        rgba(20, 36, 52, 0.98) 100%);
    border-bottom: 1px solid var(--hytale-border);
    flex-shrink: 0;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Title styled like Hytale headings */
.header-left h1 {
    font-family: 'Lexend', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--hytale-text-bright);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-right span {
    padding: 6px 12px;
    background: rgba(30, 48, 68, 0.8);
    border: 1px solid var(--hytale-border);
    border-radius: 3px;
    color: var(--hytale-text);
    font-variant-numeric: tabular-nums;
}

/* Loading Overlay */
#loading-overlay {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--hytale-bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 500;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--hytale-border);
    border-top-color: var(--hytale-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-family: 'Lexend', sans-serif;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--hytale-text);
}

/* World Select - Hytale button style */
.select-wrapper {
    position: relative;
    display: inline-block;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #fff;
    pointer-events: none;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

#world-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 8px 36px 8px 14px;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 200px;
    cursor: pointer;

    /* Hytale blue button gradient */
    background: linear-gradient(180deg,
        var(--btn-top) 0%,
        var(--btn-mid) 50%,
        var(--btn-bottom) 100%);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);

    /* Border styling */
    border: 2px solid var(--btn-border);
    border-radius: 3px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.3);

    transition: all 0.15s ease;
}

#world-select:hover {
    background:
        linear-gradient(180deg,
            #7bb3d7 0%,
            #6a9fc8 50%,
            #5a8db5 100%);
    border-color: #4a7090;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 3px 6px rgba(0, 0, 0, 0.35);
}

#world-select:focus {
    outline: none;
    border-color: var(--hytale-cyan);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 0 0 2px rgba(85, 170, 221, 0.3);
}

#world-select:active {
    background:
        linear-gradient(180deg,
            var(--btn-bottom) 0%,
            var(--btn-mid) 50%,
            var(--btn-top) 100%);
    box-shadow:
        inset 0 2px 3px rgba(0, 0, 0, 0.2);
}

#world-select option {
    background: var(--hytale-bg);
    color: var(--hytale-text-bright);
    padding: 8px;
}

/* Map Container */
#map {
    flex: 1;
    background: radial-gradient(ellipse at center,
        var(--hytale-bg) 0%,
        var(--hytale-bg-dark) 100%);
}

/* Leaflet Overrides */
.leaflet-container {
    background: var(--hytale-bg-dark);
    font-family: 'Nunito Sans', sans-serif;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    border-radius: 3px !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    background: linear-gradient(180deg,
        var(--hytale-bg-light) 0%,
        var(--hytale-bg) 100%) !important;
    color: var(--hytale-text-bright) !important;
    border: none !important;
    border-bottom: 1px solid var(--hytale-border) !important;
    width: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    transition: all 0.15s ease !important;
}

.leaflet-control-zoom a:last-child {
    border-bottom: none !important;
}

.leaflet-control-zoom a:hover {
    background: linear-gradient(180deg,
        #2d4a64 0%,
        var(--hytale-bg-light) 100%) !important;
    color: #fff !important;
}

.leaflet-control-attribution {
    background: rgba(24, 38, 54, 0.95) !important;
    color: var(--hytale-text) !important;
    padding: 3px 8px !important;
    border-radius: 3px 0 0 0 !important;
    border: 1px solid var(--hytale-border) !important;
    border-right: none !important;
    border-bottom: none !important;
    font-size: 0.7rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.leaflet-control-attribution a {
    color: var(--hytale-cyan) !important;
}

/* Tile styling - pixelated for that blocky game feel */
.leaflet-tile {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--hytale-bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--hytale-bg-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--hytale-border);
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive */
@media (max-width: 768px) {
    #header {
        flex-direction: column;
        height: auto;
        padding: 10px 16px;
        gap: 10px;
    }

    .header-left {
        flex-direction: column;
        gap: 10px;
    }

    .header-right {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    .header-right span {
        padding: 5px 8px;
        font-size: 0.75rem;
    }

    #world-select {
        min-width: 160px;
    }
}

/* Player Panel */
#player-panel {
    position: absolute;
    top: 66px;
    right: 10px;
    width: 220px;
    max-height: calc(100vh - 80px);
    background: rgba(26, 45, 66, 0.95);
    border: 1px solid var(--hytale-border);
    border-radius: 6px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#player-panel.collapsed {
    max-height: 40px;
    overflow: hidden;
}

#player-panel.collapsed #player-list {
    display: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(180deg,
        rgba(36, 58, 82, 0.9) 0%,
        rgba(30, 48, 68, 0.9) 100%);
    border-bottom: 1px solid var(--hytale-border);
    border-radius: 5px 5px 0 0;
}

.panel-header h3 {
    font-family: 'Lexend', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--hytale-text-bright);
    margin: 0;
}

.panel-header h3 span {
    color: var(--hytale-text);
    font-weight: 400;
}

#toggle-players {
    background: none;
    border: 1px solid var(--hytale-border);
    color: var(--hytale-text);
    width: 22px;
    height: 22px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#toggle-players:hover {
    background: rgba(90, 170, 221, 0.2);
    border-color: var(--hytale-cyan);
    color: var(--hytale-text-bright);
}

#player-list {
    overflow-y: auto;
    max-height: 300px;
    padding: 4px 0;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(42, 74, 102, 0.5);
}

.player-item:last-child {
    border-bottom: none;
}

.player-item:hover {
    background: rgba(90, 170, 221, 0.15);
}

.player-avatar {
    width: 24px;
    height: 24px;
    background: var(--hytale-gold);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--hytale-bg-dark);
    flex-shrink: 0;
}

.player-info {
    flex: 1;
    min-width: 0;
}

.player-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--hytale-text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-coords {
    font-size: 0.7rem;
    color: var(--hytale-text);
    font-variant-numeric: tabular-nums;
}

.player-world {
    font-size: 0.65rem;
    color: var(--hytale-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Player marker on map */
.player-marker-container {
    background: transparent !important;
    border: none !important;
}

.leaflet-marker-icon.player-marker-container {
    background: transparent !important;
    border: none !important;
}

.player-marker-container .player-marker {
    width: 24px;
    height: 24px;
    background: var(--hytale-gold);
    border: 2px solid var(--hytale-gold-dark);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
}

.player-marker-container .player-marker-inner {
    font-size: 11px;
    font-weight: 700;
    color: var(--hytale-bg-dark);
    line-height: 1;
    transform-origin: center center;
}

.player-marker-container .player-marker-direction {
    position: absolute;
    top: -6px;
    left: 50%;
    margin-left: -5px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid var(--hytale-gold);
    filter: drop-shadow(0 -1px 1px rgba(0,0,0,0.3));
}

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
    background: rgba(26, 45, 66, 0.95);
    border: 1px solid var(--hytale-border);
    border-radius: 6px;
    color: var(--hytale-text-bright);
}

.leaflet-popup-content {
    margin: 10px 14px;
    font-family: 'Nunito Sans', sans-serif;
}

.leaflet-popup-tip {
    background: rgba(26, 45, 66, 0.95);
    border: 1px solid var(--hytale-border);
}

.player-popup {
    text-align: center;
}

.player-popup-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--hytale-gold);
    margin-bottom: 4px;
}

.player-popup-coords {
    font-size: 0.8rem;
    color: var(--hytale-text);
    font-variant-numeric: tabular-nums;
}

/* No players message */
.no-players {
    padding: 16px 12px;
    text-align: center;
    color: var(--hytale-text);
    font-size: 0.8rem;
    font-style: italic;
}

/* Responsive player panel */
@media (max-width: 600px) {
    #player-panel {
        width: 180px;
        right: 5px;
        top: auto;
        bottom: 10px;
        max-height: 200px;
    }
}


