/* FiberGIS Main Styles */
* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    background: #f0f0f0;
    overflow: hidden;
}

/* Top menu bar */
#menubar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: #2c3e50;
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

#menubar .menu-title {
    color: #00d4ff;
    font-weight: 700;
    font-size: 14px;
    padding: 0 12px;
    letter-spacing: 1px;
}

/* Status bar */
#statusbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 22px;
    background: #2c3e50;
    color: #aaa;
    font-size: 11px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    z-index: 1000;
    gap: 20px;
}

#statusbar span { color: #ccc; }

/* Map container */
#map {
    position: fixed;
    top: 28px;
    left: 0;
    right: 0;
    bottom: 22px;
    z-index: 1;
}

/* EasyUI overrides */
.panel-header { background: #2c3e50 !important; }
.panel-title { color: #fff !important; font-size: 12px !important; }

/* Popup styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.popup-title {
    font-weight: 600;
    font-size: 13px;
    color: #2c3e50;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

.popup-row {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 12px;
}

.popup-label { color: #888; min-width: 80px; }
.popup-value { color: #333; font-weight: 500; }

.popup-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.popup-btn {
    padding: 4px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f8f8f8;
    cursor: pointer;
    font-size: 11px;
    color: #333;
    transition: background 0.15s;
}

.popup-btn:hover { background: #e8e8e8; }
.popup-btn.primary { background: #2980b9; color: #fff; border-color: #2980b9; }
.popup-btn.primary:hover { background: #1a6a9a; }
.popup-btn.danger { background: #e74c3c; color: #fff; border-color: #e74c3c; }
.popup-btn.danger:hover { background: #c0392b; }

/* State badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.badge-plan { background: #e8f4fd; color: #2980b9; }
.badge-fact { background: #e8f8e8; color: #27ae60; }

/* Floating panel */
.floating-panel {
    position: absolute;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 500;
    min-width: 280px;
}

.floating-panel-header {
    background: #2c3e50;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px 8px 0 0;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

.floating-panel-close {
    cursor: pointer;
    color: #aaa;
    font-size: 16px;
    line-height: 1;
}
.floating-panel-close:hover { color: #fff; }

.floating-panel-body { padding: 12px; }

/* Form styles */
.form-row {
    margin-bottom: 10px;
}

.form-row label {
    display: block;
    font-size: 12px;
    color: #555;
    margin-bottom: 4px;
    font-weight: 500;
}

.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    border-color: #2980b9;
}

.btn {
    padding: 6px 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: #2980b9; color: #fff; }
.btn-success { background: #27ae60; color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-default { background: #ecf0f1; color: #333; border: 1px solid #ccc; }

/* Toolbar */
.map-toolbar {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    transition: background 0.15s;
}
.toolbar-btn:hover { background: #f0f0f0; }
.toolbar-btn.active { background: #2980b9; color: #fff; border-color: #2980b9; }

/* District selector */
#districtSelector {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 400;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    outline: none;
}

/* Loading overlay */
#loadingOverlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Leaflet marker cluster */
.marker-cluster-small { background-color: rgba(181, 226, 140, 0.6); }
.marker-cluster-small div { background-color: rgba(110, 204, 57, 0.6); }
.marker-cluster-medium { background-color: rgba(241, 211, 87, 0.6); }
.marker-cluster-medium div { background-color: rgba(240, 194, 12, 0.6); }
.marker-cluster-large { background-color: rgba(253, 156, 115, 0.6); }
.marker-cluster-large div { background-color: rgba(241, 128, 23, 0.6); }
