/**
 * Hex Map Viewer - Main Stylesheet
 *
 * This file contains the base styles for the hex map viewer.
 * To customize, create assets/custom.css which will override these styles.
 */

/* ============================================================
   RESET & BASE
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: radial-gradient(ellipse at center, #1e2838 0%, #0d1117 100%);
    color: #eee;
    overflow: hidden;
}

/* ============================================================
   MAP CONTAINER
   ============================================================ */
#map-container {
    width: 100vw;
    height: 100vh;
    cursor: grab;
}

#map-container:active {
    cursor: grabbing;
}

/* ============================================================
   HEX STYLES
   ============================================================ */
.hex {
    stroke: rgba(0, 0, 0, 0.2);
    stroke-width: 0.5;
}

.hex-label {
    font-size: 10px;
    fill: #fff;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* ============================================================
   FEATURE ICONS
   ============================================================ */
.feature-icon {
    pointer-events: all;
    cursor: pointer;
}

.feature-icon .feature-symbol {
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.9));
    transition: transform 0.2s ease, filter 0.2s ease;
}

.feature-icon:hover .feature-symbol {
    transform: scale(1.2);
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 1)) drop-shadow(0 0 3px rgba(100, 200, 255, 0.6));
}

/* GM-only features (slightly transparent) */
.feature-icon[data-gm-only="true"] .feature-symbol {
    opacity: 0.7;
}

.feature-label {
    pointer-events: none;
}

/* ============================================================
   SHAPE RENDERING
   ============================================================ */
.shape-path {
    fill: none;
}

.shape-polygon {
    stroke-linejoin: round;
}

/* Shape layer z-index control via class ordering */
.shape-layer-terrain {
    /* Rendered first (bottom) */
}

.shape-layer-features {
    /* Rendered second */
}

.shape-layer-above-terrain {
    /* Rendered third */
}

.shape-layer-labels {
    /* Rendered last (top) */
}

/* ============================================================
   CONTROLS (Top-right zoom buttons)
   ============================================================ */
#controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}

#controls button {
    width: 40px;
    height: 40px;
    padding: 0;
    background: linear-gradient(135deg, rgba(30, 40, 60, 0.8) 0%, rgba(15, 20, 35, 0.9) 100%);
    border: 1px solid rgba(100, 150, 200, 0.3);
    border-radius: 8px;
    color: #e2e8f0;
    cursor: pointer;
    font-size: 20px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

#controls button:hover {
    background: linear-gradient(135deg, rgba(50, 70, 100, 0.9) 0%, rgba(30, 40, 60, 0.95) 100%);
    border-color: rgba(120, 180, 220, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

#controls button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ============================================================
   INFO BUTTON & PANEL (Bottom-left)
   ============================================================ */
#info-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: linear-gradient(135deg, rgba(30, 40, 60, 0.8) 0%, rgba(15, 20, 35, 0.9) 100%);
    border: 1px solid rgba(100, 150, 200, 0.3);
    border-radius: 8px;
    color: #e2e8f0;
    cursor: pointer;
    font-size: 20px;
    z-index: 100;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

#info-button:hover {
    background: linear-gradient(135deg, rgba(50, 70, 100, 0.9) 0%, rgba(30, 40, 60, 0.95) 100%);
    border-color: rgba(120, 180, 220, 0.5);
    transform: translateY(-2px);
}

#info-button.active {
    background: linear-gradient(135deg, rgba(50, 70, 100, 0.9) 0%, rgba(30, 40, 60, 0.95) 100%);
    border-color: rgba(120, 180, 220, 0.6);
}

#info-panel {
    position: fixed;
    bottom: 20px;
    left: 70px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.95) 0%, rgba(10, 10, 20, 0.98) 100%);
    border: 1px solid rgba(100, 150, 200, 0.3);
    border-radius: 12px;
    font-size: 13px;
    z-index: 100;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    min-width: 200px;
    max-width: 280px;
    display: none;
}

#info-panel.visible {
    display: block;
}

#info-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#info-panel-title {
    font-weight: 600;
    font-size: 15px;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#info-panel-collapse {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

#info-panel-collapse:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

#info-panel .stat {
    margin-bottom: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}

#info-panel .stat:last-child {
    margin-bottom: 0;
}

#info-panel .label {
    color: #64748b;
    font-weight: 500;
    min-width: 70px;
}

#info-panel .stat span:not(.label) {
    color: #e2e8f0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

#info-panel .no-selection {
    color: #64748b;
    font-style: italic;
}



/* ============================================
   TERRAIN COLORS
   Override in custom.css to change hex colors
   Example: .terrain-water-ocean { fill: #003366; }
   ============================================ */
.terrain-flat-desert-rocky { fill: #f2e272; }
.terrain-flat-desert-sandy { fill: #f7f284; }
.terrain-flat-farmland { fill: #a0d76b; }
.terrain-flat-forest-deciduous { fill: #93c663; }
.terrain-flat-forest-deciduous-heavy { fill: #93c663; }
.terrain-flat-forest-evergreen { fill: #7ab244; }
.terrain-flat-forest-evergreen-heavy { fill: #2d7721; }
.terrain-flat-forest-jungle { fill: #549e66; }
.terrain-flat-forest-jungle-heavy { fill: #4c8e59; }
.terrain-hills { fill: #e8ce59; }
.terrain-hills-forest-deciduous { fill: #8ebc51; }
.terrain-hills-forest-evergreen { fill: #478920; }
.terrain-hills-forest-jungle { fill: #478451; }
.terrain-mountain-volcano { fill: #d88e00; }
.terrain-mountain-volcano-dormant { fill: #c98e00; }
.terrain-mountains { fill: #b27f00; }
.terrain-mountains-forest-deciduous { fill: #87a333; }
.terrain-mountains-forest-evergreen { fill: #667221; }
.terrain-mountains-forest-jungle { fill: #367448; }
.terrain-other-badlands { fill: #ffcc66; }
.terrain-water-kelp-heavy { fill: #006699; }
.terrain-water-ocean { fill: #006699; }
.terrain-water-shoals { fill: #8cb2d8; }

/* ============================================
   SHAPE STYLES
   Shapes use their original WXX colors by default.
   stroke-dasharray is set via attribute from Worldographer data.
   Override by tag in custom.css:

   .shape-river { stroke: cyan !important; stroke-width: 4px !important; }
   .shape-road { stroke: #8B7355 !important; }
   .shape-border { stroke: #333 !important; stroke-dasharray: 4 2 !important; }
   ============================================ */
.shape-path, .shape-polygon {
    stroke: var(--wxx-stroke);
    stroke-width: var(--wxx-width);
    fill: var(--wxx-fill, none);
    opacity: var(--wxx-opacity, 1);
}


/* ============================================
   FEATURE TYPES
   Override in custom.css to change feature styles
   Example: .feature-military-castle .feature-symbol {
       filter: drop-shadow(0 0 8px gold);
   }
   ============================================ */
.feature-building-cathedral .feature-symbol {
    filter: drop-shadow(0 0 2px #FFD700);
}
.feature-building-pyramid .feature-symbol {
    filter: drop-shadow(0 0 2px #DEB887);
}
.feature-building-shrine .feature-symbol {
    filter: drop-shadow(0 0 2px #DAA520);
}
.feature-building-temple .feature-symbol {
    filter: drop-shadow(0 0 2px #FFD700);
}
.feature-building-tower .feature-symbol {
    filter: drop-shadow(0 0 2px #708090);
}
.feature-military-castle .feature-symbol {
    filter: drop-shadow(0 0 2px #696969);
}
.feature-military-fort .feature-symbol {
    filter: drop-shadow(0 0 2px #2F4F4F);
}
.feature-settlement-city .feature-symbol {
    filter: drop-shadow(0 0 2px #CD853F);
}
.feature-settlement-city-ruined .feature-symbol {
    filter: drop-shadow(0 0 2px #696969);
}
.feature-settlement-port .feature-symbol {
    filter: drop-shadow(0 0 2px #4682B4);
}
.feature-settlement-ruins .feature-symbol {
    filter: drop-shadow(0 0 2px #808080);
}
.feature-settlement-town .feature-symbol {
    filter: drop-shadow(0 0 2px #A0522D);
}
.feature-settlement-village .feature-symbol {
    filter: drop-shadow(0 0 2px #8B4513);
}
.feature-symbol-cave .feature-symbol {
    filter: drop-shadow(0 0 2px #000000);
}
.feature-symbol-landmark .feature-symbol {
    filter: drop-shadow(0 0 2px #FF6347);
}
.feature-symbol-monolith .feature-symbol {
    filter: drop-shadow(0 0 2px #A9A9A9);
}
.feature-symbol-totem .feature-symbol {
    filter: drop-shadow(0 0 2px #8B4513);
}
.feature-three-dots .feature-symbol {
    filter: drop-shadow(0 0 2px #000000);
}