* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ---- Coordinate Display (Leaflet Control) ---- */
.coord-display {
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.8);
    color: #ccc;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    border-radius: 6px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Sidebar */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100%;
    background: rgba(16, 18, 22, 0.95);
    color: #e0e0e0;
    z-index: 1000;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.5);
}

#sidebar.collapsed {
    transform: translateX(-300px);
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: absolute;
    top: 12px;
    right: -36px;
    width: 36px;
    height: 36px;
    background: rgba(16, 18, 22, 0.95);
    border: none;
    color: #e0e0e0;
    font-size: 20px;
    cursor: pointer;
    border-radius: 0 6px 6px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.4);
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(40, 44, 52, 0.95);
}

/* Sidebar Header */
.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.sidebar-subtitle {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

/* Layer Section */
.layer-section {
    padding: 4px 16px;
}

.layer-toggle {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 12px;
}

.layer-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Toggle Switch */
.layer-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 40px;
    height: 22px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 11px;
    flex-shrink: 0;
    transition: background 0.3s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #888;
    border-radius: 50%;
    transition: transform 0.3s, background 0.3s;
}

.layer-toggle input[type="checkbox"]:checked + .toggle-slider {
    background: rgba(66, 133, 244, 0.4);
}

.layer-toggle input[type="checkbox"]:checked + .toggle-slider::after {
    transform: translateX(18px);
    background: #4285f4;
}

/* Layer Label */
.layer-label {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: #ccc;
    transition: color 0.2s;
}

.layer-toggle input[type="checkbox"]:checked ~ .layer-label {
    color: #fff;
}

/* Layer Icon Dot */
.layer-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Section Divider */
.section-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 8px 20px;
}

/* Legend */
.sidebar-legend {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-title {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #aaa;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Map Container */
#map {
    position: absolute;
    top: 0;
    left: 300px;
    right: 0;
    bottom: 0;
    transition: left 0.3s ease;
    background: #0fa8d2;
}

#sidebar.collapsed ~ #map {
    left: 0;
}


/* Loading indicator */
.layer-loading {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #4285f4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: auto;
    flex-shrink: 0;
}

.layer-toggle.loading .layer-loading {
    display: block;
}

.layer-toggle.load-success {
    background: rgba(50, 205, 50, 0.08);
    transition: background 0.3s;
}

.layer-toggle.load-error {
    background: rgba(255, 60, 60, 0.1);
}

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

/* ---- Player Marker ---- */
.player-marker-wrapper {
    background: none !important;
    border: none !important;
}

.player-marker {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #00ff88;
    overflow: hidden;
    background: #1a1c24;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 255, 136, 0.4);
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-initials {
    color: #00ff88;
    font-size: 11px;
    font-weight: 700;
}

.player-name {
    margin-top: 2px;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
    text-align: center;
}

.player-pulse {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #00ff88;
    animation: player-pulse 2s ease-out infinite;
    pointer-events: none;
}

@keyframes player-pulse {
    0% { transform: translateX(-50%) scale(1); opacity: 0.6; }
    100% { transform: translateX(-50%) scale(2); opacity: 0; }
}

/* ---- Unit Logo Marker ---- */
.unit-logo-marker {
    background: none !important;
    border: none !important;
}

.unit-logo-bg {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.unit-logo-marker img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

/* ---- Zone Name Labels on Map ---- */
.zone-label-marker {
    background: none !important;
    border: none !important;
}

.zone-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 6px rgba(0, 0, 0, 0.5);
    transform: translateX(-50%);
    pointer-events: none;
    opacity: 0.85;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Restricted X Marker ---- */
.restricted-x-marker {
    background: none !important;
    border: none !important;
}

/* Zoom'a duyarlı ölçekleme */
.zoom-scale {
    transform: scale(var(--zoom-scale, 1));
}

.zone-label {
    transform: translateX(-50%) scale(var(--zoom-scale, 1));
}

/* ---- Compact toggle (player layer) ---- */
.layer-toggle-compact {
    padding: 6px 12px;
}

.toggle-slider-sm {
    width: 32px !important;
    height: 18px !important;
    border-radius: 9px !important;
}

.toggle-slider-sm::after {
    width: 12px !important;
    height: 12px !important;
    top: 3px !important;
    left: 3px !important;
}

.layer-toggle input[type="checkbox"]:checked + .toggle-slider-sm::after {
    transform: translateX(14px) !important;
}

.layer-icon-sm {
    width: 7px !important;
    height: 7px !important;
}

.layer-label-sm {
    font-size: 11px !important;
}

/* ---- Unit row focused state ---- */
.unit-row {
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 4px;
}

.unit-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.unit-row.focused {
    background: rgba(66, 133, 244, 0.12);
    border-left: 2px solid #4285f4;
    padding-left: 6px;
}

/* ---- Sidebar Editor Button ---- */
.sidebar-editor-section {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-editor-btn {
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.15), rgba(66, 133, 244, 0.08));
    border: 1px solid rgba(66, 133, 244, 0.25);
    border-radius: 8px;
    color: #4285f4;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.sidebar-editor-btn:hover {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.25), rgba(66, 133, 244, 0.15));
    border-color: rgba(66, 133, 244, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.2);
}

.sidebar-editor-btn:active {
    transform: translateY(0);
}

.sidebar-editor-btn.active {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(255, 107, 53, 0.1));
    border-color: rgba(255, 107, 53, 0.3);
    color: #ff6b35;
}

.sidebar-editor-icon {
    font-size: 18px;
    line-height: 1;
}

.sidebar-editor-text {
    flex: 1;
    text-align: left;
}

/* ---- Rotate Gizmo ---- */
.rotate-gizmo-handle {
    width: 18px;
    height: 18px;
    background: #4285f4;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 1px 6px rgba(66, 133, 244, 0.6), 0 0 12px rgba(66, 133, 244, 0.3);
    transition: transform 0.1s;
}

.rotate-gizmo-handle:hover {
    transform: scale(1.2);
}

.rotate-gizmo-handle:active {
    cursor: grabbing;
}

/* ---- House Markers (Real Estate) ---- */
.house-marker {
    background: none !important;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

/* ---- Waypoint Button (popup içi) ---- */
.waypoint-btn {
    margin-top: 6px;
    padding: 4px 10px;
    background: rgba(66, 133, 244, 0.15);
    border: 1px solid rgba(66, 133, 244, 0.3);
    color: #4285f4;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s;
}

.waypoint-btn:hover {
    background: rgba(66, 133, 244, 0.3);
}

.house-marker-reserved {
    border-radius: 50%;
    box-shadow: 0 0 0 3px #ff8c00, 0 0 8px rgba(255, 140, 0, 0.5) !important;
}

/* ---- Radius Gizmo ---- */
.radius-gizmo-handle {
    width: 16px;
    height: 16px;
    background: #32cd32;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: ew-resize;
    box-shadow: 0 1px 6px rgba(50, 205, 50, 0.6), 0 0 10px rgba(50, 205, 50, 0.3);
}

.radius-gizmo-handle:hover {
    transform: scale(1.25);
}

/* ---- Radar Marker ---- */
.radar-marker {
    background: none !important;
    border: none !important;
}

.radar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
    transition: transform 0.1s;
}

/* ---- Player Zone Info Panel ---- */
.player-zone-panel {
    position: fixed;
    bottom: 12px;
    right: 12px;
    min-width: 200px;
    max-width: 300px;
    background: rgba(13, 15, 20, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    z-index: 1500;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.pzp-header {
    padding: 8px 14px;
    font-size: 10px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pzp-content {
    padding: 6px 10px;
    max-height: 160px;
    overflow-y: auto;
}

.pzp-empty {
    display: block;
    padding: 6px 4px;
    font-size: 12px;
    color: #555;
    font-style: italic;
}

.pzp-zone {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.pzp-zone:last-child {
    border-bottom: none;
}

.pzp-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pzp-zone-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pzp-name {
    font-size: 12px;
    color: #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pzp-unit-name {
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pzp-unit-logo {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.pzp-type {
    font-size: 9px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
